FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed Qt config macro declaration by Daschle-Newberry · Pull Request #8796 · cppcheck-opensource/cppcheck · GitHub

Fixed Qt config macro declaration - #8796

Open
Daschle-Newberry wants to merge 1 commit into
cppcheck-opensource:mainfrom
Daschle-Newberry:main
Open

Fixed Qt config macro declaration#8796
Daschle-Newberry wants to merge 1 commit into
cppcheck-opensource:mainfrom
Daschle-Newberry:main

Conversation

Copy link
Copy Markdown

The macro definition of Q_ASSERT_X results in false positives.

Example

#include <QDebug>

void test()
{
    const char *where = "test";
    const char *what = "assertion failed";

    Q_ASSERT_X(false, where, what);
}

This code block results in:

style: Variable 'where' is assigned a value that is never used. [unreadVariable]
style: Variable 'what' is assigned a value that is never used. [unreadVariable]

The existing definition discards where and what arguments when modeling Q_ASSERT_X. The fix preserves these arguments using (void) (what) and (void) (where)

Copy link
Copy Markdown
Collaborator

Thanks for your contribution. Please add a test in test/cfg/qt.cpp.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL