Skip to contentSkip to conversation

buildtools: allow pedantic empty pmdinfo

PATCH In review Thomas Monjalon 2 participants 3 messages Feb 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildtools: allow pedantic empty pmdinfo

If a driver has no info generated by pmdinfogen,
and if this driver is compiled as pedantic,
then an failure would occur:

	drivers/rte_common_mlx5.pmd.c:1: error:
	ISO C forbids an empty translation unit [-Werror=pedantic]

Such error is triggered with the new mlx5 common directory.

In order to allow an "empty driver info" compiled in pedantic mode, the script generating .pmd.c file is modified to add a static string unconditionnaly.
The minimal generated code is:

	static __attribute__((unused)) const char *generator =
		"/path/to/dpdk/buildtools/gen-pmdinfo-cfile.sh";
---
 buildtools/gen-pmdinfo-cfile.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
buildtools/gen-pmdinfo-cfile.sh +2 -1
index 0b6dc2ce4f..43059cf364 100755
@@ -6,7 +6,8 @@ arfile=$1
 output=$2
 pmdinfogen=$3
 
-echo > $output
+# The generated file must not be empty if compiled in pedantic mode
+echo 'static __attribute__((unused)) const char *generator = "'$0'";' > $output
 for ofile in `ar t $arfile` ; do
 	ar p $arfile $ofile | $pmdinfogen - - >> $output 2> /dev/null
 done
Signature · 1 line
2.25.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Monjalon

If a driver has no info generated by pmdinfogen,
and if this driver is compiled as pedantic,
then an failure would occur:

	drivers/rte_common_mlx5.pmd.c:1: error:
	ISO C forbids an empty translation unit [-Werror=pedantic]

Such error is triggered with the new mlx5 common directory.

Quoted 8 lines

In order to allow an "empty driver info" compiled in pedantic mode, the script generating .pmd.c file is modified to add a static string unconditionnaly.
The minimal generated code is:

	static __attribute__((unused)) const char *generator =
		"/path/to/dpdk/buildtools/gen-pmdinfo-cfile.sh";

LGTM

author Applied
#2 lore raw

05/02/2020 18:14, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

If a driver has no info generated by pmdinfogen,
and if this driver is compiled as pedantic,
then an failure would occur:

	drivers/rte_common_mlx5.pmd.c:1: error:
	ISO C forbids an empty translation unit [-Werror=pedantic]

Such error is triggered with the new mlx5 common directory.

In order to allow an "empty driver info" compiled in pedantic mode, the script generating .pmd.c file is modified to add a static string unconditionnaly.
The minimal generated code is:

	static __attribute__((unused)) const char *generator =
		"/path/to/dpdk/buildtools/gen-pmdinfo-cfile.sh";
Quoted 5 lines
Quoted 1 line

LGTM

Applied, thanks, it will allow pulling next-net without breaking debug compilation for the new ABI tooling.