From: Mike Frysinger <vapier.adi@gmail.com>
To: Marc Andre Tanner <mat@brain-dump.org>
Cc: linux-embedded@vger.kernel.org
Subject: Re: [RFC|PATCH] Compile time printk verbosity
Date: Wed, 2 Sep 2009 05:56:34 -0400 [thread overview]
Message-ID: <8bd0f97a0909020256o2426d932x507f1193fa01c34c@mail.gmail.com> (raw)
In-Reply-To: <20090902094343.GC2736@debbook.brain-dump.org>
On Wed, Sep 2, 2009 at 05:47, Marc Andre Tanner wrote:
> On Wed, Sep 02, 2009 at 05:11:12AM -0400, Mike Frysinger wrote:
>> On Wed, Sep 2, 2009 at 04:57, Marc Andre Tanner wrote:
>> > On Tue, Sep 01, 2009 at 07:37:27PM -0400, Mike Frysinger wrote:
>> >> On Tue, Sep 1, 2009 at 18:31, Marc Andre Tanner wrote:
>> >> > This series adds a configuration option to selectively compile out
>> >> > printk message strings based on a verbosity level.
>> >> >
>> >> > This works by wrapping printk with a macro which evaluates to a
>> >> > constant if condition which the compiler will be able to optimize
>> >> > out.
>> >> >
>> >> > However because printk might be wrapped by a macro it no longer has
>> >> > a return value. This means that constructs like the following ones
>> >> > don't work:
>> >> >
>> >> > ((void)(SOME_RANDOM_DEBUG_FLAG && printk(...));
>> >> >
>> >> > some_random_variable = printk(...);
>> >> >
>> >> > Therefore printk_unfiltered is introduced which is just an alias
>> >> > to the standard printk function but not wrapped by a macro.
>> >>
>> >> why dont you return 0 if it gets optimized away ? then you wont have
>> >> to screw with external code at all and things "just work".
>> >
>> > This won't work because it would for example also return from functions
>> > which call printk but aren't checking for the return value (which is
>> > the common case).
>>
>> why would it matter ?
>>
>> ({
>> int __printk_ret = 0;
>> if (crazy stuff you're adding)
>> __printk_ret = printk(.....);
>> __printk_ret;
>> })
>
> Yes I missunderstood your "return 0" statement in the first mail.
> The same effect could also be achieved by:
>
> ((crazy stuff) ? printk(...) : 0;
while true, i thought your (crazy stuff) pretty verbose and the
tertiary operator might get swallowed in the noise. not that it
matters that much to me as this is now a pure style choice ... your
patch, you pick.
-mike
prev parent reply other threads:[~2009-09-02 9:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 22:31 [RFC|PATCH] Compile time printk verbosity Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 1/7] printk: introduce CONFIG_PRINTK_VERBOSITY Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 2/7] printk: move printk to the end of the file Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 3/7] printk: introduce printk_unfiltered as an alias to printk Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 4/7] drivers: replace printk with printk_unfiltered Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 5/7] drivers: make macro independent of printk's return value Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 6/7] video/stk-webcam: change use of STK_ERROR Marc Andre Tanner
2009-09-01 22:31 ` [PATCH 7/7] printk: provide a filtering macro for printk Marc Andre Tanner
2009-09-01 23:24 ` Tim Bird
2009-09-01 23:32 ` H Hartley Sweeten
2009-09-02 13:09 ` Marc Andre Tanner
2009-09-02 17:05 ` Tim Bird
2009-09-02 17:31 ` Tim Bird
2009-09-02 18:22 ` H Hartley Sweeten
2009-09-04 14:05 ` Marc Andre Tanner
2009-09-10 9:22 ` Geert Uytterhoeven
2009-09-01 23:35 ` Jamie Lokier
2009-09-02 9:03 ` Marc Andre Tanner
2009-09-02 9:54 ` Marc Andre Tanner
2009-09-02 11:06 ` Jamie Lokier
2009-09-02 12:25 ` Bill Gatliff
2009-09-02 12:44 ` Marc Andre Tanner
2009-09-02 12:54 ` Mike Frysinger
2009-09-02 14:07 ` Marc Andre Tanner
2009-09-02 14:30 ` Jamie Lokier
2009-09-01 23:37 ` [RFC|PATCH] Compile time printk verbosity Mike Frysinger
2009-09-02 8:57 ` Marc Andre Tanner
2009-09-02 9:11 ` Mike Frysinger
2009-09-02 9:47 ` Marc Andre Tanner
2009-09-02 9:56 ` Mike Frysinger [this message]
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=8bd0f97a0909020256o2426d932x507f1193fa01c34c@mail.gmail.com \
--to=vapier.adi@gmail.com \
--cc=linux-embedded@vger.kernel.org \
--cc=mat@brain-dump.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;
as well as URLs for NNTP newsgroup(s).