mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
7b9645a7d1
commit
fa434739a0
@ -1621,12 +1621,6 @@ sc_prohibit_dirent_without_use:
|
||||
re='\<($(_dirent_syms_re))\>' \
|
||||
$(_sc_header_without_use)
|
||||
|
||||
# Prohibit the inclusion of verify.h without an actual use.
|
||||
sc_prohibit_verify_without_use:
|
||||
@h='verify.h' \
|
||||
re='\<(verify(true|expr)?|assume|static_assert) *\(' \
|
||||
$(_sc_header_without_use)
|
||||
|
||||
# Don't include xfreopen.h unless you use one of its functions.
|
||||
sc_prohibit_xfreopen_without_use:
|
||||
@h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use)
|
||||
|
@ -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)
|
||||
|
@ -56,7 +56,7 @@ typedef enum {
|
||||
VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT,
|
||||
VIR_DOMAIN_SNAPSHOT_LAST
|
||||
} virDomainSnapshotState;
|
||||
verify((int)VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT == VIR_DOMAIN_LAST);
|
||||
G_STATIC_ASSERT((int)VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT == VIR_DOMAIN_LAST);
|
||||
|
||||
/* Stores disk-snapshot information */
|
||||
typedef struct _virDomainSnapshotDiskDef virDomainSnapshotDiskDef;
|
||||
|
@ -91,13 +91,13 @@ virDomainCheckpointObjListGetNames(virDomainCheckpointObjListPtr checkpoints,
|
||||
unsigned int flags)
|
||||
{
|
||||
/* We intentionally chose our public flags to match the common flags */
|
||||
verify(VIR_DOMAIN_CHECKPOINT_LIST_ROOTS ==
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_CHECKPOINT_LIST_ROOTS ==
|
||||
(int) VIR_DOMAIN_MOMENT_LIST_ROOTS);
|
||||
verify(VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL ==
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL ==
|
||||
(int) VIR_DOMAIN_MOMENT_LIST_TOPOLOGICAL);
|
||||
verify(VIR_DOMAIN_CHECKPOINT_LIST_LEAVES ==
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_CHECKPOINT_LIST_LEAVES ==
|
||||
(int) VIR_DOMAIN_MOMENT_LIST_LEAVES);
|
||||
verify(VIR_DOMAIN_CHECKPOINT_LIST_NO_LEAVES ==
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_CHECKPOINT_LIST_NO_LEAVES ==
|
||||
(int) VIR_DOMAIN_MOMENT_LIST_NO_LEAVES);
|
||||
|
||||
return virDomainMomentObjListGetNames(checkpoints->base, from, names,
|
||||
|
@ -41,7 +41,7 @@
|
||||
* The UUID of a network is the MD5 sum of its key. Therefore, verify that
|
||||
* UUID and MD5 sum match in size, because we rely on that.
|
||||
*/
|
||||
verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
G_STATIC_ASSERT(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
|
||||
|
||||
static int
|
||||
|
@ -43,7 +43,7 @@
|
||||
* The UUID of a storage pool is the MD5 sum of its mount path. Therefore,
|
||||
* verify that UUID and MD5 sum match in size, because we rely on that.
|
||||
*/
|
||||
verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
G_STATIC_ASSERT(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ VIR_LOG_INIT("esx.esx_storage_backend_vmfs");
|
||||
* The UUID of a storage pool is the MD5 sum of its mount path. Therefore,
|
||||
* verify that UUID and MD5 sum match in size, because we rely on that.
|
||||
*/
|
||||
verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
G_STATIC_ASSERT(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <verify.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "virerror.h"
|
||||
#include "virconf.h"
|
||||
#include "viralloc.h"
|
||||
#include "verify.h"
|
||||
#include "xenxs_private.h"
|
||||
#include "xen_xm.h"
|
||||
#include "domain_conf.h"
|
||||
@ -581,7 +580,7 @@ xenFormatXMInputDevs(virConfPtr conf, virDomainDefPtr def)
|
||||
|
||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
||||
either 32, or 64 on a platform where long is big enough. */
|
||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||
G_STATIC_ASSERT(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||
|
||||
/*
|
||||
* Convert a virDomainDef object into an XM config record.
|
||||
|
@ -186,7 +186,7 @@ struct _virNWFilterSnoopEthHdr {
|
||||
uint16_t eh_type;
|
||||
uint8_t eh_data[];
|
||||
} ATTRIBUTE_PACKED;
|
||||
verify(sizeof(struct _virNWFilterSnoopEthHdr) == 14);
|
||||
G_STATIC_ASSERT(sizeof(struct _virNWFilterSnoopEthHdr) == 14);
|
||||
|
||||
typedef struct _virNWFilterSnoopDHCPHdr virNWFilterSnoopDHCPHdr;
|
||||
typedef virNWFilterSnoopDHCPHdr *virNWFilterSnoopDHCPHdrPtr;
|
||||
@ -208,7 +208,7 @@ struct _virNWFilterSnoopDHCPHdr {
|
||||
char d_file[128];
|
||||
uint8_t d_opts[];
|
||||
} ATTRIBUTE_PACKED;
|
||||
verify(sizeof(struct _virNWFilterSnoopDHCPHdr) == 236);
|
||||
G_STATIC_ASSERT(sizeof(struct _virNWFilterSnoopDHCPHdr) == 236);
|
||||
|
||||
/* DHCP options */
|
||||
|
||||
|
@ -44,7 +44,7 @@ typedef enum {
|
||||
QEMU_BLOCKJOB_STATE_PIVOTING,
|
||||
QEMU_BLOCKJOB_STATE_LAST
|
||||
} qemuBlockjobState;
|
||||
verify((int)QEMU_BLOCKJOB_STATE_NEW == VIR_DOMAIN_BLOCK_JOB_LAST);
|
||||
G_STATIC_ASSERT((int)QEMU_BLOCKJOB_STATE_NEW == VIR_DOMAIN_BLOCK_JOB_LAST);
|
||||
|
||||
VIR_ENUM_DECL(qemuBlockjobState);
|
||||
|
||||
@ -67,7 +67,7 @@ typedef enum {
|
||||
QEMU_BLOCKJOB_TYPE_BROKEN,
|
||||
QEMU_BLOCKJOB_TYPE_LAST
|
||||
} qemuBlockJobType;
|
||||
verify((int)QEMU_BLOCKJOB_TYPE_INTERNAL == VIR_DOMAIN_BLOCK_JOB_TYPE_LAST);
|
||||
G_STATIC_ASSERT((int)QEMU_BLOCKJOB_TYPE_INTERNAL == VIR_DOMAIN_BLOCK_JOB_TYPE_LAST);
|
||||
|
||||
VIR_ENUM_DECL(qemuBlockjob);
|
||||
|
||||
|
@ -2491,7 +2491,7 @@ static const char *preferredMachines[] =
|
||||
"sim", /* VIR_ARCH_XTENSA */
|
||||
"sim", /* VIR_ARCH_XTENSAEB */
|
||||
};
|
||||
verify(G_N_ELEMENTS(preferredMachines) == VIR_ARCH_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(preferredMachines) == VIR_ARCH_LAST);
|
||||
|
||||
|
||||
void
|
||||
|
@ -2765,7 +2765,7 @@ qemuDomainGetControlInfo(virDomainPtr dom,
|
||||
#define QEMU_SAVE_PARTIAL "LibvirtQemudPart"
|
||||
#define QEMU_SAVE_VERSION 2
|
||||
|
||||
verify(sizeof(QEMU_SAVE_MAGIC) == sizeof(QEMU_SAVE_PARTIAL));
|
||||
G_STATIC_ASSERT(sizeof(QEMU_SAVE_MAGIC) == sizeof(QEMU_SAVE_PARTIAL));
|
||||
|
||||
typedef enum {
|
||||
QEMU_SAVE_FORMAT_RAW = 0,
|
||||
|
@ -57,4 +57,4 @@ qemuFirmwareGetSupported(const char *machine,
|
||||
virFirmwarePtr **fws,
|
||||
size_t *nfws);
|
||||
|
||||
verify(VIR_DOMAIN_OS_DEF_FIRMWARE_LAST <= 64);
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_OS_DEF_FIRMWARE_LAST <= 64);
|
||||
|
@ -218,7 +218,7 @@ static const qemuMigrationParamType qemuMigrationParamTypes[] = {
|
||||
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
|
||||
[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
|
||||
};
|
||||
verify(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
|
||||
|
||||
|
||||
virBitmapPtr
|
||||
|
@ -1331,7 +1331,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockThreshold),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
||||
|
||||
static int
|
||||
remoteRelayNetworkEventLifecycle(virConnectPtr conn,
|
||||
@ -1368,7 +1368,7 @@ static virConnectNetworkEventGenericCallback networkEventCallbacks[] = {
|
||||
VIR_NETWORK_EVENT_CALLBACK(remoteRelayNetworkEventLifecycle),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(networkEventCallbacks) == VIR_NETWORK_EVENT_ID_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(networkEventCallbacks) == VIR_NETWORK_EVENT_ID_LAST);
|
||||
|
||||
static int
|
||||
remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
|
||||
@ -1435,7 +1435,7 @@ static virConnectStoragePoolEventGenericCallback storageEventCallbacks[] = {
|
||||
VIR_STORAGE_POOL_EVENT_CALLBACK(remoteRelayStoragePoolEventRefresh),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(storageEventCallbacks) == VIR_STORAGE_POOL_EVENT_ID_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(storageEventCallbacks) == VIR_STORAGE_POOL_EVENT_ID_LAST);
|
||||
|
||||
static int
|
||||
remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
|
||||
@ -1502,7 +1502,7 @@ static virConnectNodeDeviceEventGenericCallback nodeDeviceEventCallbacks[] = {
|
||||
VIR_NODE_DEVICE_EVENT_CALLBACK(remoteRelayNodeDeviceEventUpdate),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(nodeDeviceEventCallbacks) == VIR_NODE_DEVICE_EVENT_ID_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(nodeDeviceEventCallbacks) == VIR_NODE_DEVICE_EVENT_ID_LAST);
|
||||
|
||||
static int
|
||||
remoteRelaySecretEventLifecycle(virConnectPtr conn,
|
||||
@ -1569,7 +1569,7 @@ static virConnectSecretEventGenericCallback secretEventCallbacks[] = {
|
||||
VIR_SECRET_EVENT_CALLBACK(remoteRelaySecretEventValueChanged),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(secretEventCallbacks) == VIR_SECRET_EVENT_ID_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(secretEventCallbacks) == VIR_SECRET_EVENT_ID_LAST);
|
||||
|
||||
static void
|
||||
remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "virlog.h"
|
||||
#include "virarch.h"
|
||||
#include "verify.h"
|
||||
|
||||
VIR_LOG_INIT("util.arch");
|
||||
|
||||
@ -81,7 +80,7 @@ static const struct virArchData {
|
||||
{ "xtensaeb", 32, VIR_ARCH_BIG_ENDIAN },
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(virArchData) == VIR_ARCH_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(virArchData) == VIR_ARCH_LAST);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ VIR_ENUM_DECL(virCgroupController);
|
||||
* bit array stored in int. Like this:
|
||||
* 1 << VIR_CGROUP_CONTROLLER_CPU
|
||||
* Make sure we will not overflow */
|
||||
verify(VIR_CGROUP_CONTROLLER_LAST < 8 * sizeof(int));
|
||||
G_STATIC_ASSERT(VIR_CGROUP_CONTROLLER_LAST < 8 * sizeof(int));
|
||||
|
||||
typedef enum {
|
||||
VIR_CGROUP_THREAD_VCPU = 0,
|
||||
|
@ -47,7 +47,7 @@ struct virHashInfo {
|
||||
};
|
||||
|
||||
|
||||
verify(G_N_ELEMENTS(hashinfo) == VIR_CRYPTO_HASH_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(hashinfo) == VIR_CRYPTO_HASH_LAST);
|
||||
|
||||
ssize_t
|
||||
virCryptoHashBuf(virCryptoHash hash,
|
||||
|
@ -42,7 +42,7 @@ virEnumToString(const char * const *types,
|
||||
G_N_ELEMENTS(name ## TypeList), \
|
||||
type); \
|
||||
} \
|
||||
verify(G_N_ELEMENTS(name ## TypeList) == lastVal)
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(name ## TypeList) == lastVal)
|
||||
|
||||
#define VIR_ENUM_DECL(name) \
|
||||
const char *name ## TypeToString(int type); \
|
||||
@ -72,6 +72,6 @@ virTristateSwitch virTristateSwitchFromBool(bool val);
|
||||
|
||||
/* the two enums must be in sync to be able to use helpers interchangeably in
|
||||
* some special cases */
|
||||
verify((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON);
|
||||
verify((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF);
|
||||
verify((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT);
|
||||
G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON);
|
||||
G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF);
|
||||
G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT);
|
||||
|
@ -96,9 +96,9 @@ struct virInitctlRequest {
|
||||
};
|
||||
|
||||
# ifdef MAXHOSTNAMELEN
|
||||
verify(sizeof(struct virInitctlRequest) == 320 + MAXHOSTNAMELEN);
|
||||
G_STATIC_ASSERT(sizeof(struct virInitctlRequest) == 320 + MAXHOSTNAMELEN);
|
||||
# else
|
||||
verify(sizeof(struct virInitctlRequest) == 384);
|
||||
G_STATIC_ASSERT(sizeof(struct virInitctlRequest) == 384);
|
||||
# endif
|
||||
|
||||
|
||||
|
@ -56,17 +56,17 @@ static const unsigned short *virKeymapValues[VIR_KEYCODE_SET_LAST] = {
|
||||
|
||||
#define VIR_KEYMAP_ENTRY_MAX G_N_ELEMENTS(virKeyCodeTable_linux)
|
||||
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset1));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset2));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset3));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_osx));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_xtkbd));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_usb));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_win32));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_qnum));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_linux));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_osx));
|
||||
verify(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_win32));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset1));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset2));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_atset3));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_osx));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_xtkbd));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_usb));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_win32));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyCodeTable_qnum));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_linux));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_osx));
|
||||
G_STATIC_ASSERT(VIR_KEYMAP_ENTRY_MAX == G_N_ELEMENTS(virKeyNameTable_win32));
|
||||
|
||||
VIR_ENUM_IMPL(virKeycodeSet,
|
||||
VIR_KEYCODE_SET_LAST,
|
||||
|
@ -38,7 +38,7 @@ struct _virMacAddr {
|
||||
* must not have any extra members added - it must remain exactly
|
||||
* 6 bytes in length.
|
||||
*/
|
||||
verify(sizeof(struct _virMacAddr) == 6);
|
||||
G_STATIC_ASSERT(sizeof(struct _virMacAddr) == 6);
|
||||
|
||||
|
||||
int virMacAddrCompare(const char *mac1, const char *mac2);
|
||||
|
@ -80,10 +80,10 @@ virClassPtr virClassForObjectRWLockable(void);
|
||||
* function or as a macro defined to NULL.
|
||||
*/
|
||||
#define VIR_CLASS_NEW(name, prnt) \
|
||||
verify_expr(offsetof(name, parent) == 0, \
|
||||
(name##Class = virClassNew(prnt, #name, sizeof(name), \
|
||||
sizeof(((name *)NULL)->parent), \
|
||||
name##Dispose)))
|
||||
(G_STATIC_ASSERT_EXPR(offsetof(name, parent) == 0), \
|
||||
(name##Class = virClassNew(prnt, #name, sizeof(name),\
|
||||
sizeof(((name *)NULL)->parent), \
|
||||
name##Dispose)))
|
||||
|
||||
virClassPtr
|
||||
virClassNew(virClassPtr parent,
|
||||
|
@ -168,7 +168,7 @@ static struct virPerfEventAttr attrs[] = {
|
||||
.attrConfig = PERF_COUNT_SW_EMULATION_FAULTS
|
||||
},
|
||||
};
|
||||
verify(G_N_ELEMENTS(attrs) == VIR_PERF_EVENT_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(attrs) == VIR_PERF_EVENT_LAST);
|
||||
typedef struct virPerfEventAttr *virPerfEventAttrPtr;
|
||||
|
||||
|
||||
|
@ -386,7 +386,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
|
||||
4+4+4, 8, 512, NULL, vmdk4GetBackingStore, NULL
|
||||
},
|
||||
};
|
||||
verify(G_N_ELEMENTS(fileTypeInfo) == VIR_STORAGE_FILE_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(fileTypeInfo) == VIR_STORAGE_FILE_LAST);
|
||||
|
||||
|
||||
/* qcow2 compatible features in the order they appear on-disk */
|
||||
@ -400,7 +400,7 @@ enum qcow2CompatibleFeature {
|
||||
static const int qcow2CompatibleFeatureArray[] = {
|
||||
VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS,
|
||||
};
|
||||
verify(G_N_ELEMENTS(qcow2CompatibleFeatureArray) ==
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(qcow2CompatibleFeatureArray) ==
|
||||
QCOW2_COMPATIBLE_FEATURE_LAST);
|
||||
|
||||
static int
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
#define VIR_TYPED_PARAM_MULTIPLE (1U << 31)
|
||||
|
||||
verify(!(VIR_TYPED_PARAM_LAST & VIR_TYPED_PARAM_MULTIPLE));
|
||||
G_STATIC_ASSERT(!(VIR_TYPED_PARAM_LAST & VIR_TYPED_PARAM_MULTIPLE));
|
||||
|
||||
typedef struct _virTypedParameterRemoteValue virTypedParameterRemoteValue;
|
||||
typedef struct virTypedParameterRemoteValue *virTypedParameterRemoteValuePtr;
|
||||
|
@ -68,7 +68,6 @@
|
||||
#include "virlog.h"
|
||||
#include "virbuffer.h"
|
||||
#include "viralloc.h"
|
||||
#include "verify.h"
|
||||
#include "virfile.h"
|
||||
#include "vircommand.h"
|
||||
#include "virprocess.h"
|
||||
@ -76,7 +75,7 @@
|
||||
#include "virutil.h"
|
||||
#include "virsocket.h"
|
||||
|
||||
verify(sizeof(gid_t) <= sizeof(unsigned int) &&
|
||||
G_STATIC_ASSERT(sizeof(gid_t) <= sizeof(unsigned int) &&
|
||||
sizeof(uid_t) <= sizeof(unsigned int));
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
@ -122,7 +122,7 @@ vzBuildCapabilities(void)
|
||||
if (virCapabilitiesInitCaches(caps) < 0)
|
||||
goto error;
|
||||
|
||||
verify(G_N_ELEMENTS(archs) == G_N_ELEMENTS(emulators));
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(archs) == G_N_ELEMENTS(emulators));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(ostypes); i++)
|
||||
for (j = 0; j < G_N_ELEMENTS(archs); j++)
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
|
||||
#include "testutils.h"
|
||||
#include "verify.h"
|
||||
#include "virerror.h"
|
||||
#include "viralloc.h"
|
||||
#include "virfile.h"
|
||||
@ -420,9 +419,9 @@ struct stringToLongData {
|
||||
* not guaranteed by POSIX. Good luck to you if you are crazy enough
|
||||
* to try and port libvirt to a platform with 16-bit int. Gnulib
|
||||
* already assumes that signed integers are two's complement. */
|
||||
verify(sizeof(int) == 4);
|
||||
verify(sizeof(long) == sizeof(int) || sizeof(long) == sizeof(long long));
|
||||
verify(sizeof(long long) == 8);
|
||||
G_STATIC_ASSERT(sizeof(int) == 4);
|
||||
G_STATIC_ASSERT(sizeof(long) == sizeof(int) || sizeof(long) == sizeof(long long));
|
||||
G_STATIC_ASSERT(sizeof(long long) == 8);
|
||||
|
||||
static int
|
||||
testStringToLong(const void *opaque)
|
||||
|
@ -13513,7 +13513,7 @@ virshDomainEventCallback virshDomainEventCallbacks[] = {
|
||||
{ "block-threshold",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockThresholdPrint), },
|
||||
};
|
||||
verify(VIR_DOMAIN_EVENT_ID_LAST == G_N_ELEMENTS(virshDomainEventCallbacks));
|
||||
G_STATIC_ASSERT(VIR_DOMAIN_EVENT_ID_LAST == G_N_ELEMENTS(virshDomainEventCallbacks));
|
||||
|
||||
static const vshCmdInfo info_event[] = {
|
||||
{.name = "help",
|
||||
|
@ -1242,7 +1242,7 @@ virshNetworkEventCallback virshNetworkEventCallbacks[] = {
|
||||
{ "lifecycle",
|
||||
VIR_NETWORK_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
||||
};
|
||||
verify(VIR_NETWORK_EVENT_ID_LAST == G_N_ELEMENTS(virshNetworkEventCallbacks));
|
||||
G_STATIC_ASSERT(VIR_NETWORK_EVENT_ID_LAST == G_N_ELEMENTS(virshNetworkEventCallbacks));
|
||||
|
||||
static const vshCmdInfo info_network_event[] = {
|
||||
{.name = "help",
|
||||
|
@ -845,7 +845,7 @@ virshNodeDeviceEventCallback virshNodeDeviceEventCallbacks[] = {
|
||||
VIR_NODE_DEVICE_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
||||
{ "update", vshEventGenericPrint, }
|
||||
};
|
||||
verify(VIR_NODE_DEVICE_EVENT_ID_LAST == G_N_ELEMENTS(virshNodeDeviceEventCallbacks));
|
||||
G_STATIC_ASSERT(VIR_NODE_DEVICE_EVENT_ID_LAST == G_N_ELEMENTS(virshNodeDeviceEventCallbacks));
|
||||
|
||||
|
||||
static const vshCmdInfo info_node_device_event[] = {
|
||||
|
@ -1972,7 +1972,7 @@ virshPoolEventCallback virshPoolEventCallbacks[] = {
|
||||
VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
||||
{ "refresh", vshEventGenericPrint, }
|
||||
};
|
||||
verify(VIR_STORAGE_POOL_EVENT_ID_LAST == G_N_ELEMENTS(virshPoolEventCallbacks));
|
||||
G_STATIC_ASSERT(VIR_STORAGE_POOL_EVENT_ID_LAST == G_N_ELEMENTS(virshPoolEventCallbacks));
|
||||
|
||||
|
||||
static const vshCmdInfo info_pool_event[] = {
|
||||
|
@ -649,7 +649,7 @@ virshSecretEventCallback virshSecretEventCallbacks[] = {
|
||||
VIR_SECRET_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
||||
{ "value-changed", vshEventGenericPrint, },
|
||||
};
|
||||
verify(VIR_SECRET_EVENT_ID_LAST == G_N_ELEMENTS(virshSecretEventCallbacks));
|
||||
G_STATIC_ASSERT(VIR_SECRET_EVENT_ID_LAST == G_N_ELEMENTS(virshSecretEventCallbacks));
|
||||
|
||||
static const vshCmdInfo info_secret_event[] = {
|
||||
{.name = "help",
|
||||
|
@ -96,7 +96,7 @@ static const char * failMessages[] = {
|
||||
N_("NOTE"),
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(failMessages) == VIR_HOST_VALIDATE_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(failMessages) == VIR_HOST_VALIDATE_LAST);
|
||||
|
||||
static const char *failEscapeCodes[] = {
|
||||
"\033[31m",
|
||||
@ -104,7 +104,7 @@ static const char *failEscapeCodes[] = {
|
||||
"\033[34m",
|
||||
};
|
||||
|
||||
verify(G_N_ELEMENTS(failEscapeCodes) == VIR_HOST_VALIDATE_LAST);
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(failEscapeCodes) == VIR_HOST_VALIDATE_LAST);
|
||||
|
||||
void virHostMsgFail(virHostValidateLevel level,
|
||||
const char *format,
|
||||
|
Loading…
Reference in New Issue
Block a user