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: 11787279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E1DD746 for ; Sat, 19 Sep 2020 19:43:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DF1821D42 for ; Sat, 19 Sep 2020 19:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgISTnS (ORCPT ); Sat, 19 Sep 2020 15:43:18 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45436 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbgISTnS (ORCPT ); Sat, 19 Sep 2020 15:43:18 -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: linux-kbuild@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 From patchwork Sat Sep 19 19:02:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 11787281 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 954C3746 for ; Sat, 19 Sep 2020 19:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E44121D42 for ; Sat, 19 Sep 2020 19:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726520AbgISTnU (ORCPT ); Sat, 19 Sep 2020 15:43:20 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45440 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbgISTnU (ORCPT ); Sat, 19 Sep 2020 15:43:20 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kJi8j-00FPak-Ny; 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 2/2] net: phylib: Enable W=1 by default Date: Sat, 19 Sep 2020 21:02:58 +0200 Message-Id: <20200919190258.3673246-3-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: linux-kbuild@vger.kernel.org Add to the subdirectory ccflags variable the additional compiler warnings which W=1 adds at the top level when enabled. Signed-off-by: Andrew Lunn --- drivers/net/mdio/Makefile | 3 +++ drivers/net/pcs/Makefile | 3 +++ drivers/net/phy/Makefile | 3 +++ 3 files changed, 9 insertions(+) diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 14d1beb633c9..14600552eb8b 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux MDIO bus drivers +# Enable W=1 by default +subdir-ccflags-y := $(KBUILD_CFLAGS_WARN1) + obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o diff --git a/drivers/net/pcs/Makefile b/drivers/net/pcs/Makefile index c23146755972..385b5765e390 100644 --- a/drivers/net/pcs/Makefile +++ b/drivers/net/pcs/Makefile @@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux PCS drivers +# Enable W=1 by default +subdir-ccflags-y := $(KBUILD_CFLAGS_WARN1) + obj-$(CONFIG_PCS_XPCS) += pcs-xpcs.o obj-$(CONFIG_PCS_LYNX) += pcs-lynx.o diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index a13e402074cf..c49d40dfb6ec 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux PHY drivers +# Enable W=1 by default +subdir-ccflags-y := $(KBUILD_CFLAGS_WARN1) + libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \ linkmode.o mdio-bus-y += mdio_bus.o mdio_device.o