# HG changeset patch # User Eric Blake # Date 1342824526 21600 # Node ID 0103491fe167b25ce3d67d5894f3ec633ec3e2e4 # Parent 47d115143a815cd2c95640bd49cc810154d3d6fb 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 --- 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 --- 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. */