public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Preprocess, but do not expand macros?
@ 2002-07-02 17:12 Larry Riedel
  2002-07-02 17:45 ` Gokhan Kisacikoglu
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Riedel @ 2002-07-02 17:12 UTC (permalink / raw)
  To: gcc-help


Is there a simple way for me to tell gcc/cpp to run
the preprocessor, but do nothing more than remove the
code which would not be present after if/ifdef/ifndef?
I can do "gcc -E" but that expands macros, puts line
numbers in, etc.


Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Preprocess, but do not expand macros?
  2002-07-02 17:12 Preprocess, but do not expand macros? Larry Riedel
@ 2002-07-02 17:45 ` Gokhan Kisacikoglu
  2002-07-02 18:43   ` Larry Riedel
  0 siblings, 1 reply; 5+ messages in thread
From: Gokhan Kisacikoglu @ 2002-07-02 17:45 UTC (permalink / raw)
  To: Larry Riedel; +Cc: gcc-help

Well the macros, namely "define" statements, are part of the
preprocessor directives. I never heard of the execution of the
preprocessor directives partially in the way you describe...

Gokhan

Larry Riedel wrote:
> 
> Is there a simple way for me to tell gcc/cpp to run
> the preprocessor, but do nothing more than remove the
> code which would not be present after if/ifdef/ifndef?
> I can do "gcc -E" but that expands macros, puts line
> numbers in, etc.
> 
> Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Preprocess, but do not expand macros?
  2002-07-02 17:45 ` Gokhan Kisacikoglu
@ 2002-07-02 18:43   ` Larry Riedel
  0 siblings, 0 replies; 5+ messages in thread
From: Larry Riedel @ 2002-07-02 18:43 UTC (permalink / raw)
  To: Gokhan Kisacikoglu; +Cc: gcc-help


> > Is there a simple way for me to tell gcc/cpp to run
> > the preprocessor, but do nothing more than remove the
> > code which would not be present after if/ifdef/ifndef?
> 
> Well the macros, namely "define" statements, are part
> of the preprocessor directives. [...]

To clarify, I would want the #define directives to be
processed, since otherwise the if/ifdef/ifndef might
not be meaningfully evaluated.  I simply do not want
the symbols defined by the #defines to be expanded.

before:
    #define PI 3.14
    #ifdef PI
        a = PI
    #endif

after:
        a = PI

instead of:
        a = 3.14


Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Preprocess, but do not expand macros?
  2002-07-03 10:36 landauer
@ 2002-07-03 13:59 ` Larry Riedel
  0 siblings, 0 replies; 5+ messages in thread
From: Larry Riedel @ 2002-07-03 13:59 UTC (permalink / raw)
  To: gcc-help; +Cc: landauer


> > Is there a simple way for me to tell gcc/cpp to run
> > the preprocessor, but do nothing more than remove the
> > code which would not be present after if/ifdef/ifndef?
> 
> Not gcc nor cpp itself, but there is a tool out there in
> some OS's that is called "unifdef".

I see.  Yes, in fact the comp.lang.c FAQ says something
about it... oops.  It looks like there is an unifdef in
the source for FreeBSD which may compile elsewhere too.


Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Preprocess, but do not expand macros?
@ 2002-07-03 10:36 landauer
  2002-07-03 13:59 ` Larry Riedel
  0 siblings, 1 reply; 5+ messages in thread
From: landauer @ 2002-07-03 10:36 UTC (permalink / raw)
  To: gcc-help; +Cc: larryr

> Is there a simple way for me to tell gcc/cpp to run
> the preprocessor, but do nothing more than remove the
> code which would not be present after if/ifdef/ifndef?

Not gcc nor cpp itself, but there is a tool out there in
some OS's that is called "unifdef".  It might be close
enough for your purposes.  You might want to search the
web to see whether it's available.

 -- Doug L.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-07-03 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-02 17:12 Preprocess, but do not expand macros? Larry Riedel
2002-07-02 17:45 ` Gokhan Kisacikoglu
2002-07-02 18:43   ` Larry Riedel
2002-07-03 10:36 landauer
2002-07-03 13:59 ` Larry Riedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).