From: Eric Blake Date: Fri, 20 Jul 2012 22:48:46 +0000 (-0600) Subject: verify: document conflict with -Wnested-externs X-Git-Tag: v0.1~526 X-Git-Url: http://erislabs.net/gitweb/?p=gnulib.git;a=commitdiff_plain;h=6c37e0a73c7c1b6fe6eac4d794e2e65791a2700d verify: document conflict with -Wnested-externs 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 --- diff --git a/ChangeLog b/ChangeLog index 2fa6fd5e2..69437c98a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-07-20 Eric Blake + verify: document conflict with -Wnested-externs + * lib/verify.h: Give hint about usage when gcc warnings are enabled. + maint.mk: forbid exit(-1) * top/maint.mk (sc_prohibit_magic_number_exit): Detect negatives. diff --git a/lib/verify.h b/lib/verify.h index cef14ad15..0c320b19a 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -125,7 +125,7 @@ extern int (*dummy (void)) [sizeof (struct {...})]; * GCC warns about duplicate declarations of the dummy function if - -Wredundant_decls is used. GCC 4.3 and later have a builtin + -Wredundant-decls is used. GCC 4.3 and later have a builtin __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. @@ -133,6 +133,10 @@ which do not support _Static_assert, also do not warn about the last declaration mentioned above. + * GCC warns if -Wnested-externs is enabled and verify() is used + within a function body; but inside a function, you can always + arrange to use verify_expr() instead. + * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */