tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] More fun with comparison between pointer and integer...


From: Rob Landley
Subject: [Tinycc-devel] More fun with comparison between pointer and integer...
Date: Wed, 5 Sep 2007 00:11:01 -0500
User-agent: KMail/1.9.6

So in my toybox project (which I'm trying to build with tcc), I'm pulling a 
dirty trick to do dead code elimination on gcc.  Basically, I have macros 
that boil down to:

static const int blah = ptr || ptr || ptr || ptr || 0;

with the various ptr entries being either a string constant or NULL.  (And 
they can be #ifdefed out, so the last 0 is there to make sure there's always 
something to assign).  Then, if this thing resolves to 0, the various if() 
statements that test it get chopped out by dead code elimination, and the 
command line option parsing code goes bye-bye if unused.

I fixed the "ptr || ptr" bit not working (check hg), and I just made it stop 
warning me about "comparison between pointer and int" for && and ||, but now 
it's saying "initializer element not constant".

Sigh.

It's too bad there isn't a channel for this on freenode.  I'd love to be able 
to ask people about this.  I hang out on my own channel (#firmware) most of 
the time, but nobody there seems to know more about tcc than I do. :)

Rob 
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]