diff options
Diffstat (limited to 'glib/gnulib/verify.h')
-rw-r--r-- | glib/gnulib/verify.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/glib/gnulib/verify.h b/glib/gnulib/verify.h index f5933b859..8e1486095 100644 --- a/glib/gnulib/verify.h +++ b/glib/gnulib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -13,7 +13,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ @@ -248,25 +248,28 @@ template <int w> /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -#define verify(R) _GL_VERIFY (R, "verify (" #R ")") - -#ifdef __has_builtin -# define _GL_MACRO__has_builtin __has_builtin +#ifdef __GNUC__ +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") #else -# define _GL_MACRO__has_builtin(x) 0 +/* PGI barfs if R is long. Play it safe. */ +# define verify(R) _GL_VERIFY (R, "verify (...)") +#endif + +#ifndef __has_builtin +# define __has_builtin(x) 0 #endif /* Assume that R always holds. This lets the compiler optimize accordingly. R should not have side-effects; it may or may not be evaluated. Behavior is undefined if R is false. */ -#if (_GL_MACRO__has_builtin (__builtin_unreachable) \ +#if (__has_builtin (__builtin_unreachable) \ || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) -#elif (defined lint \ - && (_GL_MACRO__has_builtin (__builtin_trap) \ +#elif ((defined GCC_LINT || defined lint) \ + && (__has_builtin (__builtin_trap) \ || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) /* Doing it this way helps various packages when configured with --enable-gcc-warnings, which compiles with -Dlint. It's nicer |