buildtools: allow pedantic empty pmdinfo
authorThomas Monjalon <thomas@monjalon.net>
Wed, 5 Feb 2020 15:39:23 +0000 (16:39 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 5 Feb 2020 17:19:00 +0000 (18:19 +0100)
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";

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
buildtools/gen-pmdinfo-cfile.sh

index 0b6dc2c..43059cf 100755 (executable)
@@ -6,7 +6,8 @@ arfile=$1
 output=$2
 pmdinfogen=$3
 
 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
 for ofile in `ar t $arfile` ; do
        ar p $arfile $ofile | $pmdinfogen - - >> $output 2> /dev/null
 done