提交 d54153fd 编写于 作者: J Ján Tomko

Use G_GNUC_NO_INLINE instead of ATTRIBUTE_NOINLINE

Define the macro for older GLib versions.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 ec96b740
......@@ -46,7 +46,7 @@ sub scan_annotations {
} elsif (/^\s*$/) {
$func = undef;
}
if (/ATTRIBUTE_NOINLINE/) {
if (/G_GNUC_NO_INLINE/) {
if (defined $func) {
$noninlined{$func} = 1;
}
......
......@@ -629,7 +629,7 @@ sc_avoid_g_gnuc_unused_in_header:
$(_sc_search_regexp)
sc_prohibit_attribute_macros:
@prohibit='ATTRIBUTE_(UNUSED|NORETURN|SENTINEL|RETURN_CHECK)' \
@prohibit='ATTRIBUTE_(UNUSED|NORETURN|SENTINEL|RETURN_CHECK|NOINLINE)' \
in_vc_files='\.[ch]$$' \
halt='use GLib macros: G_GNUC_<ATTRIBUTE_SUFFIX> for most' \
$(_sc_search_regexp)
......
......@@ -94,13 +94,15 @@
#define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
/**
* ATTRIBUTE_NOINLINE:
* G_GNUC_NO_INLINE:
*
* Force compiler not to inline a method. Should be used if
* the method need to be overridable by test mocks.
*
* TODO: Remove after upgrading to GLib >= 2.58
*/
#ifndef ATTRIBUTE_NOINLINE
# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
#ifndef G_GNUC_NO_INLINE
# define G_GNUC_NO_INLINE __attribute__((__noinline__))
#endif
/**
......
......@@ -83,7 +83,7 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCapsPtr qemuCaps,
virCPUDefPtr
virQEMUCapsProbeHostCPU(virArch hostArch,
virDomainCapsCPUModelsPtr models) ATTRIBUTE_NOINLINE;
virDomainCapsCPUModelsPtr models) G_GNUC_NO_INLINE;
void
virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
......
......@@ -136,10 +136,10 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
gid_t *gid,
pid_t *pid,
unsigned long long *timestamp)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virNetSocketGetSELinuxContext(virNetSocketPtr sock,
char **context)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virNetSocketSetBlocking(virNetSocketPtr sock,
bool blocking);
......
......@@ -58,7 +58,7 @@ typedef enum {
void virCommandPassFD(virCommandPtr cmd,
int fd,
unsigned int flags) ATTRIBUTE_NOINLINE;
unsigned int flags) G_GNUC_NO_INLINE;
int virCommandPassFDGetFDIndex(virCommandPtr cmd,
int fd);
......
......@@ -114,9 +114,9 @@ int virFileWrapperFdClose(virFileWrapperFdPtr dfd);
void virFileWrapperFdFree(virFileWrapperFdPtr dfd);
int virFileLock(int fd, bool shared, off_t start, off_t len, bool waitForLock)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virFileUnlock(int fd, off_t start, off_t len)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virFileFlock(int fd, bool lock, bool shared);
......@@ -199,7 +199,7 @@ void virFileActivateDirOverrideForLib(void);
off_t virFileLength(const char *path, int fd) ATTRIBUTE_NONNULL(1);
bool virFileIsDir (const char *file) ATTRIBUTE_NONNULL(1);
bool virFileExists(const char *file) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NOINLINE;
bool virFileExists(const char *file) ATTRIBUTE_NONNULL(1) G_GNUC_NO_INLINE;
bool virFileIsExecutable(const char *file) ATTRIBUTE_NONNULL(1);
bool virFileIsRegular(const char *file) ATTRIBUTE_NONNULL(1);
......@@ -231,7 +231,7 @@ int virFileGetMountReverseSubtree(const char *mtabpath,
size_t *nmountsret) G_GNUC_WARN_UNUSED_RESULT;
char *virFileSanitizePath(const char *path);
char *virFileCanonicalizePath(const char *path) ATTRIBUTE_NOINLINE;
char *virFileCanonicalizePath(const char *path) G_GNUC_NO_INLINE;
enum {
VIR_FILE_OPEN_NONE = 0,
......@@ -383,18 +383,18 @@ VIR_DEFINE_AUTOPTR_FUNC(virFileWrapperFd, virFileWrapperFdFree);
int virFileGetXAttr(const char *path,
const char *name,
char **value)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virFileGetXAttrQuiet(const char *path,
const char *name,
char **value)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virFileSetXAttr(const char *path,
const char *name,
const char *value)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virFileRemoveXAttr(const char *path,
const char *name)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
......@@ -30,4 +30,4 @@
#include "internal.h"
uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
......@@ -44,7 +44,7 @@ bool virHostCPUHasBitmap(void);
virBitmapPtr virHostCPUGetPresentBitmap(void);
virBitmapPtr virHostCPUGetOnlineBitmap(void);
int virHostCPUGetCount(void);
int virHostCPUGetThreadsPerSubcore(virArch arch) ATTRIBUTE_NOINLINE;
int virHostCPUGetThreadsPerSubcore(virArch arch) G_GNUC_NO_INLINE;
int virHostCPUGetMap(unsigned char **cpumap,
unsigned int *online,
......@@ -57,7 +57,7 @@ int virHostCPUGetInfo(virArch hostarch,
unsigned int *cores,
unsigned int *threads);
int virHostCPUGetKVMMaxVCPUs(void) ATTRIBUTE_NOINLINE;
int virHostCPUGetKVMMaxVCPUs(void) G_GNUC_NO_INLINE;
int virHostCPUStatsAssign(virNodeCPUStatsPtr param,
const char *name,
......
......@@ -24,4 +24,4 @@
int
virHostGetBootTime(unsigned long long *when)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
......@@ -52,7 +52,7 @@ void virMacAddrGetRaw(const virMacAddr *src, unsigned char dst[VIR_MAC_BUFLEN]);
const char *virMacAddrFormat(const virMacAddr *addr,
char *str);
void virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
virMacAddrPtr addr) ATTRIBUTE_NOINLINE;
virMacAddrPtr addr) G_GNUC_NO_INLINE;
int virMacAddrParse(const char* str,
virMacAddrPtr addr) G_GNUC_WARN_UNUSED_RESULT;
int virMacAddrParseHex(const char* str,
......
......@@ -150,11 +150,11 @@ int virNetDevSetupControl(const char *ifname,
G_GNUC_WARN_UNUSED_RESULT;
int virNetDevExists(const char *brname)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevSetOnline(const char *ifname,
bool online)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevGetOnline(const char *ifname,
bool *online)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
......@@ -162,7 +162,7 @@ int virNetDevGetOnline(const char *ifname,
int virNetDevSetMAC(const char *ifname,
const virMacAddr *macaddr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevGetMAC(const char *ifname,
virMacAddrPtr macaddr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
......@@ -306,9 +306,9 @@ int virNetDevSysfsFile(char **pf_sysfs_device_link,
const char *ifname,
const char *file)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevRunEthernetScript(const char *ifname, const char *script)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
VIR_DEFINE_AUTOPTR_FUNC(virNetDevRxFilter, virNetDevRxFilterFree);
......@@ -63,7 +63,7 @@ int virNetDevIPAddrAdd(const char *ifname,
virSocketAddr *addr,
virSocketAddr *peer,
unsigned int prefix)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevIPRouteAdd(const char *ifname,
virSocketAddrPtr addr,
unsigned int prefix,
......
......@@ -58,7 +58,7 @@ int virNetDevMacVLanReserveName(const char *name, bool quietfail);
int virNetDevMacVLanReleaseName(const char *name);
bool virNetDevMacVLanIsMacvtap(const char *ifname)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevMacVLanCreate(const char *ifname,
const char *type,
......
......@@ -62,7 +62,7 @@ int virNetDevOpenvswitchInterfaceGetMaster(const char *ifname, char **master)
int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
char **ifname)
ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan)
......
......@@ -34,7 +34,7 @@ int virNetDevTapCreate(char **ifname,
int *tapfd,
size_t tapfdSize,
unsigned int flags)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevTapDelete(const char *ifname,
const char *tunpath)
......@@ -44,7 +44,7 @@ int virNetDevTapGetName(int tapfd, char **ifname)
ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
char* virNetDevTapGetRealDeviceName(char *ifname)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
typedef enum {
VIR_NETDEV_TAP_CREATE_NONE = 0,
......@@ -96,7 +96,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
unsigned int *actualMTU,
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevTapInterfaceStats(const char *ifname,
virDomainInterfaceStatsPtr stats,
......
......@@ -33,20 +33,20 @@ int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
virBitmapPtr nodeset);
virBitmapPtr virNumaGetHostMemoryNodeset(void);
bool virNumaNodesetIsAvailable(virBitmapPtr nodeset) ATTRIBUTE_NOINLINE;
bool virNumaIsAvailable(void) ATTRIBUTE_NOINLINE;
int virNumaGetMaxNode(void) ATTRIBUTE_NOINLINE;
bool virNumaNodeIsAvailable(int node) ATTRIBUTE_NOINLINE;
bool virNumaNodesetIsAvailable(virBitmapPtr nodeset) G_GNUC_NO_INLINE;
bool virNumaIsAvailable(void) G_GNUC_NO_INLINE;
int virNumaGetMaxNode(void) G_GNUC_NO_INLINE;
bool virNumaNodeIsAvailable(int node) G_GNUC_NO_INLINE;
int virNumaGetDistances(int node,
int **distances,
int *ndistances) ATTRIBUTE_NOINLINE;
int *ndistances) G_GNUC_NO_INLINE;
int virNumaGetNodeMemory(int node,
unsigned long long *memsize,
unsigned long long *memfree) ATTRIBUTE_NOINLINE;
unsigned long long *memfree) G_GNUC_NO_INLINE;
unsigned int virNumaGetMaxCPUs(void);
int virNumaGetNodeCPUs(int node, virBitmapPtr *cpus) ATTRIBUTE_NOINLINE;
int virNumaGetNodeCPUs(int node, virBitmapPtr *cpus) G_GNUC_NO_INLINE;
int virNumaNodesetToCPUset(virBitmapPtr nodeset,
virBitmapPtr *cpuset);
......@@ -60,7 +60,7 @@ int virNumaGetPages(int node,
unsigned long long **pages_avail,
unsigned long long **pages_free,
size_t *npages)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(5) G_GNUC_NO_INLINE;
int virNumaSetPagePoolSize(int node,
unsigned int page_size,
unsigned long long page_count,
......
......@@ -75,7 +75,7 @@ int virProcessGetNamespaces(pid_t pid,
int virProcessSetNamespaces(size_t nfdlist,
int *fdlist);
int virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes) ATTRIBUTE_NOINLINE;
int virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes) G_GNUC_NO_INLINE;
int virProcessSetMaxProcesses(pid_t pid, unsigned int procs);
int virProcessSetMaxFiles(pid_t pid, unsigned int files);
int virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes);
......@@ -108,7 +108,7 @@ typedef int (*virProcessForkCallback)(pid_t ppid,
int virProcessRunInFork(virProcessForkCallback cb,
void *opaque)
ATTRIBUTE_NOINLINE;
G_GNUC_NO_INLINE;
int virProcessSetupPrivateMountNS(void);
......
......@@ -20,9 +20,9 @@
#include "internal.h"
uint64_t virRandomBits(int nbits) ATTRIBUTE_NOINLINE;
uint64_t virRandomBits(int nbits) G_GNUC_NO_INLINE;
double virRandom(void);
uint32_t virRandomInt(uint32_t max);
int virRandomBytes(unsigned char *buf, size_t buflen)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NOINLINE;
int virRandomGenerateWWN(char **wwn, const char *virt_type) ATTRIBUTE_NOINLINE;
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virRandomGenerateWWN(char **wwn, const char *virt_type) G_GNUC_NO_INLINE;
......@@ -37,7 +37,7 @@ char *virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
unsigned long long unit) ATTRIBUTE_NOINLINE;
unsigned long long unit) G_GNUC_NO_INLINE;
char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
......
......@@ -61,6 +61,6 @@ void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevicePtr dev,
const char **drv_name,
const char **dom_name);
void virSCSIVHostDeviceFree(virSCSIVHostDevicePtr dev);
int virSCSIVHostOpenVhostSCSI(int *vhostfd) ATTRIBUTE_NOINLINE;
int virSCSIVHostOpenVhostSCSI(int *vhostfd) G_GNUC_NO_INLINE;
VIR_DEFINE_AUTOPTR_FUNC(virSCSIVHostDevice, virSCSIVHostDeviceFree);
......@@ -20,7 +20,7 @@
#pragma once
char *virTPMCreateCancelPath(const char *devpath) ATTRIBUTE_NOINLINE;
char *virTPMCreateCancelPath(const char *devpath) G_GNUC_NO_INLINE;
char *virTPMGetSwtpm(void);
char *virTPMGetSwtpmSetup(void);
......
......@@ -103,8 +103,8 @@ char *virGetUserConfigDirectory(void);
char *virGetUserCacheDirectory(void);
char *virGetUserRuntimeDirectory(void);
char *virGetUserShell(uid_t uid);
char *virGetUserName(uid_t uid) ATTRIBUTE_NOINLINE;
char *virGetGroupName(gid_t gid) ATTRIBUTE_NOINLINE;
char *virGetUserName(uid_t uid) G_GNUC_NO_INLINE;
char *virGetGroupName(gid_t gid) G_GNUC_NO_INLINE;
int virGetGroupList(uid_t uid, gid_t group, gid_t **groups)
ATTRIBUTE_NONNULL(3);
int virGetUserID(const char *name,
......@@ -138,16 +138,16 @@ int virParseOwnershipIds(const char *label, uid_t *uidPtr, gid_t *gidPtr);
time_t virGetSelfLastChanged(void);
void virUpdateSelfLastChanged(const char *path);
long virGetSystemPageSize(void) ATTRIBUTE_NOINLINE;
long virGetSystemPageSizeKB(void) ATTRIBUTE_NOINLINE;
long virGetSystemPageSize(void) G_GNUC_NO_INLINE;
long virGetSystemPageSizeKB(void) G_GNUC_NO_INLINE;
unsigned long long virMemoryLimitTruncate(unsigned long long value);
bool virMemoryLimitIsSet(unsigned long long value);
unsigned long long virMemoryMaxValue(bool ulong) ATTRIBUTE_NOINLINE;
unsigned long long virMemoryMaxValue(bool ulong) G_GNUC_NO_INLINE;
bool virHostHasIOMMU(void);
char *virHostGetDRMRenderNode(void) ATTRIBUTE_NOINLINE;
char *virHostGetDRMRenderNode(void) G_GNUC_NO_INLINE;
/**
* VIR_ASSIGN_IS_OVERFLOW:
......
......@@ -45,7 +45,7 @@ int virGetHostUUID(unsigned char *host_uuid) ATTRIBUTE_NONNULL(1);
int virUUIDIsValid(unsigned char *uuid);
int virUUIDGenerate(unsigned char *uuid) ATTRIBUTE_NOINLINE;
int virUUIDGenerate(unsigned char *uuid) G_GNUC_NO_INLINE;
int virUUIDParse(const char *uuidstr,
unsigned char *uuid)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册