On Tue, Feb 10, 2009 at 9:03 AM, Peter Stuge peter@stuge.se wrote:
Mart Raudsepp wrote:
The log level is now given with an argument, so it's trickier to get the code excluded from the binary completely.
Maybe split it up then? (But _only_ statics within the printk code!)
Actually it's not that hard.
You have a global , MAXLOGLEVEL. Turn printk into something like this:
#define printk(a, b, ...) if (a <= MAXLOGLEVEL) print(blah blah)
and then let the compiler optimize it all out.
It's kind of like if (0) { etc. etc. }
Likely can coerce gcc to do that with specially crafted code.
I would prefer to avoid that.
This is very non-special
ron