Mart Raudsepp wrote:
#define printk(a, b, ...) if (a <= MAXLOGLEVEL) print(blah blah)
That's what I thought of at first too, but I was discouraged by Mart. Do you see a real problem with this, Mart?
Nope. that's similar to what I had in mind.
..
I would prefer avoiding compiler tricks when we can reach the goal just using cpp.
Yeah, and if(0) and the like is coercing gcc :)
Yes. I didn't write exactly what I meant. I was actually thinking even one more layer of cpp stuff, to check the condition. In theory like this;
#define printk(a, b...) \ #if (a) <= CONFIG_MAXLOGINCLUDE do_printk((a),(b)) \ #endif
Maybe that's too evil?
However I don't think using cpp for this really flies well if we are loosing __attribute__((format (printf, 2, 3))) checks then.
Agree.
//Peter