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

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