CPP macro expansion

Dave Gotwisner Dave.Gotwisner@harmonicinc.com
Wed Nov 5 00:05:00 GMT 2003


He is.  A quick search on google for "C beautify" yields bcpp (and other
programs).  I was aware of one from years ago called cb, but couldn't find
it (not on redhat distro, 5 minutes of search didn't find it).  CBPP appears
to be something similar, but supporting C++ as well as C.  I suspect that he
can try "gcc -E file.c | cb > file.fmt" or some such (assuming cb and bcpp
support stdin/stdout data transports).

	Dave

-----Original Message-----
From: Falk Hueffner [mailto:falk.hueffner@student.uni-tuebingen.de]
Sent: Tuesday, November 04, 2003 3:25 PM
To: lrtaylor@micron.com
Cc: robyf@tekno-soft.it; gcc-help@gcc.gnu.org
Subject: Re: CPP macro expansion


lrtaylor@micron.com writes:

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On 
> 
> > > I need to obtain a preprocessed C source output, the source
> > > code that will go to the gcc compiler proper, with all the macro
> > > functions expanded as declared with its multi line
> > > formatting/indentation
> > > and not as usual single long line. I need to check my final code
> before
> > > the full compilation.
> > > 
> > > Does anyone know how can I do ?
> > > Does the GNU CPP permit this ?
> 
> > No.
> 
> Not so.  Pass the -E option to gcc (or g++).  This will cause it to
> output the preprocessed source code:
> 
> gcc -E file.c

Maybe I misunderstood the question. I thought the problem was to get
from

#define F {      \
            bla; \
          }
F

to
{      
   bla;
}

whereas gcc -E produces

{ bla; }

-- 
	Falk



More information about the Gcc-help mailing list