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 E1357A2EDB for ; Wed, 2 Oct 2019 08:55:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98B817CBC; Wed, 2 Oct 2019 08:55:25 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140087.outbound.protection.outlook.com [40.107.14.87]) by dpdk.org (Postfix) with ESMTP id 4D1455B3C for ; Wed, 2 Oct 2019 08:55:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fN8MjhIzcB646DAs74LpweZimyetaz6kG/D8anysapaL2voqsx1S9VPSV5ndmb6a6O4OcCznookG+tetvHUF8pCpNPiQ9CtPWTviFKXRCo1Tjs+KkUIu/WvXswuhNSj1XcGpVRRMQCvFNA8OaII6qxciSo2phFm8OErwfn11IA4jfkE4sl8DFnwVi9LRU5YKIvKiZyLvOmEcKez14vrHuoEPqi9EyB0eQHqneG/htUZFwpqp6NHz5Fn5aCAkTcgu+qIAV7a1Xy1HXMyYEnmW1p6l4LGyj/gYqnXGsA6hm8R4i16hIX93vNaGVp0NJKDSqF0sQm0bkrS107/ZoG9ZrQ== 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=CvrplYM5rqgNZwga1HHDMpHuc0A05uPs1EQ0dMISwec=; b=cRImngRINB65YtmNzKt7n2qMXB/dZxEb7uKFKBoU5MZBAecD3qVMNAlSZmHkK00zKS5li2rkqGLMUzFjG6o0noQ9/4B5bUrzYXxlDuYzf8BtVx9lJuje+OQTa6wv7yYRei9TXURM9K5qNOuGxAR7C9OI0A7Kr2jd9E7FZMZvDFQztGdMtrfVKTmYqUoUzw3vKKATbArshvv9Quys23ZsqgxP4um3vWy5+/rDVIakBKrY6e1Bh1gz4lHkiw8rXh7bWdqeMmeiMtmODxjkOQiy0KC6J1XQuRRqZyVf+dq3SoW61VSsCLIV8GTBvyPtFpBrIvSsvnveCKkd/8qdDVtWmA== 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=CvrplYM5rqgNZwga1HHDMpHuc0A05uPs1EQ0dMISwec=; b=CDx5k/nH/MKstdat8dklGNgpeHPXjeGUvv1dNBW/o32OjvQ2XpSY+7fv5f9jZQOe73d6aS7KD0ufOmOzo7g5TemZzD4RwGrg/HWyq4LsQBmGEbHQT3FYJC2sw6NvM+IHSPxslfZMKTXco/eSrG8ySaOekj91GgiKI5jzKJJ/Rb4= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3313.eurprd05.prod.outlook.com (10.171.189.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Wed, 2 Oct 2019 06:55:22 +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:55:22 +0000 From: Slava Ovsiienko To: Slava Ovsiienko , 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/gIAAU67ggAAk4dA= Date: Wed, 2 Oct 2019 06:55:21 +0000 Message-ID: References: <1569928223-6600-1-git-send-email-viacheslavo@mellanox.com> <20191001075429.70a08442@hermes.lan> <20191001164113.0ad0bec6@hermes.lan> In-Reply-To: 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: b3be8a04-a144-4753-c10d-08d747057ed9 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: AM4PR05MB3313:|AM4PR05MB3313: 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)(376002)(136003)(39860400002)(396003)(366004)(346002)(189003)(199004)(13464003)(71190400001)(76116006)(305945005)(26005)(966005)(52536014)(74316002)(102836004)(3846002)(256004)(7736002)(71200400001)(6436002)(6116002)(81156014)(8676002)(81166006)(86362001)(66946007)(7696005)(66476007)(45080400002)(64756008)(33656002)(11346002)(14454004)(446003)(76176011)(66556008)(2940100002)(229853002)(478600001)(99286004)(476003)(66446008)(8936002)(9686003)(53546011)(25786009)(6506007)(6306002)(2906002)(316002)(4326008)(486006)(6246003)(14444005)(55016002)(5660300002)(54906003)(186003)(110136005)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3313; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: FRhyyk+cIRDxIA7/gZqQ8ZH9XP+ATegQyL1qooYsMxHgIqAba3OyXfJHYlGhSAqPsjlP9WhqA3imvy0f9zTZgLQ5oMICL7WGGiKsW6miLsoc6NbbOkQI3s+Hv6wNiB4kft3gv2HgRhnaM/UAqPq++Kr/68vMCvORD92KuCmneWs6rCZLaxxgtQsWL7dWvC4dDyBzS69oCaBk6vsAs3jyWE5xo/qWI/Vsnz1vMsI8n+eBdwZaUJLUTyNdceAy2Q/7wkKeK6SeUn3p9+OXgDKVy6OhLwco+b4YCf8PGlHDxvQzG/t53xyLex5bFB0mQeCjGIiCYTWla1JeqCYxeOGunt3ZopX22w6hmhehWRoEKxlyU0WLzI60xDFnWnUQsg9mn1zV78BS+OQzrx8nNDc3q30+J3ug/Qled6D8vRXV41o= 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: b3be8a04-a144-4753-c10d-08d747057ed9 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Oct 2019 06:55:22.1704 (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: LMDiR4VlF7p+ZwqKNhBHXbfMQWcP9Dy4ZILJDI2LCgQiEJVbQgbBTKphyCisPx4lclvvlU4yae8DNIlvKA3kZY6ULBJ+Hd6lM0Z4/O2oqLg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3313 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: dev On Behalf Of Slava Ovsiienko > Sent: Wednesday, October 2, 2019 9:15 > To: Stephen Hemminger > 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 > > -----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 > > > > 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 >=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 correc= t. > > > > > > 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. >=20 > We just have a definition IF_NAMESIZE. If we have the definition - we sho= uld > follow, right? >=20 > > 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. >=20 > The allocation modifier has questionable compatibility either, does invol= ve > 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: > https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fpatche > s.dpdk.org%2Fpatch%2F60415%2F&data=3D02%7C01%7Cviacheslavo%40 > mellanox.com%7Cfad3629b2e694dde62f908d746ffe45a%7Ca652971c7d2e4 > d9ba6a4d149256f461b%7C0%7C0%7C637055937198169033&sdata=3Dvx > EXTvYh12PJdU9ZmlqAzIThILKmAG23r4OyKE0DBvU%3D&reserved=3D0 > I like stringification not too much, but it seems there is the right plac= e to use > one. Also, I would add something like this: assert(atol(STRINGIFY(IF_NAMESIZE)) =3D=3D IF_NAMESIZE); to make sure IF_NAMESIZE is not defined like as "BASESIZE+1". What do you think ? WBR, Slava