From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH] mk: use misleading indentation warning when available
Date: Tue, 18 Dec 2018 11:26:43 +0100 [thread overview]
Message-ID: <20181218102643.4332-1-gaetan.rivet@6wind.com> (raw)
In-Reply-To: <f9e0369f-5f63-caec-8964-c172586c3a6f@intel.com>
-Wmisleading-indentation was introduced in GCC 6.0.
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();
do_stuff();
Signed-off-by: Gaetan Rivet <gaetan.rivet@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
endif
+ifeq ($(shell test $(GCC_VERSION) -gt 60 && echo 1), 1)
+WERROR_FLAGS += -Wmisleading-indentation
+endif
+
export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF
export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS
--
2.19.1
next prev parent reply other threads:[~2018-12-18 10:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 9:25 [dpdk-dev] [PATCH] eal/option: fix option register duplicate detection Gaetan Rivet
2018-12-17 9:35 ` Burakov, Anatoly
2018-12-18 10:26 ` Gaetan Rivet [this message]
2018-12-18 14:50 ` [dpdk-dev] [PATCH] mk: use misleading indentation warning when available Ferruh Yigit
2018-12-19 9:24 ` Gaëtan Rivet
2018-12-19 10:05 ` Burakov, Anatoly
2018-12-17 10:19 ` [dpdk-dev] [PATCH] eal/option: fix option register duplicate detection David Marchand
2018-12-19 22:59 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181218102643.4332-1-gaetan.rivet@6wind.com \
--to=gaetan.rivet@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).