summaryrefslogtreecommitdiff
path: root/lib/verify.h
Commit message (Collapse)AuthorAgeFilesLines
* intprops.h, verify.h: port better to clangPaul Eggert2019-08-251-9/+19
| | | | | | | | | | | | | | | | | | | | | | | Improve code generated by INT_ADD_WRAPV and INT_SUBTRACT_WRAPV with Clang. Problem reported privately by Mattias Engdegård. Also, insulate intprops.h and verify.h better against each other’s definitions of __has_builtin on non-Clang hosts. * lib/intprops.h (__has_builtin): Define a temporary substitute if __has_builtin is not already defined. (_GL_HAS___builtin_add_overflow, _GL_TEMPDEF___has_builtin): New temporary internal macros. (_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW): Now two separate macros, replacing the old _GL_HAS_BUILTIN_OVERFLOW, since we no longer assume that __builtin_mul_overflow is like the rest. All uses changed. (INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, INT_MULTIPLY_WRAPV): Adjust to above changes. (_GL_INT_OP_WRAPV): Remove ‘builtin’ arg, since it’s no longer relevant. All uses changed. * lib/verify.h (__has_builtin): Treat like intprops.h, so that the two .h files do not collide with each other. (_GL_HAS___builtin_unreachable, _GL_HAS___builtin_trap) (_GL_TEMPDEF___has_builtin): New temporary internal macros.
* verify: improve diagnostic quality in recent GCCPaul Eggert2019-08-121-14/+19
| | | | | | | | | | | If ‘verify’ fails in a deeply-nested macro, GCC does not output a useful line number containing the top-level caller of the macro. So, bring back the older way of issuing a diagnostic containing the top-level call’s arg, so that it is easier to diagnose ‘verify’ failures with recent GCC. * lib/verify.h (_GL_VERIFY_TRUE, _GL_VERIFY_TYPE): Bring back DIAGNOSTIC arg. All callers changed. (verify): Just use _GL_VERIFY.
* verify: document ‘assume’ betterPaul Eggert2019-07-021-3/+5
| | | | * lib/verify.h: Reword doc (Bug#36370).
* verify: remove verify_truePaul Eggert2019-05-091-10/+3
| | | | | | * NEWS: Mention this. * lib/verify.h (verify_true): Remove. * tests/test-verify.c (item): Test verify_expr, not verify_true.
* Support C2X and C++17 static_assertPaul Eggert2019-05-091-44/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix _GL_HAVE__STATIC_ASSERT typoPaul Eggert2019-05-091-3/+3
| | | | | * lib/verify.h (_Static_assert): For the FreeBSD workaround, use _GL_HAVE__STATIC_ASSERT, not _GL_HAVE_STATIC_ASSERT.
* verify: Enable _GL_HAVE_STATIC_ASSERT for recent G++ versions.Bruno Haible2019-01-101-4/+2
| | | | | | Reported by Reuben Thomas <rrt@sc3d.org>. * lib/verify.h (_GL_HAVE_STATIC_ASSERT): Define for g++ versions >= 6.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* verify: port 'assume' to traditional toolsPaul Eggert2018-08-111-1/+2
| | | | | * lib/verify.h (assume): Port better to Oracle Studio 12.6 and other tools that use /*NOTREACHED*/ comments.
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* Port to PGI 16.10 x86-64Paul Eggert2017-01-301-1/+6
| | | | | | | | | | | | | | | | | | | | This patch fixes one real bug in gl_anylinked_list2.h, along with some minor glitches that are not bugs. It does not silence PGI’s thousands of bogus warnings when compiling test-intprops.c. Fortunately, the warnings do not cause a failure. * lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N): Rename parameter to avoid PGI warning about ‘#define f(n) 'n'’. My goodness, PGI goes back a long ways - this predates C89! * lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI. For example, ASYNCSAFE (const void *) should expand to ‘const void *volatile’, not to ‘volatile const void *’. * lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined. * lib/verify.h (verify) [!__GNUC__]: Use shorter albeit meaningless string to bypass silly compiler limits. * tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]: * tests/nan.h (NaNf, NaNd, NaNl): Use static functions to avoid misguided compiler diagnostics. Is there some reason we don’t use static functions on all platforms?
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* Use GCC_LINT, not lintPaul Eggert2016-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined. Problem reported by Ken Brown in: http://bugs.gnu.org/23640 * doc/posix-headers/stdnoreturn.texi (stdnoreturn.h): Document problem with lint and _Noreturn. * lib/diffseq.h (IF_LINT, IF_LINT2): * lib/fts.c (sccsid): * lib/getndelim2.c (IF_LINT): * lib/gl_anylinked_list2.h (gl_linked_iterator) (gl_linked_iterator_from_to): * lib/gl_anytree_list2.h (gl_tree_iterator) (gl_tree_iterator_from_to): * lib/gl_anytree_oset.h (gl_tree_iterator): * lib/gl_array_list.c (gl_array_iterator) (gl_array_iterator_from_to): * lib/gl_array_oset.c (gl_array_iterator): * lib/gl_carray_list.c (gl_carray_iterator) (gl_carray_iterator_from_to): * lib/idcache.c: * lib/inet_ntop.c (IF_LINT): * lib/regcomp.c (build_charclass_op, create_tree): * lib/regex_internal.c (re_acquire_state) (re_acquire_state_context): * lib/trigl.c (rcsid): * lib/trim.c (IF_LINT): * lib/vasnprintf.c (IF_LINT): * lib/verify.h (assume): Treat GCC_LINT like lint.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* verify: new macro 'assume'Paul Eggert2013-10-021-0/+24
| | | | | | | This is taken from Emacs, and should be generally useful. * doc/verify.texi (assume): Document it. * lib/verify.h (assume): New macro. (__has_builtin): Expand to 0 if not defined.
* stdalign, verify: port to FreeBSD 9.1, to C11, and to C++11Paul Eggert2013-07-071-52/+60
| | | | | | | | | Problem reported by Ulrich Mueller in <http://bugs.gnu.org/14812>. * lib/stdalign.in.h (_Alignas, _Alignof): Port to FreeBSD 9.1, and to C11 and C++11. (_Alignas): Also support ICC. * lib/verify.h (_Static_assert): Undef if <stddef.h> defines it. * m4/stdalign.m4 (gl_STDALIGN_H): Port to ICC and to C++11.
* c-ctype, regex, verify: port to gcc -std=c90 -pedanticPaul Eggert2013-05-291-1/+3
| | | | | | | | | | | | Avoid constructions that are rejected by gcc -std=c90 -pedantic. This fixes a porting bug I recently reintroduced in regex, and some other instances that I discovered while testing the fix. * lib/c-ctype.h [__STRICT_ANSI__]: Avoid ({ ... }). * lib/regcomp.c (utf8_sb_map) [__STRICT_ANSI__]: Avoid [0 ... N] = E. * lib/regex_internal.h [!_LIBC && GNULIB_LOCK]: Do not use a macro with an empty argument if this is a pedantic pre-C99 GCC. * lib/verify.h: Do not use _Static_assert if this is a pedantic pre-C11 GCC.
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* verify: document conflict with -Wnested-externsEric Blake2012-07-201-1/+5
| | | | | | | | | | | Our implementation of verify() relies on nested extern declarations, so it is incompatible with gcc < 4.6 coupled with -Wnested-externs when used inside a function body. But inside a function body, you can always arrange to use verify_expr() instead, which is warning-free. * lib/verify.h: Give hint about usage when gcc warnings are enabled. Signed-off-by: Eric Blake <eblake@redhat.com>
* doc: C11 and C++11 are now officialPaul Eggert2012-01-061-8/+6
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* verify: new macro verify_expr; verify_true deprecatedPaul Eggert2011-06-151-1/+9
| | | | | | | | * NEWS: Mention this. * doc/verify.texi (Compile-time Assertions): Document this. * lib/verify.h (verify_true): Deprecate. (verify_expr): New macro. * tests/test-verify.c (function): Test verify_expr.
* assert-h: work around 'verify' incompatibilityPaul Eggert2011-05-291-4/+4
| | | | | * lib/verify.h: Use @...@ directives, not ifdef. * modules/assert-h (assert.h): Implement the directives.
* assert-h: Allow multiple gnulib generated replacements to coexist.Bruno Haible2011-05-291-0/+3
| | | | * lib/verify.h (struct _gl_verify_type): Avoid identical redefinition.
* verify: fix bug when gnulib <assert.h> is also includedPaul Eggert2011-05-221-1/+3
| | | | | | | | * lib/verify.h (verify, verify_true): Define if _GL_VERIFY_H is defined, not if _GL_STATIC_ASSERT_H is not defined. Perhaps there's a better way, but this fixes the immediate problem. Problem reported by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00478.html>.
* assert-h: new module, which supports C1X-style static_assertPaul Eggert2011-05-051-51/+79
| | | | | | | | | | | | | | | | | | | | | * lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files. * lib/verify.h: Revamp so that this can be copied into assert.h, while retaining the ability to use it standalone as before. Rename private identifiers so as not to encroach on the standard C namespace, since this is now used by assert.h. (_GL_VERIFY_TYPE): New macro, factoring out differing parts of the old verify_true. (_GL_VERIFY_TRUE): New macro, with much of the contents of the old verify_true. Use _GL_VERIFY_TYPE. (_GL_VERIFY): New macro, with much of the contents of the old verify. (static_assert): New macro, if _GL_STATIC_ASSERT_H is defined and static_assert is not; _GL_STATIC_ASSERT_H is defined when this file is copied into the replacement assert.h. (_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined and _Static_assert is not built in. (verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not defined, and use the new macros mentioned above. * doc/posix-headers/assert.texi: Document this.
* verify: Fix syntax error with GCC 4.6 in C++ mode.Bruno Haible2011-04-091-4/+22
| | | | | | | * lib/verify.h (HAVE__STATIC_ASSERT): Don't define in C++ mode. (HAVE_STATIC_ASSERT): New macro. (verify_true, verify): Use 'static_assert' if it is supported and '_Static_assert' is not supported.
* verify: use _Static_assert if availablePaul Eggert2011-04-051-11/+32
| | | | | | * lib/verify.h (HAVE__STATIC_ASSERT): New macro. (verify_true, verify): Use it if available. This generates better diagnostics with GCC 4.6.0 and later.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* verify: adjust formatting to be more consistentJim Meyering2010-05-091-3/+3
| | | | | * lib/verify.h (_GL_GENSYM): Add a space before each of a few argument-list '('s, and after one comma.
* Further improvements to verify.h, suggested by Eric Blake.Paul Eggert2010-05-051-13/+16
| | | | | | | | * lib/verify.h (_GL_CONCAT, _GL_CONCAT0, _GL_GENSYM): Renamed from the GL_* versions, to avoid collision with OpenGL. (_GL_COUNTER): New macro, so that we can fall back on __LINE__ if __COUNTER__ doesn't work. Test that __COUNTER__ increments rather than testing merely whether it's defined.
* Modify verify.h to pacify gcc -Wredundant_decls.Paul Eggert2010-05-051-6/+26
| | | | | | | | | * lib/verify.h (GL_CONCAT, GL_CONCAT0, GL_GENSYM): New macros. These use the prefix "GL_" since they're likely to be useful elsewhere. We may need to break them out into a different .h file. (__COUNTER__): Define to 0 if the compiler doesn't support it. (verify) [!defined __cplusplus]: Use them to avoid duplicate decls of verify_function__.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-1/+1
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-2/+2
|
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* * doc/verify.texi: New file.Paul Eggert2006-05-021-10/+96
| | | | * lib/verify.h: Document the internals better.
* * verify.h (verify_true): Provide alternative definition for C++.Paul Eggert2005-10-051-3/+10
|
* (verify_expr): Remove, replacing with:Paul Eggert2005-09-271-13/+15
| | | | | | (verify_true): New macro that returns true instead of void. (verify_type__): Remove. (verify): Use verify_true rather than verify_type__.
* (verify_type__): Use `unsigned int' as the bitfield typeJim Meyering2005-09-231-1/+1
| | | | | so we can once again use a positive bitfield width of 1 -- now we don't have to explain why we were using a bitfield width of 2.
* (verify_type__): Use 2, not 1, for bitfield size, to avoidPaul Eggert2005-09-231-1/+1
| | | | a warning with Irix 6.5 cc. Problem reported by Bruno Haible.
* Fix typo in comment.Paul Eggert2005-09-231-4/+3
|
* (GL_CONCAT0, GL_CONCAT): Remove.Paul Eggert2005-09-231-19/+9
| | | | | | | (verify): Don't use the __LINE__ trick, as it doesn't work in general. Instead, declare a function that returns a pointer to an array, and use verify_type__ to declare the size of the array. Problem and germ of a solution reported by Bruno Haible.
* * modules/verify: New file.Paul Eggert2005-09-221-0/+57
* lib/verify.h: New file. * MODULES.html.sh (Diagnostics <assert.h>): New section, with "verify" module.