From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH] mk: use misleading indentation warning when available Date: Tue, 18 Dec 2018 11:26:43 +0100 Message-ID: <20181218102643.4332-1-gaetan.rivet@6wind.com> References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Gaetan Rivet To: dev@dpdk.org Return-path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id C7DD25F1F for ; Tue, 18 Dec 2018 11:27:09 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id j2so15341265wrw.1 for ; Tue, 18 Dec 2018 02:27:09 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -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 --- 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