From patchwork Sat Sep 19 19:02:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 260552 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1054EC43464 for ; Sat, 19 Sep 2020 19:03:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4EBA21741 for ; Sat, 19 Sep 2020 19:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgISTD3 (ORCPT ); Sat, 19 Sep 2020 15:03:29 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45378 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbgISTD1 (ORCPT ); Sat, 19 Sep 2020 15:03:27 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kJi8j-00FPah-Md; Sat, 19 Sep 2020 21:03:17 +0200 From: Andrew Lunn To: netdev Cc: David Miller , Jakub Kicinski , Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Andrew Lunn Subject: [PATCH RFC/RFT 1/2] scripts: Makefile.extrawarn: Add W=1 warnings to a symbol Date: Sat, 19 Sep 2020 21:02:57 +0200 Message-Id: <20200919190258.3673246-2-andrew@lunn.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200919190258.3673246-1-andrew@lunn.ch> References: <20200919190258.3673246-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There is a desire that subtrees can enable W=1 by default. To make this possible, put the extra compiler flags into an exported variable, so other Makefiles can make use of them. Signed-off-by: Andrew Lunn --- scripts/Makefile.extrawarn | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 95e4cdb94fe9..bf0de3502849 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -20,23 +20,26 @@ export KBUILD_EXTRA_WARN # # W=1 - warnings which may be relevant and do not occur too often # -ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) - -KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter -KBUILD_CFLAGS += -Wmissing-declarations -KBUILD_CFLAGS += -Wmissing-format-attribute -KBUILD_CFLAGS += -Wmissing-prototypes -KBUILD_CFLAGS += -Wold-style-definition -KBUILD_CFLAGS += -Wmissing-include-dirs -KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable) -KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable) -KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) -KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) +KBUILD_CFLAGS_WARN1 += -Wextra -Wunused -Wno-unused-parameter +KBUILD_CFLAGS_WARN1 += -Wmissing-declarations +KBUILD_CFLAGS_WARN1 += -Wmissing-format-attribute +KBUILD_CFLAGS_WARN1 += -Wmissing-prototypes +KBUILD_CFLAGS_WARN1 += -Wold-style-definition +KBUILD_CFLAGS_WARN1 += -Wmissing-include-dirs +KBUILD_CFLAGS_WARN1 += $(call cc-option, -Wunused-but-set-variable) +KBUILD_CFLAGS_WARN1 += $(call cc-option, -Wunused-const-variable) +KBUILD_CFLAGS_WARN1 += $(call cc-option, -Wpacked-not-aligned) +KBUILD_CFLAGS_WARN1 += $(call cc-option, -Wstringop-truncation) # The following turn off the warnings enabled by -Wextra -KBUILD_CFLAGS += -Wno-missing-field-initializers -KBUILD_CFLAGS += -Wno-sign-compare -KBUILD_CFLAGS += -Wno-type-limits +KBUILD_CFLAGS_WARN1 += -Wno-missing-field-initializers +KBUILD_CFLAGS_WARN1 += -Wno-sign-compare +KBUILD_CFLAGS_WARN1 += -Wno-type-limits + +export KBUILD_CFLAGS_WARN1 + +ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) +KBUILD_CFLAGS += $(KBUILD_CFLAGS_WARN1) KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 else