$ cppcheck --enable=all --inconclusive test.cpp
Checking test.cpp ...
a.hpp:3:10: performance:inconclusive: Technically the member function 'A::f' can be static (but you may consider moving to unnamed namespace). [functionStatic]
void f() { g(1); }
^
I am not sure how to write a test for this one, since the FP only occurs if both files are separate. If you merge both files, the FP disappears.
Could you give me some pointers on how to write a test for this with two files?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe this should be fixed in the TemplateSimplifier. That is pretty complex code and I would say it's difficult to understand it. But feel free to take a look at it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Templates are automatically erased from header files and there is no way to change that behavior from the command line. See https://trac.cppcheck.net/ticket/9977
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a.hpp:
test.cpp:
With 7e8f405:
I am not sure how to write a test for this one, since the FP only occurs if both files are separate. If you merge both files, the FP disappears.
Could you give me some pointers on how to write a test for this with two files?
look at the debug output. the template simplification is not made properly neither when the code is in the same file or not.
I created ticket: https://trac.cppcheck.net/ticket/9975
I believe this should be fixed in the TemplateSimplifier. That is pretty complex code and I would say it's difficult to understand it. But feel free to take a look at it.
There is a fix here: https://github.com/danmar/cppcheck/pull/2894
That fix doesn't work for me, the error persists as described in the ticket.
The test case probably does not reflect the issue of having the struct in a header. I have no idea if you can even write such a test.
No worry.. Robert fixed the issue I reported.. we can fix more issues iteratively..
I created ticket https://trac.cppcheck.net/ticket/9977
Templates are automatically erased from header files and there is no way to change that behavior from the command line. See https://trac.cppcheck.net/ticket/9977
I have fixed 9977 and now I can't reproduce the FP functionStatic warning.