-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
Qt Creator 4.15.2
-
-
93d1c3106 (master)
Code example:
#define INC_HDR(hdr) <hdr>
#include INC_HDR(stdio.h)
void main() { }
Result (in code editor):
- orange underline at line 2
- when hovering over it, message "stdio.h: No such file or directory"
#include <stdio.h> certainly works fine, and the project can be built in both cases (with or w/o using INC_HDR macro).
The reason seems to be somewhere in src/libs/cplusplus/pp-engine.cpp (to be more specific, in void Preprocessor::synchronizeOutputLines() method), that appends newlines during expansion of "INC_HDR(stdio.h)" into something like "\n<\nstdio.h>". And it's the "\nstdio.h" file that cannot be found and finally causes "messageNoSuchFile" at void CppSourceProcessor::sourceNeeded() method (see src/plugins/cpptools/cppsourceprocessor.cpp).
Unfortunately, i'm not deeply familiar with things like C++ tokenization, AST and so on, so any help or advice would be very useful.
For Gerrit Dashboard: QTCREATORBUG-27473 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
663592,3 | CPlusPlus: Fix preprocessor expansion in include directives | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |