pcpp icon indicating copy to clipboard operation
pcpp copied to clipboard

Support for `__has_include`

Open akrzemi1 opened this issue 1 year ago • 2 comments

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.

akrzemi1 avatar Feb 05 '24 22:02 akrzemi1

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 avatar Feb 05 '24 22:02 ned14

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.

ned14 avatar Feb 05 '24 22:02 ned14