From: Josh Triplett <josht@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: akpm@linux-foundation.org, Josh Triplett <josh@freedesktop.org>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-sparse@vger.kernel.org, adobriyan@sw.ru, ak@suse.de
Subject: Re: [patch 5/9] x86_64: arch_pick_mmap_layout() fixlet
Date: Fri, 06 Jul 2007 12:53:46 -0700 [thread overview]
Message-ID: <1183751626.2613.54.camel@josh-work.beaverton.ibm.com> (raw)
In-Reply-To: <alpine.LFD.0.98.0707061010060.21374@woody.linux-foundation.org>
On Fri, 2007-07-06 at 10:21 -0700, Linus Torvalds wrote:
> This would be a sparse bug, I think.
>
> Returning a void-valued expression in a void-valued function is
> proper C99 (and gcc has allowed it for longer). And it often makes for
> nicer-looking code, with no real downsides.
>
> This seems to be a new bug introduced by Al Viro in sparse: -Wall should
> _not_ enable -Wreturn-void, I think (and I don't think Al meant it to: his
> commit message says "Conditional on -Wreturn-void", and he probably didn't
> think about the fact that -Wall will force them all on.
>
> Josh, Al and sparse mailing list added to participants list, and patch
> dropped. I think -Wreturn-void is fine, but it just shouldn't be part of
> -Wall, and thus shouldn't trigger for the kernl.
The kernel does not seem to use sparse -Wall by default. Did the patch
submitter use CF=-Wall or CF=-Wreturn-void, or otherwise change the set
of warnings emitted by Sparse?
I do think the sparse warning logic needs some work. -Wall logically
should mean "all warnings", but gcc historically uses it to mean "some
reasonable set of warnings". However, since Sparse exists solely to
give warnings, it defaults to "some reasonable set of warnings", and
uses -Wall for "all warnings". Perhaps for gcc compatibility, that
should change. I'd love to hear suggestions for how Sparse should
behave. A few options:
* Leave the current behavior, and tell people annoyed by Sparse
warnings they don't care about that they should either avoid
-Wall or use -Wall -Wno-warning-i-do-not-care-about.
* Ignore -Wall since we already give a reasonable default set of
warnings, and possibly introduce a -Weverything or similar that
really does mean "turn on every Sparse warning".
* Change -Wall to mean "turn on some additional warnings, but not
all of them". We then have to decide which warnings -Wall
should enable, and again we might want to add a -Weverything.
* Turn off all warnings by default unless you give -Wall. This
seems entirely broken, given the purpose of Sparse.
> On Fri, 6 Jul 2007, akpm@linux-foundation.org wrote:
> > From: Alexey Dobriyan <adobriyan@sw.ru>
> >
> > sparse now warns about
> > arch/x86_64/mm/mmap.c:15:3: warning: returning void-valued expression
- Josh Triplett
next prev parent reply other threads:[~2007-07-06 19:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200707060939.l669drk2019988@imap1.linux-foundation.org>
2007-07-06 17:21 ` [patch 5/9] x86_64: arch_pick_mmap_layout() fixlet Linus Torvalds
2007-07-06 18:40 ` Derek M Jones
2007-07-06 18:48 ` Linus Torvalds
2007-07-06 19:53 ` Josh Triplett [this message]
2007-07-06 21:39 ` Pavel Roskin
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=1183751626.2613.54.camel@josh-work.beaverton.ibm.com \
--to=josht@linux.vnet.ibm.com \
--cc=adobriyan@sw.ru \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=josh@freedesktop.org \
--cc=linux-sparse@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).