diff options
Diffstat (limited to 'gl/verify.h')
-rw-r--r-- | gl/verify.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gl/verify.h b/gl/verify.h index a8ca59b..47b6ee6 100644 --- a/gl/verify.h +++ b/gl/verify.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Compile-time assert-like macros. | 1 | /* Compile-time assert-like macros. |
2 | 2 | ||
3 | Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2009-2022 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -34,7 +34,7 @@ | |||
34 | #ifndef __cplusplus | 34 | #ifndef __cplusplus |
35 | # if (201112L <= __STDC_VERSION__ \ | 35 | # if (201112L <= __STDC_VERSION__ \ |
36 | || (!defined __STRICT_ANSI__ \ | 36 | || (!defined __STRICT_ANSI__ \ |
37 | && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__))) | 37 | && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) |
38 | # define _GL_HAVE__STATIC_ASSERT 1 | 38 | # define _GL_HAVE__STATIC_ASSERT 1 |
39 | # endif | 39 | # endif |
40 | # if (202000L <= __STDC_VERSION__ \ | 40 | # if (202000L <= __STDC_VERSION__ \ |
@@ -215,6 +215,9 @@ template <int w> | |||
215 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ | 215 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ |
216 | extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ | 216 | extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ |
217 | [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] | 217 | [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] |
218 | # if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | ||
219 | # pragma GCC diagnostic ignored "-Wnested-externs" | ||
220 | # endif | ||
218 | #endif | 221 | #endif |
219 | 222 | ||
220 | /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ | 223 | /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ |
@@ -300,13 +303,16 @@ template <int w> | |||
300 | # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) | 303 | # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) |
301 | #elif 1200 <= _MSC_VER | 304 | #elif 1200 <= _MSC_VER |
302 | # define assume(R) __assume (R) | 305 | # define assume(R) __assume (R) |
306 | #elif 202311L <= __STDC_VERSION__ | ||
307 | # include <stddef.h> | ||
308 | # define assume(R) ((R) ? (void) 0 : unreachable ()) | ||
303 | #elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP | 309 | #elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP |
304 | /* Doing it this way helps various packages when configured with | 310 | /* Doing it this way helps various packages when configured with |
305 | --enable-gcc-warnings, which compiles with -Dlint. It's nicer | 311 | --enable-gcc-warnings, which compiles with -Dlint. It's nicer |
306 | when 'assume' silences warnings even with older GCCs. */ | 312 | if 'assume' silences warnings with GCC 3.4 through GCC 4.4.7 (2012). */ |
307 | # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) | 313 | # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) |
308 | #else | 314 | #else |
309 | /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ | 315 | /* Some older tools grok NOTREACHED, e.g., Oracle Studio 12.6 (2017). */ |
310 | # define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) | 316 | # define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) |
311 | #endif | 317 | #endif |
312 | 318 | ||