changeset 17002:0103491fe167

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 <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Fri, 20 Jul 2012 16:48:46 -0600
parents 47d115143a81
children 13795cd8c0ba
files ChangeLog lib/verify.h
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-07-20  Eric Blake  <eblake@redhat.com>
 
+	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.
 
--- 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.  */