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 4D805A04F9 for ; Thu, 9 Jan 2020 14:34:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 43A251DD80; Thu, 9 Jan 2020 14:34:57 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 983491DD8F for ; Thu, 9 Jan 2020 14:34:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578576895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bqv80on+aU2Qlug0UqWgZuM6/D56FJbcTRhhER6yw/k=; b=UkvWI9/xJPwfJV+FXwE4e9/0Ar6I875S2m0hc1WSZSwf6VIurG3WibfaGsu78AoOQOtD9u 5YhLirw/3YrTQwXqffchMFzFAwNwR1byzn9WT4qbwYXrXF6hvzT13ePpjw3R9j6U1mw7DN 1ukodVwhDXTqQaaa54py0QF5+p/W/OI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-DmcZeM6-Ov2z3nciasgNRw-1; Thu, 09 Jan 2020 08:34:51 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9069C10054E3; Thu, 9 Jan 2020 13:34:50 +0000 (UTC) Received: from rh.redhat.com (unknown [10.36.118.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B51962926; Thu, 9 Jan 2020 13:34:49 +0000 (UTC) From: Kevin Traynor To: stable@dpdk.org Cc: ktraynor@redhat.com, Ali Alnubani , Matan Azrad Date: Thu, 9 Jan 2020 13:34:30 +0000 Message-Id: <20200109133433.12494-5-ktraynor@redhat.com> In-Reply-To: <20200109133433.12494-1-ktraynor@redhat.com> References: <20200109133433.12494-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: DmcZeM6-Ov2z3nciasgNRw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] [18.11 4/7] net/mlx: fix build with clang 9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Ali Alnubani [ upstream commit c3e89f69facbbfe131b6a6723665d48801ac943d ] 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] =09MKSTR(path, "%s/ports/%d/hw_counters/%s", drivers/net/mlx5/mlx5_utils.h:149:30: note: expanded from macro 'MKSTR' =09char 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") 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 2a550df88..a774ccba3 100644 --- a/drivers/net/mlx4/mlx4_utils.h +++ b/drivers/net/mlx4/mlx4_utils.h @@ -78,7 +78,8 @@ pmd_drv_log_basename(const char *s) /** Allocate a buffer on the stack and fill it with a printf format string= . */ #define MKSTR(name, ...) \ -=09char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ +=09int mkstr_size_##name =3D snprintf(NULL, 0, "" __VA_ARGS__); \ +=09char name[mkstr_size_##name + 1]; \ =09\ -=09snprintf(name, sizeof(name), __VA_ARGS__) +=09snprintf(name, sizeof(name), "" __VA_ARGS__) =20 /** Generate a string out of the provided arguments. */ diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h index 97092c749..fa495b378 100644 --- a/drivers/net/mlx5/mlx5_utils.h +++ b/drivers/net/mlx5/mlx5_utils.h @@ -147,7 +147,8 @@ extern int mlx5_logtype; /* Allocate a buffer on the stack and fill it with a printf format string.= */ #define MKSTR(name, ...) \ -=09char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \ +=09int mkstr_size_##name =3D snprintf(NULL, 0, "" __VA_ARGS__); \ +=09char name[mkstr_size_##name + 1]; \ =09\ -=09snprintf(name, sizeof(name), __VA_ARGS__) +=09snprintf(name, sizeof(name), "" __VA_ARGS__) =20 /** --=20 2.21.1