Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27473

Preprocessor can't find computed includes

XMLWordPrintable

    • Linux/X11
    • 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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kandeler Christian Kandeler
            d_garry Igor R
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes