Use verify to force adding new events by means of static assertions. --- examples/object-events/event-test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c index 7ec85a2..265e24a 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -6,6 +6,8 @@ #include <signal.h> #include <inttypes.h> +#include <verify.h> + #define VIR_ENUM_SENTINELS #include <libvirt/libvirt.h> @@ -888,6 +890,9 @@ struct domainEventData domainEvents[] = { DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback), }; +/* make sure that the events are kept in sync */ +verify(ARRAY_CARDINALITY(domainEvents) == VIR_DOMAIN_EVENT_ID_LAST); + int main(int argc, char **argv) { -- 2.8.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list