Messages in this thread |  | | From | Peter Samuelson <> | Date | Tue, 21 Nov 2000 06:02:35 -0600 (CST) | Subject | beware of dead string constants |
| |
While trying to clean up some code recently (CONFIG_MCA, hi Jeff), I discovered that gcc 2.95.2 (i386) does not remove dead string constants:
void foo (void) { if (0) printk(KERN_INFO "bar"); }
Annoyingly, gcc forgets to drop the "<6>bar\0". It shows up in the object file, needlessly clogging your cachelines.
This has ramifications for anyone thinking of converting #ifdefs to if(){}, which is supposed to be the way of the future. In my situation I am trying to convert '#ifdef CONFIG_MCA' to 'if (MCA_bus)' where MCA_bus is #defined to 0 on most architectures.
'static' variables in block scope, same story.
This is mostly a heads-up to say that in this regard gcc is not ready for prime time, so we really can't get away with using if() as an ifdef yet, at least not without penalty.
I've just asked gcc-help@gcc.gnu.org about this; if I hear anything interesting I'll report back.
Peter - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |