Clang Intellisense Play Nice With declspec

Sysprogs forums Forums VisualGDB Clang Intellisense Play Nice With declspec

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22168
    aronrubin
    Participant

    Clang IntelliSense is acting as if __declspec(x)=x and putting dllimport where it does not belong. I have -fdeclspec -fms-extensions in both my cmake files and VisualGDB Project Properties. Here is the context:

    #define Q_DECL_IMPORT __declspec(dllimport)   (qcompilerdetection.h:220)
    #define Q_CORE_EXPORT Q_DECL_IMPORT           (qglobal.h:360)
    class Q_CORE_EXPORT QObject                  (qobject.h:117)
     { ...

    The result is:

    [Clang IntelliSense] Error: ‘__declspec’ attributes are not enabled; use ‘-fdeclspec’ or ‘-fms-extensions’ to enable support for __declspec attributes
    [Clang IntelliSense] Error: redefinition of ‘dllimport’    C:\msys64\mingw64\include\QtCore\qobject.h 117

    Please help as this interferes with all subsequent processing of the project.

     

    • This topic was modified 6 years, 1 month ago by aronrubin. Reason: Format error
    • This topic was modified 6 years, 1 month ago by support. Reason: formatting
    #22171
    support
    Keymaster

    Hi,

    Please try adding the following lines to your main header:

    #ifdef SYSPROGS_CODESENSE
    #define __declspec(x)
    #endif

    This should force the Clang IntelliSense to ignore the __declspec modifier altogether.

    #22172
    aronrubin
    Participant

    Same result. It is unclear to me whether that define is being carried into parsing of qobject.h and below.

    #22183
    support
    Keymaster

    Hi,

    Most likely you have defined the macro after the Qt header files were included. Either way, we have added the definition to ignore __declspec() to VisualGDB 5.4 Preview 6. Please feel free to update to this version – it will automatically skip __declspec() in your code.

    #22191
    aronrubin
    Participant

    You rock. That did the trick!

    (Now on to the next issue, revealed when this issue was fixed 😉 … I will post separately.)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.