From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2C8DF41C30;
	Tue,  7 Feb 2023 16:22:22 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1869F42D32;
	Tue,  7 Feb 2023 16:22:22 +0100 (CET)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by mails.dpdk.org (Postfix) with ESMTP id 87B81410D1;
 Tue,  7 Feb 2023 16:22:18 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1675783338; x=1707319338;
 h=from:to:cc:subject:date:message-id:mime-version:
 content-transfer-encoding;
 bh=/jjotMnDrxh1fYgBqZFwIVTHYSBy/xhR44t14RCMYoM=;
 b=eBqXiRJmrIDzeFiL9DBkJnCwZCG/ccBi4Ap6z+dmG9fQU2qaq+2Bifc6
 BkiyRUxDhCHXJqrtz1/cFfRqzIGu4Nt4FGtgkc3bNrUUyy8RohGVWsVFS
 Ae4ndPBVObegzFWi4VAnulVEZiIAVXVnffBf/zz2LFnXnHORn20NDM+A/
 Q391ai4vNai/hX+7IAnf/g6HQ+8Jh96HRnYNjrmfOC/TsBQ9qyksDclCp
 r0Jpfmp8PL8Pw4zzTrJQHdTaEJ3Y24BszsG1+TjPx8YnG0sAYA4aH9rQ8
 Cgbz2xFInEzMe6PQd5Wq5btyyHBKrpjbPWBESYBdcfMaPj6J7KxHgSNvK A==;
X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="330824673"
X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="330824673"
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 07 Feb 2023 07:22:14 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="840794274"
X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="840794274"
Received: from silpixa00401385.ir.intel.com ([10.237.214.21])
 by orsmga005.jf.intel.com with ESMTP; 07 Feb 2023 07:22:12 -0800
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>, stable@dpdk.org,
 Keith Wiles <keith.wiles@intel.com>
Subject: [PATCH] build: fix invalid characters in toolchain definitions
Date: Tue,  7 Feb 2023 15:22:00 +0000
Message-Id: <20230207152200.122227-1-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.37.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

When using "icx" (Intel(R) oneAPI DPC++/C++ Compiler) to build DPDK,
meson reports the toolchain as "intel-llvm"[1]. This value is used
directly to define the RTE_TOOLCHAIN macros, which means that we end up
with the invalid macro name "RTE_TOOLCHAIN_INTEL-LLVM", and getting the
compiler warning:

./rte_build_config.h:422:28: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions]

This can be fixed, and the macro generation made more robust generally,
by adding "underscorify()" on the string. This replaces the "-", and
any other invalid characters, with "_" [2].

[1] https://mesonbuild.com/Reference-tables.html#compiler-ids
[2] https://mesonbuild.com/Reference-manual_elementary_str.html#strunderscorify

Fixes: afd18fa21b5e ("build: set toolchain info during meson configure")
Cc: stable@dpdk.org

Reported-by: Keith Wiles <keith.wiles@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 config/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/meson.build b/config/meson.build
index 26f3168bc9..fc3ac99a32 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -139,7 +139,7 @@ endif
 
 toolchain = cc.get_id()
 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
-dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1)
+dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper().underscorify(), 1)
 
 dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
 dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)
-- 
2.37.2