[dpdk-dev] [PATCH] mk: use misleading indentation warning when available
ferruh.yigit at intel.com
Tue Dec 18 15:50:30 CET 2018
On 12/18/2018 10:26 AM, Gaetan Rivet wrote:
> -Wmisleading-indentation was introduced in GCC 6.0.
It seems '-Wmisleading-indentation' is part of -Wall, which we already set by
default. If so no need to explicitly add it.
The link I found:
A new warning -Wmisleading-indentation was added to -Wall, warning about places
where the indentation of the code might mislead a human reader about the control
Is there a way to confirm it is part of -Wall?
> Use it at least when available. This should catch most common
> error of the types (due to the codebase being properly tabbed),
> but will still miss patterns such as
> if (!condition)
> // commented_fn_call();
> Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
> I completely agree that we should change the coding style and force
> all if()s to have brackets.
> In the meantime, this patch might help alleviate the issue.
> mk/toolchain/gcc/rte.vars.mk | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
> index d8b99faf6..2c9bde1d5 100644
> --- a/mk/toolchain/gcc/rte.vars.mk
> +++ b/mk/toolchain/gcc/rte.vars.mk
> @@ -87,5 +87,9 @@ WERROR_FLAGS += -Wimplicit-fallthrough=2
> WERROR_FLAGS += -Wno-format-truncation
> +ifeq ($(shell test $(GCC_VERSION) -gt 60 && echo 1), 1)
> +WERROR_FLAGS += -Wmisleading-indentation
> export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF
> export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS
More information about the dev