Require a semicolon for VIR_ONCE_GLOBAL_INIT calls

Missing semicolon at the end of macros can confuse some analyzers
(like cppcheck <filename>). VIR_ONCE_GLOBAL_INIT is almost
exclusively called without an ending semicolon, but let's
standardize on using one like the other macros.

Add a dummy struct definition at the end of the macro, so
the compiler will require callers to add a semicolon.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-01-20 12:23:29 -05:00
parent 8bec5488a6
commit af36f8a641
68 changed files with 77 additions and 76 deletions

View File

@ -43,7 +43,7 @@ static int virBhyveConfigOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virBhyveConfig)
VIR_ONCE_GLOBAL_INIT(virBhyveConfig);
virBhyveDriverConfigPtr
virBhyveDriverConfigNew(void)

View File

@ -63,7 +63,7 @@ static int virCapabilitiesOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virCapabilities)
VIR_ONCE_GLOBAL_INIT(virCapabilities);
/**
* virCapabilitiesNew:

View File

@ -49,7 +49,7 @@ static int virDomainCapsOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virDomainCaps)
VIR_ONCE_GLOBAL_INIT(virDomainCaps);
static void

View File

@ -1067,7 +1067,7 @@ static int virDomainObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virDomainObj)
VIR_ONCE_GLOBAL_INIT(virDomainObj);
static void

View File

@ -338,7 +338,7 @@ virDomainEventsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virDomainEvents)
VIR_ONCE_GLOBAL_INIT(virDomainEvents);
static void

View File

@ -64,7 +64,7 @@ virNetworkEventsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetworkEvents)
VIR_ONCE_GLOBAL_INIT(virNetworkEvents);
static void
virNetworkEventDispose(void *obj)

View File

@ -78,7 +78,7 @@ virNodeDeviceEventsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNodeDeviceEvents)
VIR_ONCE_GLOBAL_INIT(virNodeDeviceEvents);
static void
virNodeDeviceEventDispose(void *obj)

View File

@ -99,7 +99,7 @@ virObjectEventOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virObjectEvent)
VIR_ONCE_GLOBAL_INIT(virObjectEvent);
/**
* virClassForObjectEvent:

View File

@ -77,7 +77,7 @@ virSecretEventsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virSecretEvents)
VIR_ONCE_GLOBAL_INIT(virSecretEvents);
static void
virSecretEventDispose(void *obj)

View File

@ -78,7 +78,7 @@ virStoragePoolEventsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virStoragePoolEvents)
VIR_ONCE_GLOBAL_INIT(virStoragePoolEvents);
static void
virStoragePoolEventDispose(void *obj)

View File

@ -60,7 +60,7 @@ static int virDomainObjListOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virDomainObjList)
VIR_ONCE_GLOBAL_INIT(virDomainObjList);
virDomainObjListPtr virDomainObjListNew(void)
{

View File

@ -67,7 +67,7 @@ virInterfaceObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virInterfaceObj)
VIR_ONCE_GLOBAL_INIT(virInterfaceObj);
static void

View File

@ -84,7 +84,7 @@ virNetworkObjOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virNetworkObj)
VIR_ONCE_GLOBAL_INIT(virNetworkObj);
virNetworkObjPtr
virNetworkObjNew(void)

View File

@ -69,7 +69,7 @@ virNodeDeviceObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNodeDeviceObj)
VIR_ONCE_GLOBAL_INIT(virNodeDeviceObj);
static void

View File

@ -51,7 +51,7 @@ virNWFilterBindingObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNWFilterBindingObj)
VIR_ONCE_GLOBAL_INIT(virNWFilterBindingObj);
virNWFilterBindingObjPtr
virNWFilterBindingObjNew(void)

View File

@ -52,7 +52,7 @@ static int virNWFilterBindingObjListOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNWFilterBindingObjList)
VIR_ONCE_GLOBAL_INIT(virNWFilterBindingObjList);
virNWFilterBindingObjListPtr

View File

@ -78,7 +78,7 @@ virSecretObjOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virSecretObj)
VIR_ONCE_GLOBAL_INIT(virSecretObj);
static virSecretObjPtr
virSecretObjNew(void)

View File

@ -120,7 +120,7 @@ virStorageVolObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virStorageVolObj)
VIR_ONCE_GLOBAL_INIT(virStorageVolObj);
static virStorageVolObjPtr
@ -211,7 +211,7 @@ virStoragePoolObjOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virStoragePoolObj)
VIR_ONCE_GLOBAL_INIT(virStoragePoolObj);
virStoragePoolObjPtr

View File

@ -109,7 +109,7 @@ virDataTypesOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virDataTypes)
VIR_ONCE_GLOBAL_INIT(virDataTypes);
/**
* virGetConnect:

View File

@ -59,7 +59,7 @@ virNetcfDriverStateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetcfDriverState)
VIR_ONCE_GLOBAL_INIT(virNetcfDriverState);
static virNetcfDriverStatePtr driver;

View File

@ -66,7 +66,7 @@ static int libxlConfigOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(libxlConfig)
VIR_ONCE_GLOBAL_INIT(libxlConfig);
static void
libxlDriverConfigDispose(void *obj)

View File

@ -61,7 +61,7 @@ libxlDomainObjPrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(libxlDomainObjPrivate)
VIR_ONCE_GLOBAL_INIT(libxlDomainObjPrivate);
static int
libxlDomainObjInitJob(libxlDomainObjPrivatePtr priv)

View File

@ -248,7 +248,7 @@ libxlMigrationDstArgsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(libxlMigrationDstArgs)
VIR_ONCE_GLOBAL_INIT(libxlMigrationDstArgs);
static void
libxlDoMigrateDstReceive(void *opaque)

View File

@ -82,7 +82,7 @@ virLogHandlerOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virLogHandler)
VIR_ONCE_GLOBAL_INIT(virLogHandler);
static void

View File

@ -51,7 +51,7 @@ static int virLXCConfigOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virLXCConfig)
VIR_ONCE_GLOBAL_INIT(virLXCConfig);
/* Functions */

