[dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors

Gavin Hu Gavin.Hu at arm.com
Tue May 29 03:22:30 CEST 2018


Hi Bruce,

Thanks for your helpful comment, see my inline comments.

Best Regards,
Gavin

-----Original Message-----
From: Bruce Richardson <bruce.richardson at intel.com>
Sent: Monday, May 28, 2018 9:24 PM
To: Gavin Hu <Gavin.Hu at arm.com>
Cc: dev at dpdk.org; stable at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/2] mk: fix cross build errors

On Mon, May 28, 2018 at 02:53:47AM -0400, Gavin Hu wrote:
> The "-Wimplicit-fallthrough=2" option was introduced into gcc 7.0, it
> was enabled when the cross compiler gcc is greater than 7.0, but for
> the host side buildtools/pmdinfogen, if the native is older than 7.0,
> it should not be enabled.
>
> The fix is to differentiate the host gcc Werror options from the cross gcc.
>
> gcc -Wp,-MD,./.pmdinfogen.o.d.tmp  -W -Wall -Wstrict-prototypes
> -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
> -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual
> -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings
> -Wdeprecated -Werror -Wimplicit-fallthrough=2 -Dbbb -Wno-format-truncation -g
> -I/home/gavin/arm_repo/dpdk/build/include    -o pmdinfogen.o -c
> ~/dpdk/buildtools/pmdinfogen/pmdinfogen.c gcc: error:
> unrecognized command line option ‘-Wimplicit-fallthrough=2’
> ~/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'pmdinfogen.o'
> failed make[3]: *** [pmdinfogen.o] Error 1
>
> Fixes: ced3e6f8 ("mk: adjust gcc flags for new gcc 7 warnings")
> Cc: stable at dpdk.org
>
> Signed-off-by: Gavin Hu <gavin.hu at arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>
> Reviewed-by: Steve Capper <Steve.Capper at arm.com>
> Reviewed-by: Thomas Monjalon <thomas at monjalon.net>
> ---

Would a simpler solution for this not be to put "-Wno-implicit-fallthrough"
for pmdinfogen? GCC will not give a warning for an unrecognised "-Wno"
flag when compiling, unless there are other errors. This means we can just use the flag without bothering with version checks.

 [Gavin Hu] I tried your proposal, added "-Wno-implicit-fallthrough" before $( WERROR_FLAGS) in the pmdinfo Makefile.
It took precedence and made following " Wimplicit-fallthrough=2" useless, the compilation succeeded.

Is this what you mean?
Note the two options must be in this order, otherwise the compiling error still hit.

Another option is totally disable WERROR_FLAGS for pmdinfo, but this is not a best way as it includes a lot of other options.

toolchain/gcc/rte.vars.mk:46:WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
toolchain/gcc/rte.vars.mk:47:WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
toolchain/gcc/rte.vars.mk:48:WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual
toolchain/gcc/rte.vars.mk:49:WERROR_FLAGS += -Wformat-nonliteral -Wformat-security
toolchain/gcc/rte.vars.mk:50:WERROR_FLAGS += -Wundef -Wwrite-strings -Wdeprecated
toolchain/gcc/rte.vars.mk:53:WERROR_FLAGS += -Werror
toolchain/gcc/rte.vars.mk:59:WERROR_FLAGS += -Wno-error=cast-align
toolchain/gcc/rte.vars.mk:67:WERROR_FLAGS += -Wno-missing-field-initializers
toolchain/gcc/rte.vars.mk:71:WERROR_FLAGS += -Wno-uninitialized
toolchain/gcc/rte.vars.mk:85:WERROR_FLAGS += -Wimplicit-fallthrough=2
toolchain/gcc/rte.vars.mk:87:WERROR_FLAGS += -Wno-format-truncation

/Bruce
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the dev mailing list