From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c502FH9pTBmXkZ2voqNhzT76T0YGIVGi7aeC9GgX/vs=; b=CGFdsE7uwv0WGBuc8NNeyygA6LgYnuBrL0pTL4ldTovpEYK06vBhOb4OH64OjI37Ub pD3C1PaYruh3+fEX7e26NjfHf/VGBMR2bpekfY9+Ma47V3oUQBqktioZgNguZsR0Jvjc +zzlhaMi9V8FTKXi/H4U94+KOygagP+lP/+D1ml/bDreLj/clR80lJzmEE7oVX6+8RR9 8lUD9v0rI8KkTpSjM6yZFgPGUvMu/XGpQtHPjaFWLNqldBm/BUjfkWFVdq2z3erGO5nF ZzpO+7WOLWm9CXqAxFEau43pNQi6VMl32dAA4VoMoDMVBizSqxDY0KndNEzuJqY94Czk yudQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c502FH9pTBmXkZ2voqNhzT76T0YGIVGi7aeC9GgX/vs=; b=nz4sZWnpxC1VpvRdm2nkcmciSMOQNMXxHWE1jYvx0IwAAp++86HZ9vGSF+VBcgttpJ ikFdeMVUiVCTJir57W+uhRcOwkZYLfs760oxaP1254dDk70cZPEAVfC3u41phqVfqh/2 polevwyL6TXCjsFQA+OxVTo+G6O21ruyjdGGE5s4rFdzHL7mFr+vWCfwkz3zlDVnvkLO h/4VxksxPCVAiraNrDi62M0VvrukBS6DLt0TczLhWg7e2EKTLp5Asjtc6gjL6ApBwlBD IQRZa0kU0KyIAOLeuZmr2Rnz5nKNFzPB7FP/ThDrXkhEOcOtqahkMlMfRXHF+0m40qCE Nesw== X-Gm-Message-State: AA+aEWYS9a6gKCkCXMD7qGKSOPPVzd1XJezti0Bf1GDI+nrCnSAsSHsn mw74TdRGE6P6wI09jSSWHew2bSJ1RcU= X-Google-Smtp-Source: AFSGD/UNVrK3cBYVwhbTJbxuzILOf0jWR5BSFagP33dHTkbzDgp5Gf8NaQ5H3uCeb1Kh0V5Q3kTHbQ== X-Received: by 2002:adf:ce86:: with SMTP id r6mr2853151wrn.257.1545128828978; Tue, 18 Dec 2018 02:27:08 -0800 (PST) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u204sm2987122wmu.30.2018.12.18.02.27.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 02:27:08 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 18 Dec 2018 11:26:43 +0100 Message-Id: <20181218102643.4332-1-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] mk: use misleading indentation warning when available X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2018 10:27:09 -0000 -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