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

Code mode doesn't parse headers added via a compiler options anymore

    XMLWordPrintable

Details

    • All
    • 57fbf9bef9 (qt-creator/qt-creator/7.0) 57fbf9bef9 (qt-creator/qt-creator/master) 57fbf9bef9 (qt-creator/tqtc-qt-creator/7.0)

    Description

      Latest working version is https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=448446bd7ed40e1adbd1b66cdf92e50a125da5f3, next commit https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=9c3420120ea9b477a8677de667e0b3dc5375159b doesn't work. Tested also on latest commit in 7.0 branch https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?h=7.0&id=2090d043db2991af964a546cebf39c996b7236c5

      In the test project we have a configurable file:

      define.h.in
      #define TEST_IMPORT @TEST_IMPORT@
      #define TEST_EXPORT @TEST_EXPORT@
      

      We configure it:

      set(DEFINE_HEADER ${CMAKE_CURRENT_BINARY_DIR}/define.h)
      
      set(TEST_IMPORT "")
      set(TEST_EXPORT "__attribute__ ((visibility(\"default\")))")
      
      configure_file(define.h.in "${DEFINE_HEADER}" @ONLY)
      

      and include it everywhere with a compiler option:

      add_compile_options(-include "${DEFINE_HEADER}")
      

      We also set CMake property to use either import or export definition as Module_EXPORT define:

      set_target_properties(TestQtCreatorExport PROPERTIES
          INTERFACE_COMPILE_DEFINITIONS "Module_EXPORT=TEST_IMPORT"
          COMPILE_DEFINITIONS "Module_EXPORT=TEST_EXPORT")
      

      In the code we use this define:

      Test.h
      class Module_EXPORT Test;
      

      With old version this works, recent versions produces error:

      /home/nkrupenko/Development/TestQtCreatorExport/Test.h:4: error: Variable has incomplete type 'class TEST_EXPORT'
      /home/nkrupenko/Development/TestQtCreatorExport/Test.h:4: Forward declaration of 'TEST_EXPORT'
      

      Attached full test project.

      Attachments

        Activity

          People

            kandeler Christian Kandeler
            nkrupenko.nvidia Nikita Krupenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: