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
Forum Update on Monday, May 27th 2025

Q_GLOBAL_STATIC failed to expand macro, cppcheck

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 168 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 13 Feb 2025, 10:10 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 13 Feb 2025, 20:14 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 19 Feb 2025, 09:21 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

        1/3

        13 Feb 2025, 10:10

        • Login

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