]> Savannah Git Hosting - gnulib.git/commit
Support C2X and C++17 static_assert
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 9 May 2019 15:57:56 +0000 (08:57 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 9 May 2019 16:09:34 +0000 (09:09 -0700)
commit89a5b4b828b962361be83904b5914ec4bb3408ec
tree304f84c52ca8a1e948532e0f3377e08e235d8431
parentb8068cf09b6c78e35cef072efc7613049c11a632
Support C2X and C++17 static_assert

C2X and C++17 finally added support for a simple, single-argument
‘static_assert’ that implements what the Gnulib ‘verify’ macro was
doing back in 2005.  Implement static_assert on older platforms.
The only remaining advantage of ‘verify’ is a shorter name.
* doc/posix-headers/assert.texi (assert.h):
* doc/verify.texi (Compile-time Assertions):
Modernize for C2X and C++17.
* lib/verify.h (_GL_HAVE__STATIC_ASSERT1, _GL_HAVE_STATIC_ASSERT1):
New macros.
(_GL_HAVE__STATIC_ASSERT): Remove.
(_GL_HAVE__STATIC_ASSERT): Rely more heavily on __STDC_VERSION__.
(_GL_VERIFY_TRUE, _GL_VERIFY_TYPE): Remove 2nd arg, the diagnostic
string.  All callers changed.
(_GL_VERIFY): Require 3 or more args, of which only the first 2
are used.  All callers changed.
(_Static_assert): Allow either 1 or 2 args, and define if
!_GL_HAVE__STATIC_ASSERT1 instead of defining if
!_GL_HAVE__STATIC_ASSERT.
(static_assert): Define if !_GL_HAVE_STATIC_ASSERT1 instead
of defining if !_GL_HAVE_STATIC_ASSERT.
(verify_expr, verify): Don’t bother trying to copy the expression
into the diagnostic, since 1-argument static_assert doesn’t.
(verify): Prefer 1-argument _Static_assert if it works.
* m4/assert_h.m4 (gl_ASSERT_H): Check for 1-argument static_assert.
ChangeLog
doc/posix-headers/assert.texi
doc/verify.texi
lib/verify.h
m4/assert_h.m4