Closed trelau closed 3 years ago
Good
Can confirm the bug and the fix, PR at https://github.com/ned14/pcpp/pull/58
Thanks for the BR. Will try to process later this week.
Fixing this was much harder than expected. Thanks @virtuald for the PR, however it broke other stuff. It turned out the original implementation was simply incorrect, and hopefully now it works as it is supposed to.
Great tool. I'm preprocessing some header files to expand macros, but I don't care to pull the included content into the file. This is more or less the effect I am trying to achieve https://github.com/ned14/pcpp/pull/51.
When I use the
passthru_includes
option it doesn't seem to add a new line after the include file and it makes my downstream parsing break. Attached are a few sample files to demonstrate the issue. If you processfoo.hxx
, I'd expect to get:but instead I get (notice
class A
is not on the new line):Contents of
foo.hxx
:and contents of
bar.hxx
:At this location of the source :
https://github.com/ned14/pcpp/blob/113605e5827295eafce675c99df89c45b6c4b475/pcpp/preprocessor.py#L897-L898
if I simply return a new line token after the
precedingtoks
anddirtokens
loops then things come out fine. I tried to overrideon_directive_handle
to handle it there, but couldn't quite get it right.