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 2597DA2EDB for ; Wed, 2 Oct 2019 01:41:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E336E1BE89; Wed, 2 Oct 2019 01:41:45 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id 96AAC1BE86 for ; Wed, 2 Oct 2019 01:41:43 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id d22so6324625pls.0 for ; Tue, 01 Oct 2019 16:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ahGWAoJX+O4OYAae7CsaWdGHProUUTcd0l2rVF2ZnmU=; b=jzfQ2GAceReEATGS1nxSAuhYeuLv3jVONc2CuMWVMWfSoQ6I6fdmyQPwGqPyI1nRi0 Omm2x8s1zZ/vVEkBrqUHbmBht5ZIIi8QbNAjOHXWC7k7F0EvAc9Rfdn2Flq97DVzcDp0 2yQtDEzm+RJA3NfPNCjQbHpTN6ZC9aMCSUbekAimNG7lIXUl+tzCncnU92/SL/U7BJIM GRlsq8YhRolw9nHs7br426Q8WfHB19SifFGxeZwqTALwAEBcks4uXq7DF2nN1uOmYkU7 Pfzwc5krUMY08fmPFkfuWdv7SvVzAF8OIktJ0FdhmOmI+vpYZBjrG6+2wOPhJlQh+3pJ DIfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ahGWAoJX+O4OYAae7CsaWdGHProUUTcd0l2rVF2ZnmU=; b=GggYyWD7Aa+Z2XBtuDo9bclJRBLp9eZypSYsSShYBQt0GOxqCqcBXfl3GLVySoPmSo rg1hSMYiVhEog+Wh6qX3Bgsw7NDDAcJatRusNoZMMxxgWK14eSmfnxz6yNV4jSDQtSeH U/B4DQ7PPJqJ1TyHMuyDVyMtZF9Q9yA2Ytnz6EsmgvVsoekl4WakDZ8SqHSzlY66c/8A 5zekCTSLqpnFPXlgj5KOEDgLPJXZ67kpb7upulsD22UXZWe5jtDnX/DEyu/pd3ivhRvY uVYKxk9oe1xqTI1WtqHmVz88Q1APuXX5jNKBOXZK6KWcwvFlaBQRSOm0DZ0SaRSKm8hw iJow== X-Gm-Message-State: APjAAAW4luH1hsCzAPCtWGJT78TkokC/pCna/AlTjGPeOEQdBYCAoFZ8 6ry7PExb3QQ/omrPDuB429mM1g== X-Google-Smtp-Source: APXvYqyymvAh5AdDzKCJ8UhoSdMfg832oT378NIhiwviVQZornvr6QoJzw32qzXrmGBJEUx2YeiH3g== X-Received: by 2002:a17:902:d88d:: with SMTP id b13mr382681plz.271.1569973302492; Tue, 01 Oct 2019 16:41:42 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id s141sm22245223pfs.13.2019.10.01.16.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 16:41:42 -0700 (PDT) Date: Tue, 1 Oct 2019 16:41:13 -0700 From: Stephen Hemminger To: Slava Ovsiienko Cc: "dev@dpdk.org" , Matan Azrad , Raslan Darawsheh , "ferruh.yigit@intel.com" Message-ID: <20191001164113.0ad0bec6@hermes.lan> In-Reply-To: References: <1569928223-6600-1-git-send-email-viacheslavo@mellanox.com> <20191001075429.70a08442@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue with gcc pragma 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" On Tue, 1 Oct 2019 17:15:46 +0000 Slava Ovsiienko wrote: > > -----Original Message----- > > From: Stephen Hemminger > > Sent: Tuesday, October 1, 2019 17:54 > > To: Slava Ovsiienko > > Cc: dev@dpdk.org; Matan Azrad ; Raslan > > Darawsheh ; ferruh.yigit@intel.com > > Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue with gcc > > pragma > > > > On Tue, 1 Oct 2019 11:10:23 +0000 > > Viacheslav Ovsiienko wrote: > > > > > +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 40600) > > #pragma GCC > > > +diagnostic push > > > #pragma GCC diagnostic ignored "-Wformat-nonliteral" > > > +#endif > > > + /* Use safe format to check maximal buffer length. */ > > > while (fscanf(file, format, ifname) == 1) { -#pragma GCC diagnostic > > > error "-Wformat-nonliteral" > > > +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 40600) > > #pragma GCC > > > +diagnostic pop #endif > > > > This is messy, is there not a better way to do this? > > At least I did not find one. > > The GCC compile-time format checking feature is nice in general and it worth > to be engaged. The legitimate fscanf() usage with variable format parameter > causes GCC to emit error/warning, so we should suppress these ones for this > single line. ICC does not emit warning and does not recognize GCC pragmas. > Clang just does not recognize fscanf(). > > Should we use "#ifndef __INTEL_COMPILER" (typical workaround for > GCC diagnostic pragma in DPDK)? I'm not sure, It is not completely correct. > > The alternative I see is to implement dedicated routine to read words from the file, > but it means more code and more run-time resources. It seems not to be > the right way to push compile-time issues resolving to the run-time. > > Defining the macro is not relevant here because this is a single case. > > WBR, Slava > > You are going to a lot of effort to solve a problem of interface name length which can not happen. The maximum interface name in linux and bsd is always 15 characters plus null. Therefore there is no need to build a dynamic format string at all here. Or you could use the assignment allocation modifier so that the resulting string from fscanf was allocated. Could you try one of these instead.