scpp and expanding ifdef's

K

Kenneth Porter

I need to work on some code with a terrifying number of ifdefs. According
to the comp.lang.c FAQ, the programs scpp, unifdef, and rmifdef can
selectively expand ifdef's and evaluate macro definitions without expanding
the macros in code. I've found some ancient source for scpp but it's
unmaintained and doesn't build with a modern flex and yacc. unifdef appears
not to parse macro values and expressions and doesn't do anything with
regular ifs, and much of my code uses ifs which depend on some expression
derived from defined macros.

Are there any other preprocessors that can do this kind of thing? I can't
see anything in the Gnu cpp man page that suggests that it can do this.
 
T

those who know me have no need of my name

in comp.lang.c i read:
I need to work on some code with a terrifying number of ifdefs. According
to the comp.lang.c FAQ, the programs scpp, unifdef, and rmifdef can
selectively expand ifdef's and evaluate macro definitions without expanding
the macros in code.

are you sure you want to do this? you intend to discard or ignore some
sections of the code?
I've found some ancient source for scpp but it's
unmaintained and doesn't build with a modern flex and yacc.

then your `modern' flex and yacc are broken.

sorry, i know of no tools other than those you've mentioned. perhaps you
would be satisfied with an editor that can hide some sections of code --
if so perhaps you can train (x)emacs to do it.
 
K

Kenneth Porter

are you sure you want to do this? you intend to discard or ignore
some sections of the code?

For purposes of reading and understanding, not because I'm getting rid of
anything. It's all live code, but it builds a zillion different ways and
has gotten very confusing with the density of conditionals.
then your `modern' flex and yacc are broken.

It's the stuff that comes with Red Hat 7.2. I'll try the stuff from RH9
shortly. But I suspect this is a case of changes to the flex/yacc internal
machinery over the past decade that the scpp source was depending on. (The
comments say that it has some workarounds for limits in flex, and those
workarounds probably need to be rethought.)
sorry, i know of no tools other than those you've mentioned. perhaps
you would be satisfied with an editor that can hide some sections of
code -- if so perhaps you can train (x)emacs to do it.

I'd read somewhere that Coderight can do it.

My regular editor, Lugaru Epsilon, can show what conditionals (including
#elses) are in effect at the cursor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top