Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Q_GLOBAL_STATIC failed to expand macro, cppcheck

Q_GLOBAL_STATIC failed to expand macro, cppcheck

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 161 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    majorRonk
    wrote on last edited by majorRonk
    #1

    I'm using Qt 6.5.2 and cppcheck 2.7 on Ubuntu 22.04.5.

    I compile and run code like this without any problem in QtCreator:

    Q_GLOBAL_STATIC(const QString, ExampleContext, "ExampleInterface")
    

    But i get a warning when i run cppcheck --qt=library ... (version 2.7)

    "failed to expand Q_GLOBAL_STATIC
    Wrong number of parameters for macro"

    I included header <QGlobalStatic> witch points to

    #define Q_GLOBAL_STATIC(TYPE, NAME, ...)                                    \
        Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, (__VA_ARGS__))
    

    I'dont know whats wrong here.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you sure that this version of cppcheck has definitions that supports this macro ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        majorRonk
        wrote on last edited by
        #3

        Could be. We are currently trying to fix it with cppcheck --project=compile_commands.json ... . Lets see if it works.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved