dpp icon indicating copy to clipboard operation
dpp copied to clipboard

Fix #307 - not to resolve include path if possible

Open tom-tan opened this issue 1 year ago • 1 comments

It is caused by the combination of system include paths and the use of #include_next directive in the system headers.

In the example I shown in the issue, the dpp first resolves stdint.h to /usr/lib/llvm-10/lib/clang/10.0.0/include/stdint.h and tries to expand it. However, #include_next <stdint.h> directive in /usr/lib/llvm-10/lib/clang/10.0.0/include/stdint.h accidentally includes the same header and failed to include /usr/include/stdint.h (it is intended to be included) due to the include guard.

This request fixes this issue by not to resolve the header path if it is in the system paths or specified include paths.

tom-tan avatar Jul 20 '22 15:07 tom-tan

This needs a test.

atilaneves avatar Aug 09 '22 20:08 atilaneves

Done!

I used CPATH rather than using --include-path because the headers added by the latter are not treated as system headers by clang.systemPaths. I added a fallback for preprocessors that does not support include_next because this directive is platform dependent, I guess.

tom-tan avatar Aug 19 '22 09:08 tom-tan

Red CI.

atilaneves avatar Aug 24 '22 17:08 atilaneves

I accidentally closed this issue but reopened it.

tom-tan avatar Aug 25 '22 06:08 tom-tan

Thanks!

tom-tan avatar Aug 26 '22 03:08 tom-tan