From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 39057A04B3; Mon, 10 Feb 2020 17:24:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9D59C1C021; Mon, 10 Feb 2020 17:21:38 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 529994C87 for ; Mon, 10 Feb 2020 17:21:36 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 01EAF21D73; Mon, 10 Feb 2020 11:21:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 11:21:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=Q2g+djKXUZ bERl3dAtq4GMb3G97h1O3otWm2QhX8XoE=; b=GQA497DtqRsYl6bDZ9rrMb7Gjn eWD/a6mvduaDdIoifKO0NrC5+IP95j79YPEwp46N6CJO7HItv9i3AsKtsbtuR/z3 TI3fjYVvVP7faNTyUNgesdlSv6EZk/rTftEyoVXmQFADY9S1UShqZlaHmqNPPUfE 7Ymlx8sN/VC8HMomU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=Q2g+djKXUZbERl3dAtq4GMb3G97h1O3otWm2QhX8XoE=; b=WQGV7BB1 vhGlMsc5rKbSnQge8Bh7GlNlGEeW39QKnoezGgpaAexKoOkFx2oHJRjV/py+6lPH Obzi3DMxim5/muT40vwvSVTt95jv1OwVP0XaoH+ImL8M3UGiTyH0u8paoK7pADAc u9XM1dVAq3ixXZYWjMmzB3WGmJgj/OAcY43UsgGsC3VWzh8qMcS4dbMKl9d/lKVE XzCqQMPM9Sw3rZkpNpMZkoK9tMkOGL8MRXU6ZiTWGZ7Ef3tp7mXoeHkl+Vi59F7c CtDLXbPkkUMtsw7yhxbsJDcbYPMlJlveYPSih0Q21Ht6h4AcV8JltbnRjUsabik3 0wl4UvkPnO1n8Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedugdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepuddunecurfgr rhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 33C2B328005D; Mon, 10 Feb 2020 11:21:35 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: Olivier Matz Date: Mon, 10 Feb 2020 17:20:31 +0100 Message-Id: <20200210162032.1177478-15-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210162032.1177478-1-thomas@monjalon.net> References: <20200210162032.1177478-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 20.05 14/15] replace printf format attributes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The new macro __rte_format_printf, for compiler hinting, is now used where appropriate for consistency. Signed-off-by: Thomas Monjalon --- lib/librte_cmdline/cmdline.h | 3 ++- lib/librte_eal/common/include/rte_common.h | 8 +++++++- lib/librte_eal/common/include/rte_debug.h | 2 +- lib/librte_eal/common/include/rte_devargs.h | 2 +- lib/librte_eal/common/include/rte_log.h | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h index 27d2effdf7..190fc3d165 100644 --- a/lib/librte_cmdline/cmdline.h +++ b/lib/librte_cmdline/cmdline.h @@ -8,6 +8,7 @@ #define _CMDLINE_H_ #include +#include #include #include @@ -34,7 +35,7 @@ struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_ void cmdline_set_prompt(struct cmdline *cl, const char *prompt); void cmdline_free(struct cmdline *cl); void cmdline_printf(const struct cmdline *cl, const char *fmt, ...) - __attribute__((format(printf,2,3))); + __rte_format_printf(2, 3); int cmdline_in(struct cmdline *cl, const char *buf, int size); int cmdline_write_char(struct rdline *rdl, char c); diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 575183e944..3e14ffc136 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -94,6 +94,12 @@ typedef uint16_t unaligned_uint16_t; */ #define RTE_SET_USED(x) (void)(x) +/** + * Hint type checking for printf-style arguments. + */ +#define __rte_format_printf(fmt_idx, args_idx) \ + __attribute__((format(printf, fmt_idx, args_idx))) + #define RTE_PRIORITY_LOG 101 #define RTE_PRIORITY_BUS 110 #define RTE_PRIORITY_CLASS 120 @@ -803,7 +809,7 @@ rte_str_to_size(const char *str) */ __rte_noreturn void rte_exit(int exit_code, const char *format, ...) - __attribute__((format(printf, 2, 3))); + __rte_format_printf(2, 3); #ifdef __cplusplus } diff --git a/lib/librte_eal/common/include/rte_debug.h b/lib/librte_eal/common/include/rte_debug.h index eb06c835f7..50052c5a90 100644 --- a/lib/librte_eal/common/include/rte_debug.h +++ b/lib/librte_eal/common/include/rte_debug.h @@ -73,7 +73,7 @@ void __rte_panic(const char *funcname , const char *format, ...) #endif #endif __rte_noreturn - __attribute__((format(printf, 2, 3))); + __rte_format_printf(2, 3); #ifdef __cplusplus } diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 882dfa0abd..898efa0d66 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -137,7 +137,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev); int rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) -__attribute__((format(printf, 2, 0))); +__rte_format_printf(2, 0); /** * Insert an rte_devargs in the global list. diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index f2a5bc18ea..f292444966 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -282,7 +282,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) __rte_cold #endif #endif - __attribute__((format(printf, 3, 4))); + __rte_format_printf(3, 4); /** * Generates a log message. @@ -311,7 +311,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) * - Negative on error. */ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) - __attribute__((format(printf,3,0))); + __rte_format_printf(3, 0); /** * Generates a log message. -- 2.25.0