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 D16FDA056D; Thu, 12 Mar 2020 23:33:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EACF22BE6; Thu, 12 Mar 2020 23:33:58 +0100 (CET) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id BE9DB2BAA for ; Thu, 12 Mar 2020 23:33:57 +0100 (CET) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id AE33F52A; Thu, 12 Mar 2020 18:33:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 12 Mar 2020 18:33:56 -0400 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:content-type; s=mesmtp; bh=iSlOxR0e+Hd6uxOyX0XLeMlJGdnlIDzyxGVOmPvRoCk=; b=cRWBNRc7tUJn pkzyGGvy/NjLN4nM/c+3hkQyq7RBzEM1t0j6wcOi7IPz2odEI7UUCRvI5G/BAaSH Yf90fsiXLl5wL5owGZWH48/q9VL7do1146Qov3Zt4kjKf2Qj8QqZbZ73G8zjtKae r8JS9KC+aSP1n1XWqh4PKbCUhaUHB10= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=iSlOxR0e+Hd6uxOyX0XLeMlJGdnlIDzyxGVOmPvRo Ck=; b=ULPJ87w+4z03SAkSTK8aJ7jd+0zdd5HZqLuTq1PPJUjZTBKiBmeA+aLvd FxjwBopVykFD9mrR230/JASrxa8+bR7skLEgcYvAk6PTRFcVF9Tbbh+vCgBbYwbx NZ6VmZeUxR0Pg0NFPbLGMSuJw9aGX+ZLiwbdEhVnG85h8g2SaBwHKzOLph9hGr0k JTCbyRGjC8+Cr216p3F8LvHR1aZet8vFSGUCn0YyJp17EpTV1KpHOEriDvx3qqtq U43FA5uYSodGmD3Wx4E11Qf+GNZGOh8GMBqdpTR/2u5FZFBTOs9eUJdt1ObKwEX6 6zW7y4EofyK9d5HzxuVJE6vfR71GA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddvhedgudeigecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc fkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 2A59A3280059; Thu, 12 Mar 2020 18:33:54 -0400 (EDT) From: Thomas Monjalon To: Dmitry Kozlyuk Cc: dev@dpdk.org, Olivier Matz Date: Thu, 12 Mar 2020 23:33:52 +0100 Message-ID: <3094952.KgjxqYA5nG@xps> In-Reply-To: <20200227042537.187459-2-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-2-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v4 1/7] eal: introduce portable format attribute 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" 27/02/2020 05:25, Dmitry Kozlyuk: > When using __attribute__((format(...)) on functions, GCC on Windows > assumes MS-specific format string by default, even if the underlying > stdio implementation is ANSI-compliant (either MS Unicersal CRT > or MinGW implementation). Wrap attribute into a macro that forces > GNU-specific format string when using GCC. > > Use this new attribute for logging and panic messages in EAL > and for output strings in cmdline library. > > Signed-off-by: Dmitry Kozlyuk > --- > +/** > + * Check format string and its arguments at compile-time. > + * > + * GCC on Windows assumes MS-specific format string by default, > + * even if the underlying stdio implementation is ANSI-compliant, > + * so this must be overridden. > + */ > +#if defined(RTE_TOOLCHAIN_GCC) > +#define __rte_format_printf(format_index, first_arg) \ > + __attribute__((format(gnu_printf, format_index, first_arg))) > +#else > +#define __rte_format_printf(format_index, first_arg) \ > + __attribute__((format(printf, format_index, first_arg))) > +#endif It does not work when compiling pmdinfogen with clang and drivers with gcc. I suggest this change (I can send a patch fixing the issue in other .h files): +/* + * RTE_TOOLCHAIN_GCC is true if the target is built with GCC, + * while a host application (like pmdinfogen) may have another compiler. + * RTE_CC_IS_GNU is true if the file is compiled with GCC, + * no matter it is a target or host application. + */ +#if defined __GNUC__ && !defined __clang__ && !defined __INTEL_COMPILER +#define RTE_CC_IS_GNU +#endif + +#ifdef RTE_CC_IS_GNU -/** Define GCC_VERSION **/ -#ifdef RTE_TOOLCHAIN_GCC #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + \ __GNUC_PATCHLEVEL__) #endif @@ -96,7 +105,7 @@ typedef uint16_t unaligned_uint16_t; * even if the underlying stdio implementation is ANSI-compliant, * so this must be overridden. */ -#if defined(RTE_TOOLCHAIN_GCC) +#ifdef RTE_CC_IS_GNU #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(gnu_printf, format_index, first_arg))) #else