[dpdk-dev] [PATCH] buildtools: allow pedantic empty pmdinfo

Thomas Monjalon thomas at monjalon.net
Wed Feb 5 18:07:23 CET 2020

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
The minimal generated code is:
	static __attribute__((unused)) const char *generator =

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
 buildtools/gen-pmdinfo-cfile.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/buildtools/gen-pmdinfo-cfile.sh b/buildtools/gen-pmdinfo-cfile.sh
index 0b6dc2ce4f..43059cf364 100755
--- a/buildtools/gen-pmdinfo-cfile.sh
+++ b/buildtools/gen-pmdinfo-cfile.sh
@@ -6,7 +6,8 @@ arfile=$1
-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

More information about the dev mailing list