mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
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.
This commit is contained in:
parent
e6b8bc812a
commit
71a0beaf3a
@ -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), \
|
||||
|
Loading…
Reference in New Issue
Block a user