ned14 / pcpp

A C99 preprocessor written in pure Python
Other
220 stars 41 forks source link

Support for `__has_include` #97

Open akrzemi1 opened 9 months ago

akrzemi1 commented 9 months ago

I was trying to use pcpp (1.30) on this header-only library: https://github.com/tzlaine/parser

I am using command

/home/andrzej/.local/bin/pcpp boost/parser/parser.hpp -UBOOST_PARSER_DOXYGEN -I.

I am encountering two problems.

  1. The tool seems not to recognize __has_include and ends with an error when it encounters one.
  2. The rendered output is missing content. E.g., there is no #define even though one sees plenty of them when one looks through the header files of the library.

Any help would be most appreciated.

ned14 commented 9 months ago

https://github.com/ned14/pcpp/issues/53 has a workaround for lack of __has_include.

Unless you turn on a --passthru-* option pcpp will behave like a normal C++ preprocessor and expand all macros.

ned14 commented 9 months ago

FYI https://github.com/ned14/outcome/blob/develop/CMakeLists.txt#L115 is how Outcome uses pcpp to generate its single include edition, and may be a good source of inspiration.