Issue 1: The nonreturn on the Q_ASSERT isn't detected properly. Converting the Q_ASSERT macro to use if/else instead of an inline conditional makes this issue go away.
Issue 2: sayHello is wrongly marked as never used. As you can see from the output when the code is run, sayHello does get used!
Thanks for taking the time to read this bug report!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the detailed bug report.
I can reproduce the issues so I have created a ticket with your bug report: https://trac.cppcheck.net/ticket/9602
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I'd like to report two false positives in cppcheck 1.90
Here's some code that reproduces them:
The code compiles and runs in C, like so:
$ gcc temp.c; ./a.out Hello World
But checking with cppcheck produces this output:
Issue 1: The nonreturn on the Q_ASSERT isn't detected properly. Converting the Q_ASSERT macro to use if/else instead of an inline conditional makes this issue go away.
Issue 2: sayHello is wrongly marked as never used. As you can see from the output when the code is run, sayHello does get used!
Thanks for taking the time to read this bug report!
Thank you for the detailed bug report.
I can reproduce the issues so I have created a ticket with your bug report: https://trac.cppcheck.net/ticket/9602