View File

@ -57,7 +57,7 @@ static int virLXCMonitorOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virLXCMonitor)
VIR_ONCE_GLOBAL_INIT(virLXCMonitor);
static void
virLXCMonitorHandleEventExit(virNetClientProgramPtr prog,

View File

@ -97,7 +97,7 @@ udevEventDataOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(udevEventData)
VIR_ONCE_GLOBAL_INIT(udevEventData);
static udevEventDataPtr
udevEventDataNew(void)

View File

@ -140,7 +140,7 @@ static int qemuAgentOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuAgent)
VIR_ONCE_GLOBAL_INIT(qemuAgent);
#if DEBUG_RAW_IO

View File

@ -66,7 +66,7 @@ qemuBlockJobDataOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(qemuBlockJobData)
VIR_ONCE_GLOBAL_INIT(qemuBlockJobData);
static qemuBlockJobDataPtr
qemuBlockJobDataNew(qemuBlockJobType type,

View File

@ -615,7 +615,7 @@ static int virQEMUCapsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virQEMUCaps)
VIR_ONCE_GLOBAL_INIT(virQEMUCaps);
static virArch virQEMUCapsArchFromString(const char *arch)
{

View File

@ -80,7 +80,7 @@ static int virQEMUConfigOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virQEMUConfig)
VIR_ONCE_GLOBAL_INIT(virQEMUConfig);
static void

View File

@ -156,7 +156,7 @@ qemuDomainOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomain)
VIR_ONCE_GLOBAL_INIT(qemuDomain);
static void
qemuDomainLogContextDispose(void *obj)
@ -1051,7 +1051,7 @@ qemuDomainDiskPrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainDiskPrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainDiskPrivate);
static virObjectPtr
qemuDomainDiskPrivateNew(void)
@ -1090,7 +1090,7 @@ qemuDomainStorageSourcePrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainStorageSourcePrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainStorageSourcePrivate);
virObjectPtr
qemuDomainStorageSourcePrivateNew(void)
@ -1129,7 +1129,7 @@ qemuDomainVcpuPrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainVcpuPrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainVcpuPrivate);
static virObjectPtr
qemuDomainVcpuPrivateNew(void)
@ -1169,7 +1169,7 @@ qemuDomainChrSourcePrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainChrSourcePrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainChrSourcePrivate);
static virObjectPtr
qemuDomainChrSourcePrivateNew(void)
@ -1207,7 +1207,7 @@ qemuDomainVsockPrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainVsockPrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainVsockPrivate);
static virObjectPtr
qemuDomainVsockPrivateNew(void)
@ -1247,7 +1247,7 @@ qemuDomainGraphicsPrivateOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuDomainGraphicsPrivate)
VIR_ONCE_GLOBAL_INIT(qemuDomainGraphicsPrivate);
static virObjectPtr
qemuDomainGraphicsPrivateNew(void)

