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 A6B9FA04F1; Wed, 11 Dec 2019 07:49:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0930634EF; Wed, 11 Dec 2019 07:49:28 +0100 (CET) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30058.outbound.protection.outlook.com [40.107.3.58]) by dpdk.org (Postfix) with ESMTP id 18D582C6A; Wed, 11 Dec 2019 07:49:27 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dyDcAioJaZ1KDLVO6+dfiWv1659VfdsSlMer5CBazGq2VzEoAk7S54LXc5zY6DvFOD/umRaVG1Ky5PSaXPDljAggVIrUWhWWwHKLqKy1WnbOJGfRuXOwwDYcmc/vZqrzksGlaCC6gQN73OWb+lmWCai7ORnH7PdkcfYcNTuorfqykY7iu/Lilse2WZc+7P/7hE2j2Ro5fo09cFP+SSuhGBqTUcU0L3acMoZ0pENR/utHmV9dT9bI9NqGX9DcjoZqO/B5eE50d65WI/3u/ZYY4kZbhJsCLbXkIy1giCNgT6IEyaKvOJDWX3znmVWGArsA/pn3KAWAnhnEBpxabMn1EA== 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=Jp1v2MLWnWMNkwldarFol13GYt+fmFyGZRXTnlrPlBw=; b=gHbCg2b/u2HZWhPsJlPsovNRfntL9VkLzrrSHTUS48vNK893Rw6UtWVnyyTBEQ4eR2s4qRECs+GsF3H6v+ZwMP1sSwUglhUfxKMdMXUpaQa6L3ZIaIIFXzdlz30h+LirQiKY6jwoWlJ/A+CEpvvgMrVEgNYLiBD/TbOvaqcaFodUBmKwXfXQx6xpkML9QCxbxj62KN7J8wB5CA1UwvnUdx37tEfinDaDgHf2AAStCQ5OGZMiodiaDpNbltePGDMxJPnvv1VHTPK1wyQ3DA+UWeqOYB4GDdAADyhFw1p8d7mrtP9RyHKRCkVbXxUY4KuNBgPth39h/JXBlMwtvGegTg== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jp1v2MLWnWMNkwldarFol13GYt+fmFyGZRXTnlrPlBw=; b=oQKFQGUxR1OjpPGR2TVNvOwbXaIINcufs8V3q2tnRM7dw9rwqZN2Vkap95kvEdsh1CR+nXU1z1ExjodneWAehGIZ9h4ivamU6VArPxCLNNotZM+dHocTyChDuidyNV6OhtBzA140vmd+UraQBFzwPvdpwiAyE1axBQ/tEI8cgHQ= Received: from AM0PR05MB4401.eurprd05.prod.outlook.com (52.134.124.20) by AM0PR05MB5700.eurprd05.prod.outlook.com (20.178.115.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.13; Wed, 11 Dec 2019 06:49:26 +0000 Received: from AM0PR05MB4401.eurprd05.prod.outlook.com ([fe80::d5e8:d078:e580:ffd7]) by AM0PR05MB4401.eurprd05.prod.outlook.com ([fe80::d5e8:d078:e580:ffd7%6]) with mapi id 15.20.2538.012; Wed, 11 Dec 2019 06:49:25 +0000 From: Ali Alnubani To: "dev@dpdk.org" CC: Adrien Mazarguil , "stable@dpdk.org" , Matan Azrad Thread-Topic: [PATCH] net/mlx: fix variadic macro Thread-Index: AQHVr+8g+qEQ37YusEWCyWtQDQ549g== Date: Wed, 11 Dec 2019 06:49:25 +0000 Message-ID: <20191211064826.16314-1-alialnu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.0 x-clientproxiedby: LO2P265CA0374.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::26) To AM0PR05MB4401.eurprd05.prod.outlook.com (2603:10a6:208:62::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 830326a8-ea9f-49ed-4ef2-08d77e064305 x-ms-traffictypediagnostic: AM0PR05MB5700:|AM0PR05MB5700: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1303; x-forefront-prvs: 024847EE92 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(396003)(39860400002)(376002)(366004)(199004)(189003)(8936002)(81156014)(52116002)(316002)(4326008)(86362001)(6512007)(186003)(6506007)(2906002)(8676002)(107886003)(2616005)(5660300002)(1076003)(6916009)(6486002)(64756008)(66446008)(26005)(66476007)(81166006)(66556008)(54906003)(478600001)(71200400001)(66946007)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB5700; H:AM0PR05MB4401.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: gUESTMP95Pjs1HEzUmjvZ2HOuQoyd/55/6NYlyljHuhw1HgO/5FScttu3RhN979pnHmXo+WiDJQ0ILUIEtM2VTzyqPFkXchNHtc+tfiXqk0KZ8uGC91AGy3xQ/ZINe+YCX+XJ8tuOZAV800LoLh1zhdOcSU1MR+iPLQ84Pl1QcOnmU5LI9Xak7/xUdrmNLRev57gxEeosgBGlon2Y06rgmtZnWpOI8K81UqXqX3iMK9uVNdRnuatnV+8CNUcgb+T1UFLm4OoicdsgqSgBXy1iTkvczzylqiVowSz+3dFdj1Ba77xpaTI5TwR/7zOo/3OrgY1quydJTMgFK72EogX6zAbrdz6lbA6Qh6zbSDq5eAYTLSBIjunRP3b8ekr9vVWMDc5hhI7haWbM3ENKesmv/zeJ69uYNCqokqQwOzM5+1Rl5J53WXidn2kuCUCQwTm Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 830326a8-ea9f-49ed-4ef2-08d77e064305 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2019 06:49:25.7948 (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: uONEqHKVv+seAsfy2Gz9EyY6am14SdEGSmVt3fUs0+HVQNaZIu+2OEG+UHPc5JAtaoF7Qzp5/9nrQQ+MFiinlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5700 Subject: [dpdk-dev] [PATCH] net/mlx: fix variadic macro 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" This rewrites the MKSTR macro appending an empty string to its arguments to resolve build failures similar to: drivers/net/mlx4/mlx4.c:461:14: fatal error: format string is not a string literal [-Wformat-nonliteral] MKSTR(path, "%s/device/uevent", device->ibdev_path); drivers/net/mlx4/mlx4_utils.h:82:30: note: expanded from macro 'MKSTR' char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ drivers/net/mlx5/mlx5_stats.c:144:15: fatal error: format string is not a string literal [-Wformat-nonliteral] MKSTR(path, "%s/ports/%d/hw_counters/%s", drivers/net/mlx5/mlx5_utils.h:149:30: note: expanded from macro 'MKSTR' char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ The errors reproduce with clang version 9.0.0, and the release notes don't mention what could have caused them. Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 ad= apters") Cc: adrien.mazarguil@6wind.com Cc: stable@dpdk.org Signed-off-by: Ali Alnubani Signed-off-by: Matan Azrad --- drivers/net/mlx4/mlx4_utils.h | 5 +++-- drivers/net/mlx5/mlx5_utils.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h index 74b9d2ecd..5718b9c74 100644 --- a/drivers/net/mlx4/mlx4_utils.h +++ b/drivers/net/mlx4/mlx4_utils.h @@ -79,9 +79,10 @@ pmd_drv_log_basename(const char *s) =20 /** Allocate a buffer on the stack and fill it with a printf format string= . */ #define MKSTR(name, ...) \ - char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ + int mkstr_size_##name =3D snprintf(NULL, 0, "" __VA_ARGS__); \ + char name[mkstr_size_##name + 1]; \ \ - snprintf(name, sizeof(name), __VA_ARGS__) + snprintf(name, sizeof(name), "" __VA_ARGS__) =20 /** Generate a string out of the provided arguments. */ #define MLX4_STR(...) # __VA_ARGS__ diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h index b4ed8c6da..ebf79b80a 100644 --- a/drivers/net/mlx5/mlx5_utils.h +++ b/drivers/net/mlx5/mlx5_utils.h @@ -146,9 +146,10 @@ extern int mlx5_logtype; =20 /* Allocate a buffer on the stack and fill it with a printf format string.= */ #define MKSTR(name, ...) \ - char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ + int mkstr_size_##name =3D snprintf(NULL, 0, "" __VA_ARGS__); \ + char name[mkstr_size_##name + 1]; \ \ - snprintf(name, sizeof(name), __VA_ARGS__) + snprintf(name, sizeof(name), "" __VA_ARGS__) =20 /** * Return logarithm of the nearest power of two above input value. --=20 2.24.0