"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "support/verify.h" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

verify.h  (gawk-5.0.1.tar.xz):verify.h  (gawk-5.1.0.tar.xz)
skipping to change at line 177 skipping to change at line 177
# define _GL_COUNTER __COUNTER__ # define _GL_COUNTER __COUNTER__
#else #else
# define _GL_COUNTER __LINE__ # define _GL_COUNTER __LINE__
#endif #endif
/* Generate a symbol with the given prefix, making it unique if /* Generate a symbol with the given prefix, making it unique if
possible. */ possible. */
#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) #define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression /* Verify requirement R at compile-time, as an integer constant expression
that returns 1. If R is false, fail at compile-time. */ that returns 1. If R is false, fail at compile-time, preferably
with a diagnostic that includes the string-literal DIAGNOSTIC. */
#define _GL_VERIFY_TRUE(R) (!!sizeof (_GL_VERIFY_TYPE (R))) #define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
(!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
#ifdef __cplusplus #ifdef __cplusplus
# if !GNULIB_defined_struct__gl_verify_type # if !GNULIB_defined_struct__gl_verify_type
template <int w> template <int w>
struct _gl_verify_type { struct _gl_verify_type {
unsigned int _gl_verify_error_if_negative: w; unsigned int _gl_verify_error_if_negative: w;
}; };
# define GNULIB_defined_struct__gl_verify_type 1 # define GNULIB_defined_struct__gl_verify_type 1
# endif # endif
# define _GL_VERIFY_TYPE(R) _gl_verify_type<(R) ? 1 : -1> # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
#elif defined _GL_HAVE__STATIC_ASSERT1 _gl_verify_type<(R) ? 1 : -1>
# define _GL_VERIFY_TYPE(R) \ #elif defined _GL_HAVE__STATIC_ASSERT
# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
struct { \ struct { \
_Static_assert (R); \ _Static_assert (R, DIAGNOSTIC); \
int _gl_dummy; \ int _gl_dummy; \
} }
#else #else
# define _GL_VERIFY_TYPE(R) \ # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
#endif #endif
/* Verify requirement R at compile-time, as a declaration without a /* Verify requirement R at compile-time, as a declaration without a
trailing ';'. If R is false, fail at compile-time. trailing ';'. If R is false, fail at compile-time.
This macro requires three or more arguments but uses at most the first This macro requires three or more arguments but uses at most the first
two, so that the _Static_assert macro optionally defined below supports two, so that the _Static_assert macro optionally defined below supports
both the C11 two-argument syntax and the C2X one-argument syntax. both the C11 two-argument syntax and the C2X one-argument syntax.
Unfortunately, unlike C11, this implementation must appear as an Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */ ordinary declaration, and cannot appear inside struct { ... }. */
#if defined _GL_HAVE__STATIC_ASSERT #if defined _GL_HAVE__STATIC_ASSERT
# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
#else #else
# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ # define _GL_VERIFY(R, DIAGNOSTIC, ...) \
extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
[_GL_VERIFY_TRUE (R)] [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
#endif #endif
/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
#ifdef _GL_STATIC_ASSERT_H #ifdef _GL_STATIC_ASSERT_H
# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert # if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert
# define _Static_assert(...) \ # define _Static_assert(...) \
_GL_VERIFY (__VA_ARGS__, "static assertion failed", -) _GL_VERIFY (__VA_ARGS__, "static assertion failed", -)
# endif # endif
# if !defined _GL_HAVE_STATIC_ASSERT1 && !defined static_assert # if !defined _GL_HAVE_STATIC_ASSERT1 && !defined static_assert
# define static_assert _Static_assert /* C11 requires this #define. */ # define static_assert _Static_assert /* C11 requires this #define. */
skipping to change at line 244 skipping to change at line 247
assert (R), there is no run-time overhead. assert (R), there is no run-time overhead.
There are two macros, since no single macro can be used in all There are two macros, since no single macro can be used in all
contexts in C. verify_expr (R, E) is for scalar contexts, including contexts in C. verify_expr (R, E) is for scalar contexts, including
integer constant expression contexts. verify (R) is for declaration integer constant expression contexts. verify (R) is for declaration
contexts, e.g., the top level. */ contexts, e.g., the top level. */
/* Verify requirement R at compile-time. Return the value of the /* Verify requirement R at compile-time. Return the value of the
expression E. */ expression E. */
#define verify_expr(R, E) (_GL_VERIFY_TRUE (R) ? (E) : (E)) #define verify_expr(R, E) \
(_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a /* Verify requirement R at compile-time, as a declaration without a
trailing ';'. verify (R) acts like static_assert (R) except that trailing ';'. verify (R) acts like static_assert (R) except that
it is portable to C11/C++14 and earlier, and its name is shorter it is portable to C11/C++14 and earlier, it can issue better
and may be more convenient. */ diagnostics, and its name is shorter and may be more convenient. */
#ifdef _GL_HAVE__STATIC_ASSERT1 #ifdef __PGI
# define verify(R) _Static_assert (R) /* PGI barfs if R is long. */
#else
# define verify(R) _GL_VERIFY (R, "verify (...)", -) # define verify(R) _GL_VERIFY (R, "verify (...)", -)
#else
# define verify(R) _GL_VERIFY (R, "verify (" #R ")", -)
#endif #endif
#ifndef __has_builtin #ifndef __has_builtin
# define __has_builtin(x) 0 # define __has_builtin(x) 0
#endif #endif
/* Assume that R always holds. This lets the compiler optimize /* Assume that R always holds. Behavior is undefined if R is false,
accordingly. R should not have side-effects; it may or may not be fails to evaluate, or has side effects. Although assuming R can
evaluated. Behavior is undefined if R is false. */ help a compiler generate better code or diagnostics, performance
can suffer if R uses hard-to-optimize features such as function
calls not inlined by the compiler. */
#if (__has_builtin (__builtin_unreachable) \ #if (__has_builtin (__builtin_unreachable) \
|| 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER #elif 1200 <= _MSC_VER
# define assume(R) __assume (R) # define assume(R) __assume (R)
#elif ((defined GCC_LINT || defined lint) \ #elif ((defined GCC_LINT || defined lint) \
&& (__has_builtin (__builtin_trap) \ && (__has_builtin (__builtin_trap) \
|| 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
/* Doing it this way helps various packages when configured with /* Doing it this way helps various packages when configured with
 End of changes. 11 change blocks. 
17 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)