View File

@ -165,7 +165,7 @@ static int qemuMonitorOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(qemuMonitor)
VIR_ONCE_GLOBAL_INIT(qemuMonitor);
VIR_ENUM_IMPL(qemuMonitorMigrationStatus,

View File

@ -62,7 +62,7 @@ static int virKeepAliveOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virKeepAlive)
VIR_ONCE_GLOBAL_INIT(virKeepAlive);
static virNetMessagePtr
virKeepAliveMessage(virKeepAlivePtr ka, int proc)

View File

@ -124,7 +124,7 @@ static int virNetClientOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetClient)
VIR_ONCE_GLOBAL_INIT(virNetClient);
static void virNetClientIOEventLoopPassTheBuck(virNetClientPtr client,
virNetClientCallPtr thiscall);

View File

@ -58,7 +58,7 @@ static int virNetClientProgramOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetClientProgram)
VIR_ONCE_GLOBAL_INIT(virNetClientProgram);
virNetClientProgramPtr virNetClientProgramNew(unsigned program,

View File

@ -75,7 +75,7 @@ static int virNetClientStreamOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetClientStream)
VIR_ONCE_GLOBAL_INIT(virNetClientStream);
static void

View File

@ -113,7 +113,7 @@ virNetDaemonOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetDaemon)
VIR_ONCE_GLOBAL_INIT(virNetDaemon);
virNetDaemonPtr

View File

@ -66,7 +66,7 @@ static int virNetSASLContextOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetSASLContext)
VIR_ONCE_GLOBAL_INIT(virNetSASLContext);
/* Apple have annotated all SASL functions as deprecated for
* unknown reasons. Since they still work, lets just ignore

View File

@ -96,7 +96,7 @@ static int virNetServerOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetServer)
VIR_ONCE_GLOBAL_INIT(virNetServer);
unsigned long long virNetServerNextClientID(virNetServerPtr srv)
{

View File

@ -131,7 +131,7 @@ static int virNetServerClientOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetServerClient)
VIR_ONCE_GLOBAL_INIT(virNetServerClient);
static void virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque);

View File

@ -55,7 +55,7 @@ static int virNetServerProgramOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetServerProgram)
VIR_ONCE_GLOBAL_INIT(virNetServerProgram);
virNetServerProgramPtr virNetServerProgramNew(unsigned program,

View File

@ -59,7 +59,7 @@ static int virNetServerServiceOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetServerService)
VIR_ONCE_GLOBAL_INIT(virNetServerService);
static void virNetServerServiceAccept(virNetSocketPtr sock,

View File

@ -128,7 +128,7 @@ static int virNetSocketOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetSocket)
VIR_ONCE_GLOBAL_INIT(virNetSocket);
#ifndef WIN32

View File

@ -96,7 +96,7 @@ static int virNetTLSContextOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virNetTLSContext)
VIR_ONCE_GLOBAL_INIT(virNetTLSContext);
static int

View File

@ -133,7 +133,7 @@ static int testDriverOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(testDriver)
VIR_ONCE_GLOBAL_INIT(testDriver);
#define TEST_MODEL "i686"
#define TEST_EMULATOR "/usr/bin/test-hv"

View File

@ -55,7 +55,7 @@ static int virCloseCallbacksOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virCloseCallbacks)
VIR_ONCE_GLOBAL_INIT(virCloseCallbacks);
virCloseCallbacksPtr

View File

@ -58,7 +58,7 @@ virDevMapperOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virDevMapper)
VIR_ONCE_GLOBAL_INIT(virDevMapper);
static int

View File

@ -643,7 +643,7 @@ static int dnsmasqCapsOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(dnsmasqCaps)
VIR_ONCE_GLOBAL_INIT(dnsmasqCaps);
static void
dnsmasqCapsSet(dnsmasqCapsPtr caps,

View File

@ -135,7 +135,7 @@ static int virFDStreamDataOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virFDStreamData)
VIR_ONCE_GLOBAL_INIT(virFDStreamData);
static int

View File

@ -93,7 +93,7 @@ virFileCacheOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virFileCache)
VIR_ONCE_GLOBAL_INIT(virFileCache);
static char *

View File

@ -93,7 +93,7 @@ virFirewallOnceInit(void)
return virFirewallValidateBackend(currentBackend);
}
VIR_ONCE_GLOBAL_INIT(virFirewall)
VIR_ONCE_GLOBAL_INIT(virFirewall);
static bool iptablesUseLock;
static bool ip6tablesUseLock;

View File

@ -77,7 +77,7 @@ static int virHashAtomicOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virHashAtomic)
VIR_ONCE_GLOBAL_INIT(virHashAtomic);
static uint32_t virHashStrCode(const void *name, uint32_t seed)

View File

@ -124,7 +124,7 @@ static int virHostdevManagerOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virHostdevManager)
VIR_ONCE_GLOBAL_INIT(virHostdevManager);
static void
virHostdevManagerDispose(void *obj)

View File

@ -67,7 +67,7 @@ static int virIdentityOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virIdentity)
VIR_ONCE_GLOBAL_INIT(virIdentity);
/**
* virIdentityGetCurrent:

View File

@ -298,7 +298,7 @@ virLogOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virLog)
VIR_ONCE_GLOBAL_INIT(virLog);
/**

View File

@ -66,7 +66,7 @@ virMediatedOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virMediated)
VIR_ONCE_GLOBAL_INIT(virMediated);
#ifdef __linux__

View File

@ -203,7 +203,7 @@ static int virPCIOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virPCI)
VIR_ONCE_GLOBAL_INIT(virPCI);
static char *

View File

@ -91,7 +91,7 @@ virPortAllocatorOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virPortAllocator)
VIR_ONCE_GLOBAL_INIT(virPortAllocator);
virPortAllocatorRangePtr
virPortAllocatorRangeNew(const char *name,

View File

@ -443,7 +443,7 @@ virResctrlOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virResctrl)
VIR_ONCE_GLOBAL_INIT(virResctrl);
/* Common functions */

