build: fix invalid characters in toolchain definitions

Message ID 20230207152200.122227-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series build: fix invalid characters in toolchain definitions |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Bruce Richardson Feb. 7, 2023, 3:22 p.m. UTC
  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(-)
  

Comments

Bruce Richardson Feb. 8, 2023, 5:11 p.m. UTC | #1
On Tue, Feb 07, 2023 at 03:22:00PM +0000, Bruce Richardson wrote:
> 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>
> ---

Resending Keith's ack, since patchwork doesn't seem to have picked it up
from Keith's email.

Acked-by: Keith Wiles <keith.wiles@intel.com>
  
Tyler Retzlaff Feb. 8, 2023, 6:08 p.m. UTC | #2
On Tue, Feb 07, 2023 at 03:22:00PM +0000, Bruce Richardson wrote:
> 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>

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
Thomas Monjalon Feb. 20, 2023, 12:20 a.m. UTC | #3
08/02/2023 19:08, Tyler Retzlaff:
> On Tue, Feb 07, 2023 at 03:22:00PM +0000, Bruce Richardson wrote:
> > 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>
> 
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied, thanks.
  

Patch

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)