Subject: Re: [boost] [preprocessing] Feedback requested on a C99 preprocessor written in pure universal Python
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2017-03-07 17:09:05
>> Do note pcpp can pass through #if logic which uses undefined macros.
>> as compiler specific macros will be undefined, all #if logic relating
>> them passes through. The output is therefore still portable across
> Passing through all #if logic cannot be right !
> #if SOME_PREDEFINED_MACRO >= some_value
> #if SOME_PREDEFINED_MACRO < some_value
Do you care to elaborate? If pcpp does not touch the lines above(i.e.
passes through everything including the #ifdef) i can hardly see a
problem for the next level preprocessor of the original compiler
> If both "some_code" and "some_other_code" are passed through I doubt
> the output will be correct.
> Because of quirks in compiler preprocessors. especially VC++, a great
> deal of macro logic in Boost PP and Boost VMD is based in identifying
> compilers and their levels of C/C++ standards compliance, which is
> done by compiler predefined macros. I would imagine that this could be
> extended to others writing their own macros, whether they use Boost
> PP/VMD or not. Of course various cross-platform header files also
> depend on such information.
> I am not trying to minimize your effort in any way in writing pcpp. I
> am just saying that to use it as the preprocessor front-end for
> various compilers is more complicated than I believe you think. Unless
> pcpp can create the same predefined macros which the backend
> compiler's preprocessor creates I doubt if the output can be reliable
> in many situations.
>> 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).
> Unsubscribe & other changes: