[PATCH] build: fix invalid characters in toolchain definitions

Bruce Richardson bruce.richardson at intel.com
Tue Feb 7 16:22:00 CET 2023


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 at dpdk.org

Reported-by: Keith Wiles <keith.wiles at intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson at 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



More information about the stable mailing list