Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp474811ybl; Wed, 28 Aug 2019 00:22:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5rCcaPhRn53vb4TYQm7/CqMk+xtP31y8+JG1e/qi9KNHieAcsZxIsjFJDlYjhqUSSYDNN X-Received: by 2002:a17:902:b704:: with SMTP id d4mr2955718pls.261.1566976930726; Wed, 28 Aug 2019 00:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566976930; cv=none; d=google.com; s=arc-20160816; b=O7lPOc1TZn5uvKqORi93UzriI89MFHC38AGeouV05y7an2Q+12AjYP08OX31y3IkEu BXJmSZSIbZSeGyXfOdv4nQ4T5icyTiQj1Y6dgD1mC4otg+l3ubpHYfjxD2tyy9zNg376 p1P47o2KbZOfIaX8nW2hmN1z60UVYiJ857eZWx0cRQ7nPu+PKxWqSFg1+qeg29fcCmxF XhEyS5gA8LpWaWF7rbfbGGRklrlyYvCGYHThhXk89XFTUNWyO310FrPa2UcHRpiOxDHv q6nc/iA4T9kzgiePx88GMtzU/3378G8Pf0QliMl3hLB0Of7A1jROgWMglFdHv9WDaaIo IYTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=m/1xpIzC+XYlVD64Z0IJa2mF9XyPRy3AeZIkoZXGzMo=; b=nIEuQocgbdtqnll3aM0GL3yl96ilrbhqTuHEc1CDOaXHfCJPfqcO3kMXdYNlhuoKRw A6EROX0jdKpHQAAvL5EOXjwIxxLNgFP2spJC4cXkXOy2DGQhgzF/j8OlAN76pPCYSwjP Haz9rmtZLEZuE+mpZfiXEWff//YyViKv+DU4l7J440eI8wthewnSaxa0YTlWfoxIqCbJ XgHgA58NjpMm/c18PHuojjjtVhIjyy6N9ZgUXyXXlJcyiEcWXNSgPcu+8S1tnx2ko8X7 lA2Lq7/nq7mf9kt4Q6e1mmFMqUgm8cs6EqfH3D42ZE5wjb4vxVdVm6+LjPq0M34J6kwN j59Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gna4DkQN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19si1319430plr.91.2019.08.28.00.21.54; Wed, 28 Aug 2019 00:22:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gna4DkQN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbfH1HUg (ORCPT + 99 others); Wed, 28 Aug 2019 03:20:36 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38278 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbfH1HUg (ORCPT ); Wed, 28 Aug 2019 03:20:36 -0400 Received: by mail-wm1-f66.google.com with SMTP id o184so837670wme.3; Wed, 28 Aug 2019 00:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=m/1xpIzC+XYlVD64Z0IJa2mF9XyPRy3AeZIkoZXGzMo=; b=gna4DkQNcwGwTSZ2FyWnRWVUKoNEjyPCN1gCD0L6u1OvPXZRkT8AQXC6w0+ixGTieX /usU7OTZVunXxzVQJGu60teKh+5dpWKhj4qysfqIwiW0HIIi/s2QEwFUI1dmnr8lUiBx jYpIGVMTh07OSyaFBXUfYIMXo5Yj26oyXVAP34iA2fCwenMPODWAmm6uYUbzDXtQzP6b tO/BME7kwMGC9OCs9uO7RgxD5SgxiFSDhW/ILJfXYPhUiaAAgXKgLhpV4QNplLkRaj83 U976dWOooMuFdK1w8GucNL15anUIJyGBPvSkIon7UVX5HSODCeWsPZ54jSFHurwFQDAM QuYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=m/1xpIzC+XYlVD64Z0IJa2mF9XyPRy3AeZIkoZXGzMo=; b=gnleoB5ca2G4e/4+PvlN1Mi/rI4IweXYDQtqQPViYrjJMca3PNz6wqbC8h+coO6jc/ GghWH52012+YW0dVp1m45ei3jngNj9O5BpNECwfkTLj5qYTtIQmUmtzMmzEKx+L9Qxpl hXeZajDvzVVrrcE2UQf9mcqiqg5yO+Zi40vHIuDWHlkF0mk0+wszPc90CrciqjRlc45G 4auBfRAifkw/Ml+jgThb+4o9rAuOs8/FcqYY6yaCSFSaWluErRfoKL8iLz/oqUOxcrdy lAX7vJoCHuBf6k75PTzX28N+ngf+mUVANpNGDnVLtMrBAYH7cu34kLW0x1XdgRW7rOP+ BiPw== X-Gm-Message-State: APjAAAXVzomitlTf/l2HQ7o4pCcQLvMWy0kfl5vvWpbXrffpYS3XBJmT lnnSRiXl3AEIkqycHp94fJcLnQ8FAZuq9bmopco= X-Received: by 2002:a05:600c:225a:: with SMTP id a26mr3045439wmm.81.1566976832798; Wed, 28 Aug 2019 00:20:32 -0700 (PDT) MIME-Version: 1.0 References: <20190828055425.24765-1-yamada.masahiro@socionext.com> In-Reply-To: <20190828055425.24765-1-yamada.masahiro@socionext.com> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 28 Aug 2019 09:20:21 +0200 Message-ID: Subject: Re: [PATCH 1/2] kbuild: refactor scripts/Makefile.extrawarn To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Miguel Ojeda , Arnd Bergmann , Michal Marek , Clang-Built-Linux ML , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 7:55 AM Masahiro Yamada wrote: > > Instead of the warning-[123] magic, let's accumulate compiler options > to KBUILD_CFLAGS directly as the top Makefile does. I think this makes > easier to understand what is going on in this file. > > This commit slightly changes the behavior, I think all of which are OK. > > [1] Currently, cc-option calls are needlessly evaluated. For example, > warning-3 += $(call cc-option, -Wpacked-bitfield-compat) > needs evaluating only when W=3, but it is actually evaluated for > W=1, W=2 as well. With this commit, only relevant cc-option calls > will be evaluated. This is a slight optimization. > > [2] Currently, unsupported level like W=4 is checked by: > $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) > This will no longer be checked, but I do not think it is a big > deal. > Hi Masahiro Yamada, thanks for your patch series. If KBUILD_ENABLE_EXTRA_GCC_CHECKS does extra(-warning)-checks for GCC and Clang, please rename the Kconfig into... KBUILD_ENABLE_EXTRA_CC_CHECKS ...or something similiar (and maybe with some notes in its Kconfig help-text?). Regards, - Sedat - > [3] Currently, 4 Clang warnings (Winitializer-overrides, Wformat, > Wsign-compare, Wformat-zero-length) are shown by any of W=1, W=2, > and W=3. With this commit, they will be warned only by W=1. I > think this is a more correct behavior since each warning belongs > to only one warning level. > > Signed-off-by: Masahiro Yamada > --- > > scripts/Makefile.extrawarn | 104 +++++++++++++++++++------------------ > 1 file changed, 53 insertions(+), 51 deletions(-) > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn > index a74ce2e3c33e..1fa53968e292 100644 > --- a/scripts/Makefile.extrawarn > +++ b/scripts/Makefile.extrawarn > @@ -1,14 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0 > # ========================================================================== > -# > # make W=... settings > -# > -# W=1 - warnings that may be relevant and does not occur too often > -# W=2 - warnings that occur quite often but may still be relevant > -# W=3 - the more obscure warnings, can most likely be ignored > -# > -# $(call cc-option, -W...) handles gcc -W.. options which > -# are not supported by all versions of the compiler > # ========================================================================== > > KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) > @@ -17,58 +9,68 @@ ifeq ("$(origin W)", "command line") > export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) > endif > > -ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS > -warning- := $(empty) > +# > +# W=1 - warnings that may be relevant and does not occur too often > +# > +ifneq ($(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) > > -warning-1 := -Wextra -Wunused -Wno-unused-parameter > -warning-1 += -Wmissing-declarations > -warning-1 += -Wmissing-format-attribute > -warning-1 += -Wmissing-prototypes > -warning-1 += -Wold-style-definition > -warning-1 += -Wmissing-include-dirs > -warning-1 += $(call cc-option, -Wunused-but-set-variable) > -warning-1 += $(call cc-option, -Wunused-const-variable) > -warning-1 += $(call cc-option, -Wpacked-not-aligned) > -warning-1 += $(call cc-option, -Wstringop-truncation) > +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) > # The following turn off the warnings enabled by -Wextra > -warning-1 += -Wno-missing-field-initializers > -warning-1 += -Wno-sign-compare > - > -warning-2 += -Wcast-align > -warning-2 += -Wdisabled-optimization > -warning-2 += -Wnested-externs > -warning-2 += -Wshadow > -warning-2 += $(call cc-option, -Wlogical-op) > -warning-2 += -Wmissing-field-initializers > -warning-2 += -Wsign-compare > -warning-2 += $(call cc-option, -Wmaybe-uninitialized) > -warning-2 += $(call cc-option, -Wunused-macros) > - > -warning-3 := -Wbad-function-cast > -warning-3 += -Wcast-qual > -warning-3 += -Wconversion > -warning-3 += -Wpacked > -warning-3 += -Wpadded > -warning-3 += -Wpointer-arith > -warning-3 += -Wredundant-decls > -warning-3 += -Wswitch-default > -warning-3 += $(call cc-option, -Wpacked-bitfield-compat) > - > -warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) > -warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) > -warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) > - > -ifeq ("$(strip $(warning))","") > - $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) > -endif > +KBUILD_CFLAGS += -Wno-missing-field-initializers > +KBUILD_CFLAGS += -Wno-sign-compare > > -KBUILD_CFLAGS += $(warning) > else > > +# W=1 also stops suppressing some warnings > + > ifdef CONFIG_CC_IS_CLANG > KBUILD_CFLAGS += -Wno-initializer-overrides > KBUILD_CFLAGS += -Wno-format > KBUILD_CFLAGS += -Wno-sign-compare > KBUILD_CFLAGS += -Wno-format-zero-length > endif > + > +endif > + > +# > +# W=2 - warnings that occur quite often but may still be relevant > +# > +ifneq ($(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) > + > +KBUILD_CFLAGS += -Wcast-align > +KBUILD_CFLAGS += -Wdisabled-optimization > +KBUILD_CFLAGS += -Wnested-externs > +KBUILD_CFLAGS += -Wshadow > +KBUILD_CFLAGS += $(call cc-option, -Wlogical-op) > +KBUILD_CFLAGS += -Wmissing-field-initializers > +KBUILD_CFLAGS += -Wsign-compare > +KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) > +KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) > + > +endif > + > +# > +# W=3 - the more obscure warnings, can most likely be ignored > +# > +ifneq ($(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) > + > +KBUILD_CFLAGS += -Wbad-function-cast > +KBUILD_CFLAGS += -Wcast-qual > +KBUILD_CFLAGS += -Wconversion > +KBUILD_CFLAGS += -Wpacked > +KBUILD_CFLAGS += -Wpadded > +KBUILD_CFLAGS += -Wpointer-arith > +KBUILD_CFLAGS += -Wredundant-decls > +KBUILD_CFLAGS += -Wswitch-default > +KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat) > + > endif > -- > 2.17.1 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190828055425.24765-1-yamada.masahiro%40socionext.com.