View File

@ -84,7 +84,7 @@ virSCSIOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virSCSI)
VIR_ONCE_GLOBAL_INIT(virSCSI);
static int
virSCSIDeviceGetAdapterId(const char *adapter,

View File

@ -73,7 +73,7 @@ virSCSIVHostOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(virSCSIVHost)
VIR_ONCE_GLOBAL_INIT(virSCSIVHost);
int

View File

@ -83,7 +83,7 @@ static int virStorageFileBackendOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virStorageFileBackend)
VIR_ONCE_GLOBAL_INIT(virStorageFileBackend);
int
virStorageFileBackendRegister(virStorageFileBackendPtr backend)

View File

@ -181,7 +181,7 @@ int virThreadLocalSet(virThreadLocalPtr l, void*) ATTRIBUTE_RETURN_CHECK;
*
* Then invoking the macro:
*
* VIR_ONCE_GLOBAL_INIT(virMyObject)
* VIR_ONCE_GLOBAL_INIT(virMyObject);
*
* Will create a method
*
@ -211,6 +211,7 @@ int virThreadLocalSet(virThreadLocalPtr l, void*) ATTRIBUTE_RETURN_CHECK;
} \
\
return 0; \
}
} \
struct classname ## EatSemicolon
#endif /* LIBVIRT_VIRTHREAD_H */

View File

@ -42,7 +42,7 @@ virThreadJobOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virThreadJob)
VIR_ONCE_GLOBAL_INIT(virThreadJob);
const char *

View File

@ -79,7 +79,7 @@ static int virUSBOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virUSB)
VIR_ONCE_GLOBAL_INIT(virUSB);
static int virUSBSysReadFile(const char *f_name, const char *d_name,
int base, unsigned int *value)

View File

@ -161,7 +161,7 @@ static int vzDriverOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(vzDriver)
VIR_ONCE_GLOBAL_INIT(vzDriver);
vzDriverPtr
vzGetDriverConnection(void)

View File

@ -57,7 +57,7 @@ testFileCacheObjOnceInit(void)
}
VIR_ONCE_GLOBAL_INIT(testFileCacheObj)
VIR_ONCE_GLOBAL_INIT(testFileCacheObj);
static testFileCacheObjPtr