Keeping blank lines in C++ preproccessor output

Kevin P. Fleming kpfleming@digium.com
Tue Jan 10 17:01:00 GMT 2012


On 01/07/2012 01:05 PM, Ian Lance Taylor wrote:
> <galexander2@nc.rr.com>  writes:
>
>> I'm using the C++ preprocessor (g++ -E) to partially preprocess a C++ header file.  The preprocessor output documentation (http://gcc.gnu.org/onlinedocs/gcc-4.6.2/cpp/Preprocessor-Output.html#Preprocessor-Output) states:
>>
>>    Long runs of blank lines are discarded.
>>
>> Rather than have long runs of blank lines discarded, I would prefer that runs of two or more blank lines be replaced by single blank line or be left as is.  Does anyone know of a way to accomplish either of these?
>
> As far as I know there is no way to do this (other than modifying the
> preprocessor code).  It would not be too hard to write a postprocessor
> which looked at the #line statements and recreated the blank lines.

You could also use MCPP if you wish to roll your own preprocessing tool 
with more control over the output.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming@digium.com | SIP: kpfleming@digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the Gcc-help mailing list