mirror of https://gitee.com/openkylin/libvirt.git
Use G_GNUC_PRINTF instead of ATTRIBUTE_FMT_PRINTF
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d54153fde3
commit
da367c0f9b
|
@ -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|NOINLINE)' \
|
||||
@prohibit='ATTRIBUTE_(UNUSED|NORETURN|SENTINEL|RETURN_CHECK|NOINLINE|FMT_PRINTF)' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='use GLib macros: G_GNUC_<ATTRIBUTE_SUFFIX> for most' \
|
||||
$(_sc_search_regexp)
|
||||
|
|
|
@ -105,26 +105,6 @@
|
|||
# define G_GNUC_NO_INLINE __attribute__((__noinline__))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_FMT_PRINTF
|
||||
*
|
||||
* Macro used to check printf like functions, if compiling
|
||||
* with gcc.
|
||||
*
|
||||
* We use gnulib which guarantees we always have GNU style
|
||||
* printf format specifiers even on broken Win32 platforms
|
||||
* hence we have to force 'gnu_printf' for new GCC
|
||||
*/
|
||||
#ifndef ATTRIBUTE_FMT_PRINTF
|
||||
# ifndef __clang__
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \
|
||||
__attribute__((__format__ (__gnu_printf__, fmtpos, argpos)))
|
||||
# else
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \
|
||||
__attribute__((__format__ (__printf__, fmtpos, argpos)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_PACKED
|
||||
*
|
||||
|
|
|
@ -54,7 +54,7 @@ libxlLoggerFileFree(void *payload, const void *key G_GNUC_UNUSED)
|
|||
file = NULL;
|
||||
}
|
||||
|
||||
ATTRIBUTE_FMT_PRINTF(5, 0) static void
|
||||
G_GNUC_PRINTF(5, 0) static void
|
||||
libvirt_vmessage(xentoollog_logger *logger_in,
|
||||
xentoollog_level level,
|
||||
int errnoval,
|
||||
|
|
|
@ -739,7 +739,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
|
|||
virDomainObjPtr vm,
|
||||
qemuDomainLogContextMode mode);
|
||||
int qemuDomainLogContextWrite(qemuDomainLogContextPtr ctxt,
|
||||
const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
const char *fmt, ...) G_GNUC_PRINTF(2, 3);
|
||||
ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt,
|
||||
char **msg);
|
||||
int qemuDomainLogContextGetWriteFD(qemuDomainLogContextPtr ctxt);
|
||||
|
@ -750,7 +750,7 @@ virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);
|
|||
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *fmt,
|
||||
...) ATTRIBUTE_FMT_PRINTF(3, 4);
|
||||
...) G_GNUC_PRINTF(3, 4);
|
||||
|
||||
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void virAuditSend(virLogSourcePtr source,
|
|||
const char *clienttty, const char *clientaddr,
|
||||
virAuditRecordType type, bool success,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(9, 10);
|
||||
G_GNUC_PRINTF(9, 10);
|
||||
|
||||
char *virAuditEncode(const char *key, const char *value);
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ void virBufferAdd(virBufferPtr buf, const char *str, int len);
|
|||
void virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd);
|
||||
void virBufferAddChar(virBufferPtr buf, char c);
|
||||
void virBufferAsprintf(virBufferPtr buf, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
void virBufferVasprintf(virBufferPtr buf, const char *format, va_list ap)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 0);
|
||||
G_GNUC_PRINTF(2, 0);
|
||||
void virBufferStrcat(virBufferPtr buf, ...)
|
||||
G_GNUC_NULL_TERMINATED;
|
||||
void virBufferStrcatVArgs(virBufferPtr buf, va_list ap);
|
||||
|
|
|
@ -98,7 +98,7 @@ void virCommandNonblockingFDs(virCommandPtr cmd);
|
|||
void virCommandRawStatus(virCommandPtr cmd);
|
||||
|
||||
void virCommandAddEnvFormat(virCommandPtr cmd, const char *format, ...)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
void virCommandAddEnvPair(virCommandPtr cmd,
|
||||
const char *name,
|
||||
|
@ -125,7 +125,7 @@ void virCommandAddArgBuffer(virCommandPtr cmd,
|
|||
|
||||
void virCommandAddArgFormat(virCommandPtr cmd,
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
void virCommandAddArgPair(virCommandPtr cmd,
|
||||
const char *name,
|
||||
|
|
|
@ -42,7 +42,7 @@ void virRaiseErrorFull(const char *filename,
|
|||
int int1,
|
||||
int int2,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(12, 13);
|
||||
G_GNUC_PRINTF(12, 13);
|
||||
|
||||
void virRaiseErrorObject(const char *filename,
|
||||
const char *funcname,
|
||||
|
@ -54,7 +54,7 @@ void virReportErrorHelper(int domcode, int errcode,
|
|||
const char *funcname,
|
||||
size_t linenr,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(6, 7);
|
||||
G_GNUC_PRINTF(6, 7);
|
||||
|
||||
void virReportSystemErrorFull(int domcode,
|
||||
int theerrno,
|
||||
|
@ -62,7 +62,7 @@ void virReportSystemErrorFull(int domcode,
|
|||
const char *funcname,
|
||||
size_t linenr,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(6, 7);
|
||||
G_GNUC_PRINTF(6, 7);
|
||||
|
||||
#define virReportSystemError(theerrno, fmt,...) \
|
||||
virReportSystemErrorFull(VIR_FROM_THIS, \
|
||||
|
@ -207,6 +207,6 @@ void virErrorPreserveLast(virErrorPtr *saveerr);
|
|||
void virErrorRestore(virErrorPtr *savederr);
|
||||
|
||||
void virLastErrorPrefixMessage(const char *fmt, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(1, 2);
|
||||
G_GNUC_PRINTF(1, 2);
|
||||
|
||||
VIR_DEFINE_AUTOPTR_FUNC(virError, virFreeError);
|
||||
|
|
|
@ -320,7 +320,7 @@ char *virFileFindMountPoint(const char *type);
|
|||
int virBuildPathInternal(char **path, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
int virFilePrintf(FILE *fp, const char *msg, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
|
||||
typedef struct _virHugeTLBFS virHugeTLBFS;
|
||||
typedef virHugeTLBFS *virHugeTLBFSPtr;
|
||||
|
@ -361,15 +361,15 @@ int virFileCopyACLs(const char *src,
|
|||
int virFileComparePaths(const char *p1, const char *p2);
|
||||
|
||||
int virFileReadValueInt(int *value, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
int virFileReadValueUint(unsigned int *value, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
int virFileReadValueBitmap(virBitmapPtr *value, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
int virFileReadValueScaledInt(unsigned long long *value, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
int virFileReadValueString(char **value, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
|
||||
int virFileWaitForExists(const char *path, size_t ms, size_t tries);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void virFirewallRuleAddArg(virFirewallPtr firewall,
|
|||
void virFirewallRuleAddArgFormat(virFirewallPtr firewall,
|
||||
virFirewallRulePtr rule,
|
||||
const char *fmt, ...)
|
||||
ATTRIBUTE_NONNULL(3) ATTRIBUTE_FMT_PRINTF(3, 4);
|
||||
ATTRIBUTE_NONNULL(3) G_GNUC_PRINTF(3, 4);
|
||||
|
||||
void virFirewallRuleAddArgSet(virFirewallPtr firewall,
|
||||
virFirewallRulePtr rule,
|
||||
|
|
|
@ -206,7 +206,7 @@ void virLogMessage(virLogSourcePtr source,
|
|||
int linenr,
|
||||
const char *funcname,
|
||||
virLogMetadataPtr metadata,
|
||||
const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(7, 8);
|
||||
const char *fmt, ...) G_GNUC_PRINTF(7, 8);
|
||||
void virLogVMessage(virLogSourcePtr source,
|
||||
virLogPriority priority,
|
||||
const char *filename,
|
||||
|
@ -214,7 +214,7 @@ void virLogVMessage(virLogSourcePtr source,
|
|||
const char *funcname,
|
||||
virLogMetadataPtr metadata,
|
||||
const char *fmt,
|
||||
va_list vargs) ATTRIBUTE_FMT_PRINTF(7, 0);
|
||||
va_list vargs) G_GNUC_PRINTF(7, 0);
|
||||
|
||||
bool virLogProbablyLogMessage(const char *str);
|
||||
virLogOutputPtr virLogOutputNew(virLogOutputFunc f,
|
||||
|
|
|
@ -134,10 +134,10 @@ int virStrdup(char **dest, const char *src)
|
|||
int virStrndup(char **dest, const char *src, ssize_t n)
|
||||
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
|
||||
int virAsprintfInternal(char **strp, const char *fmt, ...)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 3)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virVasprintfInternal(char **strp, const char *fmt, va_list list)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 0)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 0)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
|
|
|
@ -769,7 +769,7 @@ virTypedParamListStealParams(virTypedParamListPtr list,
|
|||
}
|
||||
|
||||
|
||||
static int ATTRIBUTE_FMT_PRINTF(2, 0)
|
||||
static int G_GNUC_PRINTF(2, 0)
|
||||
virTypedParamSetNameVPrintf(virTypedParameterPtr par,
|
||||
const char *fmt,
|
||||
va_list ap)
|
||||
|
|
|
@ -149,34 +149,34 @@ int virTypedParamListAddInt(virTypedParamListPtr list,
|
|||
int value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddUInt(virTypedParamListPtr list,
|
||||
unsigned int value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddLLong(virTypedParamListPtr list,
|
||||
long long value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddULLong(virTypedParamListPtr list,
|
||||
unsigned long long value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddString(virTypedParamListPtr list,
|
||||
const char *value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddBoolean(virTypedParamListPtr list,
|
||||
bool value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virTypedParamListAddDouble(virTypedParamListPtr list,
|
||||
double value,
|
||||
const char *namefmt,
|
||||
...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -81,7 +81,7 @@ testEventResultCallback(const void *opaque)
|
|||
}
|
||||
|
||||
static void
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4)
|
||||
G_GNUC_PRINTF(3, 4)
|
||||
testEventReport(const char *name, bool failed, const char *msg, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
|
|
|
@ -183,7 +183,7 @@ qemuMonitorTestAddInvalidCommandResponse(qemuMonitorTestPtr test,
|
|||
}
|
||||
|
||||
|
||||
int ATTRIBUTE_FMT_PRINTF(2, 3)
|
||||
int G_GNUC_PRINTF(2, 3)
|
||||
qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...)
|
||||
{
|
||||
va_list msgargs;
|
||||
|
|
|
@ -48,12 +48,12 @@ void virHostMsgSetQuiet(bool quietFlag);
|
|||
|
||||
void virHostMsgCheck(const char *prefix,
|
||||
const char *format,
|
||||
...) ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
void virHostMsgPass(void);
|
||||
void virHostMsgFail(virHostValidateLevel level,
|
||||
const char *format,
|
||||
...) ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
int virHostValidateDeviceExists(const char *hvname,
|
||||
const char *dev_name,
|
||||
|
|
10
tools/vsh.h
10
tools/vsh.h
|
@ -240,11 +240,11 @@ struct _vshCmdGrp {
|
|||
};
|
||||
|
||||
void vshError(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
void vshOpenLogFile(vshControl *ctl);
|
||||
void vshOutputLogFile(vshControl *ctl, int log_level, const char *format,
|
||||
va_list ap)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 0);
|
||||
G_GNUC_PRINTF(3, 0);
|
||||
void vshCloseLogFile(vshControl *ctl);
|
||||
|
||||
const char *vshCmddefGetInfo(const vshCmdDef *cmd, const char *info);
|
||||
|
@ -302,14 +302,14 @@ bool vshCommandArgvParse(vshControl *ctl, int nargs, char **argv);
|
|||
int vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout);
|
||||
|
||||
void vshPrint(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
void vshPrintExtra(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
bool vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set);
|
||||
bool vshInitReload(vshControl *ctl);
|
||||
void vshDeinit(vshControl *ctl);
|
||||
void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4);
|
||||
G_GNUC_PRINTF(3, 4);
|
||||
|
||||
/* User visible sort, so we want locale-specific case comparison. */
|
||||
#define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
|
||||
|
|
Loading…
Reference in New Issue