提交 16dfe015 编写于 作者: P Peter Krempa

event-test: warn on unhandled enum values

Avoid forgetting to add the correct fields to the switches in
event-test.
上级 ab48005f
......@@ -48,7 +48,12 @@ dommigrate_dommigrate_SOURCES = dommigrate/dommigrate.c
domsuspend_suspend_SOURCES = domsuspend/suspend.c
domtop_domtop_SOURCES = domtop/domtop.c
hellolibvirt_hellolibvirt_SOURCES = hellolibvirt/hellolibvirt.c
object_events_event_test_CFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
object_events_event_test_SOURCES = object-events/event-test.c
openauth_openauth_SOURCES = openauth/openauth.c
rename_rename_SOURCES = rename/rename.c
......
......@@ -6,6 +6,8 @@
#include <signal.h>
#include <inttypes.h>
#define VIR_ENUM_SENTINELS
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
......@@ -41,6 +43,9 @@ connectClose(virConnectPtr conn ATTRIBUTE_UNUSED,
case VIR_CONNECT_CLOSE_REASON_CLIENT:
fprintf(stderr, "Connection closed due to client request\n");
return;
case VIR_CONNECT_CLOSE_REASON_LAST:
break;
};
fprintf(stderr, "Connection closed due to unknown reason\n");
......@@ -77,6 +82,9 @@ eventToString(int event)
case VIR_DOMAIN_EVENT_CRASHED:
return "Crashed";
case VIR_DOMAIN_EVENT_LAST:
break;
}
return "unknown";
......@@ -101,6 +109,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT:
return "Snapshot";
case VIR_DOMAIN_EVENT_DEFINED_LAST:
break;
}
break;
......@@ -111,6 +122,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_UNDEFINED_RENAMED:
return "Renamed";
case VIR_DOMAIN_EVENT_UNDEFINED_LAST:
break;
}
break;
......@@ -130,6 +144,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_STARTED_WAKEUP:
return "Event wakeup";
case VIR_DOMAIN_EVENT_STARTED_LAST:
break;
}
break;
......@@ -161,6 +178,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED:
return "Post-copy Error";
case VIR_DOMAIN_EVENT_SUSPENDED_LAST:
break;
}
break;
......@@ -177,6 +197,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_RESUMED_POSTCOPY:
return "Post-copy";
case VIR_DOMAIN_EVENT_RESUMED_LAST:
break;
}
break;
......@@ -202,6 +225,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT:
return "Snapshot";
case VIR_DOMAIN_EVENT_STOPPED_LAST:
break;
}
break;
......@@ -210,6 +236,8 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED:
return "Finished";
case VIR_DOMAIN_EVENT_SHUTDOWN_LAST:
break;
}
break;
......@@ -220,6 +248,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_PMSUSPENDED_DISK:
return "Disk";
case VIR_DOMAIN_EVENT_PMSUSPENDED_LAST:
break;
}
break;
......@@ -227,8 +258,14 @@ eventDetailToString(int event,
switch ((virDomainEventCrashedDetailType) detail) {
case VIR_DOMAIN_EVENT_CRASHED_PANICKED:
return "Panicked";
case VIR_DOMAIN_EVENT_CRASHED_LAST:
break;
}
break;
case VIR_DOMAIN_EVENT_LAST:
break;
}
return "unknown";
......@@ -251,6 +288,8 @@ networkEventToString(int event)
case VIR_NETWORK_EVENT_STOPPED:
return "Stopped";
case VIR_NETWORK_EVENT_LAST:
break;
}
return "unknown";
......@@ -266,6 +305,9 @@ guestAgentLifecycleEventStateToString(int event)
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED:
return "Connected";
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_LAST:
break;
}
return "unknown";
......@@ -284,6 +326,9 @@ guestAgentLifecycleEventReasonToString(int event)
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL:
return "Channel event";
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_LAST:
break;
}
return "unknown";
......@@ -398,6 +443,9 @@ graphicsPhaseToStr(int phase)
case VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT:
return "disconnected";
case VIR_DOMAIN_EVENT_GRAPHICS_LAST:
break;
}
return "unknown";
......@@ -457,6 +505,9 @@ diskChangeReasonToStr(int reason)
case VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START:
return "disk dropped due to startupPolicy";
case VIR_DOMAIN_EVENT_DISK_CHANGE_LAST:
break;
}
return "unknown";
......@@ -488,6 +539,9 @@ trayChangeReasonToStr(int reason)
case VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE:
return "close";
case VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST:
break;
}
return "unknown";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册