From: David Miller <davem@davemloft.net>
To: rostedt@goodmis.org
Cc: sam@ravnborg.org, linux-kernel@vger.kernel.org,
srostedt@redhat.com, mingo@elte.hu, sparclinux@vger.kernel.org
Subject: Re: ftrace breaks sparc64 build
Date: Tue, 06 Jan 2009 10:32:34 -0800 (PST) [thread overview]
Message-ID: <20090106.103234.163615537.davem@davemloft.net> (raw)
In-Reply-To: <alpine.DEB.1.10.0901051458460.25066@gandalf.stny.rr.com>
From: Steven Rostedt <rostedt@goodmis.org>
Date: Mon, 5 Jan 2009 15:05:11 -0500 (EST)
> Probably the same issue. The problem is that the first use of a variable
> is in the OR section of an if statement that does a return.
>
> if (x || !(y = init_me())
> return;
>
> use_me(y);
>
> IMHO I find this sloppy code. When reading the code it can cause reviewers
> trouble, and wasted time, to see that y is indeed initialized. I'm
> impressed that gcc was able to figure it out.
I'm pretty much in firm disagreement here.
This code is pretty clear. The only way to get to use_me() is
by initializing 'y'. It's very straightforward.
There are many conditionals in the kernel where this order
of evaluation and side effects is depended upon. Some of them
just happen to warn now because of the branch tracer.
> Have you always been compiling with -Werror?
arch/sparc*/ builds with -Werror for 5+ years.
> The reason that gcc complains is because you have the
> "branch_tracer" on that converts 'if ()' into a macro (as you saw in
> your -E compile). This makes the if statement more complex, and goes
> beyond gcc's ability to know that the above 'y' is initialized
> properly. I would work on fixing this in the branch tracer, but
> honestly, I'm kind of glad that gcc barfs on it. This will help us
> point out this kind of sloppy initializations (sorry if I'm
> offending anybody about calling it sloppy). I just believe that it
> makes the code a bit more obfuscated to initialize in an if
> statement, and a second part of a complex if statement at that!
Keep in mind all this code was fine and built warning free before the
if() obfuscation done by the branch tracer. If I wrote the branch
tracer, I'd probably search for these kinds of excuses too :-)
next prev parent reply other threads:[~2009-01-06 18:32 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 18:19 Sam Ravnborg
2009-01-05 19:31 ` Steven Rostedt
2009-01-05 19:42 ` [PATCH] sparc: make proces_ver_nack a bit more readable Steven Rostedt
2009-01-05 19:46 ` Steven Rostedt
2009-01-05 19:56 ` Steven Rostedt
2009-01-05 20:07 ` Sam Ravnborg
2009-01-05 20:08 ` Sam Ravnborg
2009-01-06 18:23 ` David Miller
2009-01-05 19:54 ` ftrace breaks sparc64 build Sam Ravnborg
2009-01-05 20:05 ` Steven Rostedt
2009-01-05 21:31 ` Sam Ravnborg
2009-01-05 21:52 ` Steven Rostedt
2009-01-05 22:01 ` Sam Ravnborg
2009-01-05 22:14 ` Steven Rostedt
2009-01-05 23:11 ` Heiko Carstens
2009-01-06 2:07 ` Steven Rostedt
2009-01-06 9:36 ` Heiko Carstens
2009-01-06 4:30 ` Steven Rostedt
2009-01-06 9:45 ` Heiko Carstens
2009-01-06 18:32 ` David Miller [this message]
2009-01-06 18:52 ` Steven Rostedt
2009-01-06 19:01 ` David Miller
2009-01-06 19:52 ` Sam Ravnborg
2009-01-06 20:02 ` David Miller
2009-01-05 20:30 ` [PATCH] module: clean up initialization of variable Steven Rostedt
2009-01-05 22:59 ` Harvey Harrison
2009-01-06 1:22 ` Rusty Russell
2009-01-06 2:02 ` Steven Rostedt
2009-01-05 19:48 ` ftrace breaks sparc64 build Al Viro
2009-01-05 19:55 ` Sam Ravnborg
2009-01-06 7:53 ` Jan Beulich
2009-01-06 11:35 ` Al Viro
2009-01-06 12:39 ` Jan Beulich
2009-01-06 13:34 ` Sam Ravnborg
2009-01-06 15:52 ` Al Viro
2009-01-06 18:39 ` David Miller
2009-01-08 9:28 ` Jan Beulich
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=20090106.103234.163615537.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=sam@ravnborg.org \
--cc=sparclinux@vger.kernel.org \
--cc=srostedt@redhat.com \
/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
Powered by JetHome