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 F420CA2EDB for ; Wed, 2 Oct 2019 08:15:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E31C1B9A9; Wed, 2 Oct 2019 08:15:10 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130054.outbound.protection.outlook.com [40.107.13.54]) by dpdk.org (Postfix) with ESMTP id 464F62AB for ; Wed, 2 Oct 2019 08:15:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SiDYOcqSs7J6OeSIZdB99N4WpWjjl3aRiuk13u99wK2L/BrWp/U0FDJSZp9E4LUsN5ZbzPf4Qg+GUQN6oKlyBb6esGqphCHlou8rYdIL5yYsRiM6QI6xn9RKz/NUs1LLiE51z/B4s1b8MKizkI2KSb/Nxbk9UV3ktkIUBLcspuxkJT4OxcXy0MdfgEailU1vxt5YHITONHv+VayXpl6at/bbO/VbNkIS0XCyQ22NLXuGZNB5XTGoWiraLiLBsLw5phoSgwypstgCv2RTwWNrz7K5aDqy/5O7f0xzmBIuSzBKuJNQAtushQhy1WjNxcBi4llwhXFXRK/vViGHFy69rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z69xzM3QiopSaUXiahlQLE62xpKanNaMvYVjBhw/xxY=; b=aeHj/2aOgBl+Zoi8lRzrgQ2SumptoBzIgWo4spQCU7m8FCdvGQKVifMD7GvI94hhl95QEifmCjf+Tf6doo0UDge1RQMtG1g3YnaIvp4XIi4XJmEPORrkNFotKJWvqzoVVl5NewTcNbVn51z1AuIWe/81xSYuBI5nFnxsrUJkhTRsp9U72It/flIwxzmOcrMXi3bH2pCvF2UFb3UManAYobG2LKmTbDJOFA/18FMK99Tk3odxLAIDz+q2EJMWMKE7IW7QpOtUuqhWAYj+ckxPdn0vP6gTJpxJnQa5cOgkv5kw3RpOJ15M9R4Yg+Wvd6TlLHFnfhoHapfVYBKScWpvLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z69xzM3QiopSaUXiahlQLE62xpKanNaMvYVjBhw/xxY=; b=pTvjlQ4uFeaEsPegnMqhWO1EFfx+esH2Qsi/H9AewyKbyN+rdiPa7454JTmKj0PN93dLBcD3kIMZmYl+pSE9XHIcyituRyFxD9aqgWSoh6wcGpZleWXULc5d1bwY1dVUBxM1v098xNb65Xf3Y7MFvUTLtjLy0ijzHdYMVtZ1fY0= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3505.eurprd05.prod.outlook.com (10.171.188.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Wed, 2 Oct 2019 06:15:07 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da9:65ba:1323:a39b]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da9:65ba:1323:a39b%7]) with mapi id 15.20.2305.023; Wed, 2 Oct 2019 06:15:07 +0000 From: Slava Ovsiienko To: Stephen Hemminger CC: "dev@dpdk.org" , Matan Azrad , Raslan Darawsheh , "ferruh.yigit@intel.com" Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue with gcc pragma Thread-Index: AQHVeEjcdOYFzbZfI0ObYflWiKnW/KdF366AgAACLGCAAJD/gIAAU67g Date: Wed, 2 Oct 2019 06:15:07 +0000 Message-ID: References: <1569928223-6600-1-git-send-email-viacheslavo@mellanox.com> <20191001075429.70a08442@hermes.lan> <20191001164113.0ad0bec6@hermes.lan> In-Reply-To: <20191001164113.0ad0bec6@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2c8e4630-cd40-4aa7-0707-08d746ffdf79 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: AM4PR05MB3505:|AM4PR05MB3505: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0178184651 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(346002)(376002)(396003)(199004)(189003)(13464003)(8936002)(86362001)(25786009)(3846002)(6116002)(4326008)(7736002)(5660300002)(305945005)(8676002)(81166006)(66066001)(52536014)(186003)(6916009)(81156014)(74316002)(2906002)(55016002)(316002)(476003)(33656002)(64756008)(11346002)(66556008)(446003)(229853002)(76116006)(478600001)(6246003)(256004)(66476007)(54906003)(9686003)(66946007)(6506007)(14444005)(26005)(53546011)(102836004)(99286004)(7696005)(66446008)(486006)(6306002)(71200400001)(966005)(6436002)(14454004)(76176011)(71190400001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3505; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: l2ox3t0HUaVHvyZRKyxZYN5ohUOKTBH6OujcHPqBFEjvhVdy0uZ8KTpTU8O3qKxQwvFnoElc+jnfV2JrCgtqAklkQZoSyLwTdRdEy7rcx2febPbGQhz1iChDk/Huazm+8kQ4Cpj1gnFqQ/svVva4mlo3s1f0eUBZH+u4RC5+PU7O1w+z6+m47qm9E5Hx25a/KugGhLLbp2m11rJ+P7ePSAyIIIGYXx3kv1unQNW8jr4o6WtTzvMkgHdIK/2E48UVrEojNeWZO6rzDOd1G+EfVpduwf3bG78hVy7ylMa50c1CwbqyWCyYLZZrBhxcOYfq0gLFxvikGLjgZKOe6Zf56548dW96pu1z5ebj11klvdlHTkZ1cz3coXZP6XOnkbv3fgaeBNcpnbwTuHfzueqbLqow8XSJGATwbNH7CzobJLng761BbCfZmpi6Zk0q4s6FjpE1c/U7kcuvg4xxnOFW4w== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c8e4630-cd40-4aa7-0707-08d746ffdf79 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Oct 2019 06:15:07.4011 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PT1SXk8YaIylgMvNNCGJKWMx5GL/YWDE0U2eLFnB2ZjZFTPjCSdUGcy6hP2cRg+uDBBC15t6xeVxzdUbNjCK0TRtY03MGKwZV+Db+928gPc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3505 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" > -----Original Message----- > From: Stephen Hemminger > Sent: Wednesday, October 2, 2019 2:41 > 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 >=20 > On Tue, 1 Oct 2019 17:15:46 +0000 > Slava Ovsiienko wrote: >=20 > > > -----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 >=3D 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) =3D=3D 1) { -#pragma GCC > > > > diagnostic error "-Wformat-nonliteral" > > > > +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >=3D 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 > > > > >=20 > You are going to a lot of effort to solve a problem of interface name len= gth > which can not happen. The maximum interface name in linux and bsd is > always 15 characters plus null. We just have a definition IF_NAMESIZE. If we have the definition - we shoul= d follow, right? > Therefore there is no need to build a dynamic format > string at all here. Or you could use the assignment allocation modifier s= o that > the resulting string from fscanf was allocated. The allocation modifier has questionable compatibility either, does involve implicit memory allocations and requires explicit free call. It seems to be less robust than using a standard length modifier. >=20 > Could you try one of these instead. It seems there is better solution - stringification, please see: http://patches.dpdk.org/patch/60415/ I like stringification not too much, but it seems there is the right place = to use one. WBR, Slava =20