Signed-off-by: Ján Tomko <jto...@redhat.com> --- build-aux/syntax-check.mk | 2 +- src/internal.h | 20 -------------------- src/libxl/libxl_logger.c | 2 +- src/qemu/qemu_domain.h | 4 ++-- src/util/viraudit.h | 2 +- src/util/virbuffer.h | 4 ++-- src/util/vircommand.h | 4 ++-- src/util/virerror.h | 8 ++++---- src/util/virfile.h | 12 ++++++------ src/util/virfirewall.h | 2 +- src/util/virlog.h | 4 ++-- src/util/virstring.h | 4 ++-- src/util/virtypedparam.c | 2 +- src/util/virtypedparam.h | 14 +++++++------- tests/eventtest.c | 2 +- tests/qemumonitortestutils.c | 2 +- tools/virt-host-validate-common.h | 4 ++-- tools/vsh.h | 10 +++++----- 18 files changed, 41 insertions(+), 61 deletions(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index c8ca6279a2..cfcc339c95 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -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) diff --git a/src/internal.h b/src/internal.h index e2e27342d7..0825e63993 100644 --- a/src/internal.h +++ b/src/internal.h @@ -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 * diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c index b4a38ae865..87ad793fb5 100644 --- a/src/libxl/libxl_logger.c +++ b/src/libxl/libxl_logger.c @@ -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, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9174631ad2..d703417862 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -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); diff --git a/src/util/viraudit.h b/src/util/viraudit.h index 51e152ad1e..a36cc77ca6 100644 --- a/src/util/viraudit.h +++ b/src/util/viraudit.h @@ -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); diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h index 75e26c32ff..1c9748643e 100644 --- a/src/util/virbuffer.h +++ b/src/util/virbuffer.h @@ -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); diff --git a/src/util/vircommand.h b/src/util/vircommand.h index 10961a328f..ed04eb4bd3 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -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, diff --git a/src/util/virerror.h b/src/util/virerror.h index 201195d660..e3a08982b3 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -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); diff --git a/src/util/virfile.h b/src/util/virfile.h index 555e6ebee7..a60b2bef9a 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -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); diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h index a2c0e9c26d..56e78a0672 100644 --- a/src/util/virfirewall.h +++ b/src/util/virfirewall.h @@ -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, diff --git a/src/util/virlog.h b/src/util/virlog.h index b4feb5b1b9..9d9461f339 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -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, diff --git a/src/util/virstring.h b/src/util/virstring.h index a7ef9a36a7..f5e2302b8b 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -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; /** diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 7b3fcd118e..a9dfa85be2 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -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) diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h index 0e39a19120..b35f1f93ef 100644 --- a/src/util/virtypedparam.h +++ b/src/util/virtypedparam.h @@ -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; diff --git a/tests/eventtest.c b/tests/eventtest.c index d64854ecc6..363fc776fd 100644 --- a/tests/eventtest.c +++ b/tests/eventtest.c @@ -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; diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 64e73dcf01..4dd7328028 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -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; diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h index c4e4fa2175..1b7e93e520 100644 --- a/tools/virt-host-validate-common.h +++ b/tools/virt-host-validate-common.h @@ -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, diff --git a/tools/vsh.h b/tools/vsh.h index 947904f6c0..99977af7e3 100644 --- a/tools/vsh.h +++ b/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) -- 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list