[coreboot] CONFIG_ about which messages to compile in

Peter Stuge peter at stuge.se
Tue Feb 10 18:14:11 CET 2009

ron minnich 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.

Yep, that's right.

> 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.

That's what I thought of at first too, but I was discouraged by Mart.
Do you see a real problem with this, Mart?

> >> Likely can coerce gcc to do that with specially crafted code.
> >
> > I would prefer to avoid that.
> This is very non-special

Yep, it's all at cpp time and not at all strange. I would prefer
avoiding compiler tricks when we can reach the goal just using cpp.


More information about the coreboot mailing list