[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
verify usage [was: [libvirt] [PATCH 03/13] Rewrite virAtomic APIs using
From: |
Eric Blake |
Subject: |
verify usage [was: [libvirt] [PATCH 03/13] Rewrite virAtomic APIs using GLib's atomic ops code] |
Date: |
Fri, 20 Jul 2012 16:52:10 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 07/19/2012 08:15 AM, Eric Blake wrote:
>
> I'll have to see if I can come up with a solution in upstream gnulib
> that expands verify() in such a way that works with -Wnested-externs.
>
I'm pushing this documentation aid, so that the next time this question
comes up, we have something to point to.
From 6c37e0a73c7c1b6fe6eac4d794e2e65791a2700d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 20 Jul 2012 16:48:46 -0600
Subject: [PATCH] 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 <address@hidden>
---
ChangeLog | 3 +++
lib/verify.h | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 2fa6fd5..69437c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-07-20 Eric Blake <address@hidden>
+ 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 cef14ad..0c320b1 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. */
--
1.7.10.4
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature