Skip to content

Conversation

@danmar
Copy link
Owner

@danmar danmar commented Dec 2, 2025

No description provided.

@danmar danmar marked this pull request as ready for review December 2, 2025 13:14
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

@firewave
Copy link
Collaborator

firewave commented Dec 3, 2025

externals/simplecpp/simplecpp.cpp:3247:52: warning: Either the condition '!tmp' is redundant or there is possible null pointer dereference: tok. [nullPointerRedundantCheck]
    const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end();
                                                   ^
externals/simplecpp/simplecpp.cpp:3678:29: note: Assuming that condition '!tmp' is not redundant
                        if (!tmp)
                            ^
externals/simplecpp/simplecpp.cpp:3674:52: note: Calling function 'preprocessToken', 2nd argument 'tmp' value is 0
                        if (!preprocessToken(expr, tmp, macros, files, outputList)) {
                                                   ^
externals/simplecpp/simplecpp.cpp:3246:42: note: Assignment 'tok=tok1', assigned value is 0
    const simplecpp::Token * const tok = tok1;
                                         ^
externals/simplecpp/simplecpp.cpp:3247:52: note: Null pointer dereference
    const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end();
                                                   ^
externals/simplecpp/simplecpp.cpp:3247:76: warning: Either the condition '!tmp' is redundant or there is possible null pointer dereference: tok. [nullPointerRedundantCheck]
    const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end();
                                                                           ^
externals/simplecpp/simplecpp.cpp:3678:29: note: Assuming that condition '!tmp' is not redundant
                        if (!tmp)
                            ^
externals/simplecpp/simplecpp.cpp:3674:52: note: Calling function 'preprocessToken', 2nd argument 'tmp' value is 0
                        if (!preprocessToken(expr, tmp, macros, files, outputList)) {
                                                   ^
externals/simplecpp/simplecpp.cpp:3246:42: note: Assignment 'tok=tok1', assigned value is 0
    const simplecpp::Token * const tok = tok1;
                                         ^
externals/simplecpp/simplecpp.cpp:3247:76: note: Null pointer dereference
    const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end();
                                                                           ^

This appears to be a false positive. I filed https://trac.cppcheck.net/ticket/14308 about it.

@firewave firewave marked this pull request as draft December 3, 2025 21:17
@firewave
Copy link
Collaborator

firewave commented Dec 3, 2025

This appears to be a false positive. I filed https://trac.cppcheck.net/ticket/14308 about it.

So unless you get a quick fix for this we can suppress it in the selfcheck (with the actual line as the source is fixed to avoid others to be missed in the future).

@firewave
Copy link
Collaborator

firewave commented Dec 7, 2025

#8014 is attempting to fix the false positives.

@chrchr-github
Copy link
Collaborator

#8014 is attempting to fix the false positives.

Looks like that will take a while, so we should probably just suppress the FP for the moment.

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