-/* Copyright (C) 1991,1992,1994-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.2 Diagnostics <assert.h>
__BEGIN_DECLS
/* This prints an "Assertion failed" message and aborts. */
-extern void __assert_fail (__const char *__assertion, __const char *__file,
- unsigned int __line, __const char *__function)
+extern void __assert_fail (const char *__assertion, const char *__file,
+ unsigned int __line, const char *__function)
__THROW __attribute__ ((__noreturn__));
/* Likewise, but prints the error text for ERRNUM. */
-extern void __assert_perror_fail (int __errnum, __const char *__file,
- unsigned int __line,
- __const char *__function)
+extern void __assert_perror_fail (int __errnum, const char *__file,
+ unsigned int __line, const char *__function)
__THROW __attribute__ ((__noreturn__));
__END_DECLS
-# define assert(expr) \
- (__ASSERT_VOID_CAST ((expr) ? 0 : \
- (__assert_fail (__STRING(expr), __FILE__, __LINE__, \
- __ASSERT_FUNCTION), 0)))
+# define assert(expr) \
+ ((expr) \
+ ? __ASSERT_VOID_CAST (0) \
+ : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
# ifdef __USE_GNU
-# define assert_perror(errnum) \
- (__ASSERT_VOID_CAST (!(errnum) ? 0 : \
- (__assert_perror_fail ((errnum), __FILE__, __LINE__, \
- __ASSERT_FUNCTION), 0)))
+# define assert_perror(errnum) \
+ (!(errnum) \
+ ? __ASSERT_VOID_CAST (0) \
+ : __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION))
# endif
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNCTION __func__
# else
-# define __ASSERT_FUNCTION ((__const char *) 0)
+# define __ASSERT_FUNCTION ((const char *) 0)
# endif
# endif
#endif /* NDEBUG. */
+
+
+#if defined __USE_ISOC11 && !defined __cplusplus
+/* Static assertion. Requires support in the compiler. */
+# undef static_assert
+# define static_assert _Static_assert
+#endif