src: replace verify(expr) with G_STATIC_ASSERT(expr)

G_STATIC_ASSERT() is a drop-in functional equivalent of
the GNULIB verify() macro.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2020-01-09 10:39:55 +00:00
parent 7b9645a7d1
commit fa434739a0
36 changed files with 69 additions and 80 deletions

View File

@@ -16,9 +16,9 @@
#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
&& (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \
&& !defined __cplusplus)
# define verify(cond) _Static_assert(cond, "verify (" #cond ")")
# define G_STATIC_ASSERT(cond) _Static_assert(cond, "verify (" #cond ")")
#else
# define verify(cond)
# define G_STATIC_ASSERT(cond)
#endif
#ifndef G_GNUC_UNUSED
@@ -1138,10 +1138,10 @@ struct secretEventData secretEvents[] = {
};
/* make sure that the events are kept in sync */
verify(G_N_ELEMENTS(domainEvents) == VIR_DOMAIN_EVENT_ID_LAST);
verify(G_N_ELEMENTS(storagePoolEvents) == VIR_STORAGE_POOL_EVENT_ID_LAST);
verify(G_N_ELEMENTS(nodeDeviceEvents) == VIR_NODE_DEVICE_EVENT_ID_LAST);
verify(G_N_ELEMENTS(secretEvents) == VIR_SECRET_EVENT_ID_LAST);
G_STATIC_ASSERT(G_N_ELEMENTS(domainEvents) == VIR_DOMAIN_EVENT_ID_LAST);
G_STATIC_ASSERT(G_N_ELEMENTS(storagePoolEvents) == VIR_STORAGE_POOL_EVENT_ID_LAST);
G_STATIC_ASSERT(G_N_ELEMENTS(nodeDeviceEvents) == VIR_NODE_DEVICE_EVENT_ID_LAST);
G_STATIC_ASSERT(G_N_ELEMENTS(secretEvents) == VIR_SECRET_EVENT_ID_LAST);
int
main(int argc, char **argv)