diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 16:27:12 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 16:27:12 +0100 |
| commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
| tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/m4/assert_h.m4 | |
| parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
| download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz | |
Sync with the latest Gnulib code (d4ec02b3cc)
Diffstat (limited to 'gl/m4/assert_h.m4')
| -rw-r--r-- | gl/m4/assert_h.m4 | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 index abba4fa3..b90d0f19 100644 --- a/gl/m4/assert_h.m4 +++ b/gl/m4/assert_h.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # assert-h.m4 | 1 | # assert_h.m4 |
| 2 | dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. | 2 | # serial 1 |
| 3 | dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| @@ -9,16 +10,16 @@ dnl From Paul Eggert. | |||
| 9 | AC_DEFUN([gl_ASSERT_H], | 10 | AC_DEFUN([gl_ASSERT_H], |
| 10 | [ | 11 | [ |
| 11 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], | 12 | AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], |
| 12 | [gl_save_CFLAGS=$CFLAGS | 13 | [gl_saved_CFLAGS=$CFLAGS |
| 13 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do | 14 | for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do |
| 14 | AS_CASE([$gl_working], | 15 | AS_CASE([$gl_working], |
| 15 | [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) | 16 | [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) |
| 16 | 17 | ||
| 17 | AC_COMPILE_IFELSE( | 18 | AC_COMPILE_IFELSE( |
| 18 | [AC_LANG_PROGRAM( | 19 | [AC_LANG_PROGRAM( |
| 19 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 | 20 | [[#if defined __clang__ && __STDC_VERSION__ < 202311 |
| 20 | #pragma clang diagnostic error "-Wc2x-extensions" | 21 | #pragma clang diagnostic error "-Wc2x-extensions" |
| 21 | #pragma clang diagnostic error "-Wc++17-extensions" | 22 | #pragma clang diagnostic error "-Wc++1z-extensions" |
| 22 | #endif | 23 | #endif |
| 23 | #ifdef INCLUDE_ASSERT_H | 24 | #ifdef INCLUDE_ASSERT_H |
| 24 | #include <assert.h> | 25 | #include <assert.h> |
| @@ -32,7 +33,7 @@ AC_DEFUN([gl_ASSERT_H], | |||
| 32 | ]])], | 33 | ]])], |
| 33 | [gl_cv_static_assert=$gl_working], | 34 | [gl_cv_static_assert=$gl_working], |
| 34 | [gl_cv_static_assert=no]) | 35 | [gl_cv_static_assert=no]) |
| 35 | CFLAGS=$gl_save_CFLAGS | 36 | CFLAGS=$gl_saved_CFLAGS |
| 36 | test "$gl_cv_static_assert" != no && break | 37 | test "$gl_cv_static_assert" != no && break |
| 37 | done]) | 38 | done]) |
| 38 | 39 | ||
| @@ -46,10 +47,13 @@ AC_DEFUN([gl_ASSERT_H], | |||
| 46 | gl_NEXT_HEADERS([assert.h])]) | 47 | gl_NEXT_HEADERS([assert.h])]) |
| 47 | 48 | ||
| 48 | dnl The "zz" puts this toward config.h's end, to avoid potential | 49 | dnl The "zz" puts this toward config.h's end, to avoid potential |
| 49 | dnl collisions with other definitions. #undef assert so that | 50 | dnl collisions with other definitions. |
| 50 | dnl programs are not tempted to use it without specifically | 51 | dnl #undef assert so that programs are not tempted to use it without |
| 51 | dnl including assert.h. Break the #undef apart with a comment | 52 | dnl specifically including assert.h. |
| 52 | dnl so that 'configure' does not comment it out. | 53 | dnl #undef __ASSERT_H__ so that on IRIX, when programs later include |
| 54 | dnl <assert.h>, this include actually defines assert. | ||
| 55 | dnl Break the #undef_s apart with a comment so that 'configure' does | ||
| 56 | dnl not comment them out. | ||
| 53 | AH_VERBATIM([zzstatic_assert], | 57 | AH_VERBATIM([zzstatic_assert], |
| 54 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ | 58 | [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ |
| 55 | && (!defined __cplusplus \ | 59 | && (!defined __cplusplus \ |
| @@ -57,6 +61,9 @@ AC_DEFUN([gl_ASSERT_H], | |||
| 57 | && __GNUG__ < 6 && __clang_major__ < 6))) | 61 | && __GNUG__ < 6 && __clang_major__ < 6))) |
| 58 | #include <assert.h> | 62 | #include <assert.h> |
| 59 | #undef/**/assert | 63 | #undef/**/assert |
| 64 | #ifdef __sgi | ||
| 65 | #undef/**/__ASSERT_H__ | ||
| 66 | #endif | ||
| 60 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. | 67 | /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. |
| 61 | We need it also to be invocable with a single argument. */ | 68 | We need it also to be invocable with a single argument. */ |
| 62 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus | 69 | #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus |
