Skip to content

Add QT_USE_NAMESPACE macro#6864

Merged
chrchr-github merged 1 commit intocppcheck-opensource:mainfrom
bjornblissing:QT_NAMESPACE
Oct 6, 2024
Merged

Add QT_USE_NAMESPACE macro#6864
chrchr-github merged 1 commit intocppcheck-opensource:mainfrom
bjornblissing:QT_NAMESPACE

Conversation

@bjornblissing
Copy link
Copy Markdown
Contributor

@bjornblissing bjornblissing commented Oct 5, 2024

The macro QT_USE_NAMESPACE should expand to nothing for most Qt builds, i.e. built with an empty QT_NAMESPACE variable.

However if Qt is built using a custom namespace then all forward declarations must be wrapped with QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. Today CppCheck defines these macros as empty, thus QT_USE_NAMESPACE should be empty as well.

Reference:
https://wiki.qt.io/Qt_In_Namespace

The macro `QT_USE_NAMESPACE` should expand to nothing for most Qt builds, i.e.
built with an empty `QT_NAMESPACE` variable.
@chrchr-github chrchr-github merged commit e8f6d1f into cppcheck-opensource:main Oct 6, 2024
ludviggunne pushed a commit to ludviggunne/cppcheck that referenced this pull request Oct 19, 2024
The macro `QT_USE_NAMESPACE` should expand to nothing for most Qt
builds, i.e. built with an empty `QT_NAMESPACE` variable.

However if Qt is built using a custom namespace then all forward
declarations must be wrapped with `QT_BEGIN_NAMESPACE` and
`QT_END_NAMESPACE`. Today CppCheck defines these macros as empty, thus
`QT_USE_NAMESPACE` should be empty as well.

Reference:
https://wiki.qt.io/Qt_In_Namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants