summaryrefslogtreecommitdiff
path: root/m4/assert_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/assert_h.m4')
-rw-r--r--m4/assert_h.m424
1 files changed, 15 insertions, 9 deletions
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index e3aaad34ddc..d3d4c42519f 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -9,16 +9,16 @@ dnl From Paul Eggert.
AC_DEFUN([gl_ASSERT_H],
[
AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
- [gl_save_CFLAGS=$CFLAGS
+ [gl_saved_CFLAGS=$CFLAGS
for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do
AS_CASE([$gl_working],
- [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"])
+ [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#if defined __clang__ && __STDC_VERSION__ < 202311
#pragma clang diagnostic error "-Wc2x-extensions"
- #pragma clang diagnostic error "-Wc++17-extensions"
+ #pragma clang diagnostic error "-Wc++1z-extensions"
#endif
#ifdef INCLUDE_ASSERT_H
#include <assert.h>
@@ -32,7 +32,7 @@ AC_DEFUN([gl_ASSERT_H],
]])],
[gl_cv_static_assert=$gl_working],
[gl_cv_static_assert=no])
- CFLAGS=$gl_save_CFLAGS
+ CFLAGS=$gl_saved_CFLAGS
test "$gl_cv_static_assert" != no && break
done])
@@ -46,10 +46,13 @@ AC_DEFUN([gl_ASSERT_H],
gl_NEXT_HEADERS([assert.h])])
dnl The "zz" puts this toward config.h's end, to avoid potential
- dnl collisions with other definitions. #undef assert so that
- dnl programs are not tempted to use it without specifically
- dnl including assert.h. Break the #undef apart with a comment
- dnl so that 'configure' does not comment it out.
+ dnl collisions with other definitions.
+ dnl #undef assert so that programs are not tempted to use it without
+ dnl specifically including assert.h.
+ dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
+ dnl <assert.h>, this include actually defines assert.
+ dnl Break the #undef_s apart with a comment so that 'configure' does
+ dnl not comment them out.
AH_VERBATIM([zzstatic_assert],
[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
&& (!defined __cplusplus \
@@ -57,10 +60,13 @@ AC_DEFUN([gl_ASSERT_H],
&& __GNUG__ < 6 && __clang_major__ < 6)))
#include <assert.h>
#undef/**/assert
+ #ifdef __sgi
+ #undef/**/__ASSERT_H__
+ #endif
/* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
We need it also to be invocable with a single argument. */
#if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
- #undef static_assert
+ #undef/**/static_assert
#define static_assert _Static_assert
#endif
#endif])