raydac / java-comment-preprocessor

preprocessor for computer languages with C-like comment format (C/C++/Java/Go)
Apache License 2.0
172 stars 27 forks source link

JCP fails on unknown value #17

Closed reisi007 closed 7 years ago

reisi007 commented 7 years ago

Hi,

I am using JCP for a product line. If a feature is included (e.g. for the feature belt) //#define belt is added. Currently //#if belt && dev fails, if belt or dev is unknown. Note that this is possible to rewrite as 2 //#ifdef after each other, which is not possible with //#if belt || dev. It would be great to have a way to treat all undefined variables as false in the #if...

Thanks!

raydac commented 7 years ago

ok, I will add special flag to recognize unknown variables as FALSE

raydac commented 7 years ago

added /U CLI option and unknownVarAsFalse boolean option into Maven and ANT to enable interpretation of unknown variables as FALSE, information about detection of such variables will be printed if caller in debug mode, now you can try

reisi007 commented 7 years ago

Thanks! Works as expected 😀