summaryrefslogtreecommitdiff
path: root/gnulib-m4/assert_h.m4
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /gnulib-m4/assert_h.m4
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'gnulib-m4/assert_h.m4')
-rw-r--r--gnulib-m4/assert_h.m430
1 files changed, 21 insertions, 9 deletions
diff --git a/gnulib-m4/assert_h.m4 b/gnulib-m4/assert_h.m4
index c1306dae..d3d4c425 100644
--- a/gnulib-m4/assert_h.m4
+++ b/gnulib-m4/assert_h.m4
@@ -1,5 +1,5 @@
# assert-h.m4
-dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -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,5 +60,14 @@ 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
+ #define static_assert _Static_assert
+ #endif
#endif])
])