Subject: Re: [boost] [preprocessing] Feedback requested on a C99 preprocessor written in pure universal Python
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-03-07 16:16:17
>> pcpp by default acts as a straight preprocessor, but it can also be told
>> to pass through #if logic it can't fully execute due to unknowns, or
>> partially execute #if logic. It can be told to pass through #define and
>> #undef but also execute them (or not) on a per-macro basis. It would be
>> easy enough to tell it to not execute any preprocessing commands except
>> #include and include guards for example.
> The practical problem with this is that source files with preprocessor
> directives often depend on the compiler being used, with its predefined
> macros, to generate the correct output.
Do note pcpp can pass through #if logic which uses undefined macros. So
as compiler specific macros will be undefined, all #if logic relating to
them passes through. The output is therefore still portable across
Don't get me wrong, there is still a small amount of hand tuning
involved, so a human does need to grok the output and make sure it's
coming out okay and if not, add another command line argument to force
things. But so far, at least for Outcome, it is coming out pretty much
right first time (though this entirely could be how I write my
preprocessor, and Outcome being all C++ 14 doesn't support broken
compilers except for MSVC. So my use case is much simpler than most).
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk