[lkml]   [2000]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectbeware 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

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 about this; if I hear anything
interesting I'll report back.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:47    [W:1.243 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site