From: Arnd Bergmann <arnd@arndb.de>
To: Borislav Petkov <bp@alien8.de>
Cc: Sam Ravnborg <sam@ravnborg.org>, Michal Marek <mmarek@suse.cz>,
torvalds@linux-foundation.org, x86@kernel.org,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
linux-kbuild@vger.kernel.org, bp@amd64.org
Subject: Re: [PATCH -v4] kbuild: Add extra gcc checks
Date: Mon, 28 Feb 2011 22:07:33 +0100 [thread overview]
Message-ID: <201102282207.33489.arnd@arndb.de> (raw)
In-Reply-To: <20110221110322.GA9819@liondog.tnic>
On Monday 21 February 2011 12:03:22 Borislav Petkov wrote:
> Add a 'W=1' Makefile switch which adds additional checking per build
> object.
>
> The idea behind this option is targeted at developers who, in the
> process of writing their code, want to do the occasional
>
> make W=1 [target.o]
Great stuff, I really like the idea!
> +# $(call cc-option... ) handles gcc -W.. options which
> +# are not supported by all versions of the compiler
> +ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
> +ifneq ($(call cc-version),)
> +KBUILD_EXTRA_WARNINGS := -Wextra
> +KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
> +KBUILD_EXTRA_WARNINGS += -Waggregate-return
> +KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
> +KBUILD_EXTRA_WARNINGS += -Wcast-qual
> +KBUILD_EXTRA_WARNINGS += -Wcast-align
> +KBUILD_EXTRA_WARNINGS += -Wconversion
> +KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
> +KBUILD_EXTRA_WARNINGS += -Wlogical-op
> +KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
> +KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
> +KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
> +KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
> +KBUILD_EXTRA_WARNINGS += -Wnested-externs
> +KBUILD_EXTRA_WARNINGS += -Wold-style-definition
> +KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
> +KBUILD_EXTRA_WARNINGS += -Wpacked
> +KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
> +KBUILD_EXTRA_WARNINGS += -Wpadded
> +KBUILD_EXTRA_WARNINGS += -Wpointer-arith
> +KBUILD_EXTRA_WARNINGS += -Wredundant-decls
> +KBUILD_EXTRA_WARNINGS += -Wshadow
> +KBUILD_EXTRA_WARNINGS += -Wswitch-default
> +KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
> +KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
> +endif
> +endif
I would be a little more selective here. Maybe we can have two levels
W=1 and W=2, with the full set getting enabled by W=2, and the smaller
set getting enabled in W=1. The reason is that many of the warnings
are pointless or even hurting code quality, while others (e.g.
-Wmissing-declarations) are generally useful and the only reason for
not enabling them is that they cause too many warnings with existing
code.
Arnd
next prev parent reply other threads:[~2011-02-28 21:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-21 11:03 [PATCH -v4] kbuild: Add extra gcc checks Borislav Petkov
2011-02-28 18:24 ` Borislav Petkov
2011-02-28 18:38 ` Sam Ravnborg
2011-02-28 21:07 ` Arnd Bergmann [this message]
2011-02-28 21:31 ` Borislav Petkov
2011-03-01 11:35 ` Arnd Bergmann
2011-03-01 13:20 ` Américo Wang
2011-03-01 14:56 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201102282207.33489.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=bp@amd64.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mmarek@suse.cz \
--cc=sam@ravnborg.org \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox