[libvirt] [PATCH] build: simplify use of verify

Back in 2008 when this line of util.h was written, gnulib's verify module didn't allow the use of multiple verify() in one file in combination with our choice of gcc -W options. But that has since been fixed in gnulib, and newer gnulib even maps verify() to the C1x feature of _Static_assert, which gives even nicer diagnostics with a new enough compiler, so we might as well go with the simpler verify(). * src/util/util.h (VIR_ENUM_IMPL): Use simpler verify, now that gnulib module is smarter. --- As pointed out here: https://www.redhat.com/archives/libvir-list/2011-August/msg01348.html src/util/util.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/util/util.h b/src/util/util.h index 6e6265f..908ba7b 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -202,7 +202,7 @@ const char *virEnumToString(const char *const*types, # define VIR_ENUM_IMPL(name, lastVal, ...) \ static const char *const name ## TypeList[] = { __VA_ARGS__ }; \ - extern int (* name ## Verify (void)) [verify_true (ARRAY_CARDINALITY(name ## TypeList) == lastVal)]; \ + verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \ const char *name ## TypeToString(int type) { \ return virEnumToString(name ## TypeList, \ ARRAY_CARDINALITY(name ## TypeList), \ -- 1.7.4.4

On Fri, Aug 26, 2011 at 10:20:32AM -0600, Eric Blake wrote:
Back in 2008 when this line of util.h was written, gnulib's verify module didn't allow the use of multiple verify() in one file in combination with our choice of gcc -W options. But that has since been fixed in gnulib, and newer gnulib even maps verify() to the C1x feature of _Static_assert, which gives even nicer diagnostics with a new enough compiler, so we might as well go with the simpler verify().
* src/util/util.h (VIR_ENUM_IMPL): Use simpler verify, now that gnulib module is smarter. ---
As pointed out here: https://www.redhat.com/archives/libvir-list/2011-August/msg01348.html
src/util/util.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/util.h b/src/util/util.h index 6e6265f..908ba7b 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -202,7 +202,7 @@ const char *virEnumToString(const char *const*types,
# define VIR_ENUM_IMPL(name, lastVal, ...) \ static const char *const name ## TypeList[] = { __VA_ARGS__ }; \ - extern int (* name ## Verify (void)) [verify_true (ARRAY_CARDINALITY(name ## TypeList) == lastVal)]; \ + verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \ const char *name ## TypeToString(int type) { \ return virEnumToString(name ## TypeList, \ ARRAY_CARDINALITY(name ## TypeList), \ --
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 08/30/2011 04:45 AM, Daniel P. Berrange wrote:
On Fri, Aug 26, 2011 at 10:20:32AM -0600, Eric Blake wrote:
Back in 2008 when this line of util.h was written, gnulib's verify module didn't allow the use of multiple verify() in one file in combination with our choice of gcc -W options. But that has since been fixed in gnulib, and newer gnulib even maps verify() to the C1x feature of _Static_assert, which gives even nicer diagnostics with a new enough compiler, so we might as well go with the simpler verify().
ACK
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake