Subject: Re: [boost] [preprocessing] Feedback requested on a C99 preprocessor written in pure universal Python
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-03-07 18:52:18
On 3/7/2017 12:19 PM, Niall Douglas via Boost wrote:
>>> 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
>> Passing through all #if logic cannot be right !
>> #if SOME_PREDEFINED_MACRO >= some_value
>> #if SOME_PREDEFINED_MACRO < some_value
>> If both "some_code" and "some_other_code" are passed through I doubt the
>> output will be correct.
> Edward, it passes through the #if statements and their associated #endif
> etc, not just the clauses they wrap.
> So basically if it can't execute an #if because the expression contains
> an undefined macro, it pass through the entire thing which can be
> executed by a later preprocessor.
> Does this make sense now?
>> 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
> It only part-executes the preprocessor commands, leaving behind the
> stuff you tell it.
> There is an example of the pass through on the front page of the github
> if that helps. It shows the partial execution and pass through of
> preprocessor commands.
I did not understand what you meant by passthrough. In that case pcpp
only serves as first level preprocessor and will very often need a
second level preprocessor to fully preprocess the code. OK, I now
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk