/home/tkloczko/rpmbuild/BUILD/cppcheck-2.4/lib/symboldatabase.cpp: In member function ‘void SymbolDatabase::createSymbolDatabaseExprIds()’:
/home/tkloczko/rpmbuild/BUILD/cppcheck-2.4/lib/symboldatabase.cpp:1443:32: error: ‘numeric_limits’ is not a member of ‘std’
1443 | if (id == std::numeric_limits<nonneg int>::max()) {
| ^~~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/cppcheck-2.4/lib/symboldatabase.cpp:1443:54: error: expected primary-expression before ‘int’
1443 | if (id == std::numeric_limits<nonneg int>::max()) {
| ^~~
/home/tkloczko/rpmbuild/BUILD/cppcheck-2.4/lib/symboldatabase.cpp:1443:47: error: expected ‘)’ before ‘int’
1443 | if (id == std::numeric_limits<nonneg int>::max()) {
| ~ ^ ~~~
| )
This patch adds missing `include #include <limits>`
Co-authored-by: Your Name <you@example.com>
It is necessary to use a fake NameAndToken in
mTypesUsedInTemplateInstantiation rather than a Token pointer so the
template simplifiers internal state is kept valid when tokens are
deleted. This prevents a use after free.
Co-authored-by: Robert Reif <reif@FX6840>
* small template simplifier optimization
* don't look for template parameter name in default values
* fix cppcheck warning
* add test for TemplateSimplifier::getTemplateParametersInDeclaration()
Also removed TemplateSimplifier::getTemplateParametersInDeclaration()
return value since it wasn't used.
* added another test
Co-authored-by: Robert Reif <reif@FX6840>
Fix faulty removal of parenthesis when "]" is followed by parenthesis
with a number inside, for example when calling a function pointer in
an array or (perhaps more common) in c++, calling operator ( on an
element in an array.
Fixes#8875 where such wrong simplification lead to a FP with too many
bits shifted due to "<<" was interpreted like a shift operator rather
than a stream output.
Improve leak detections in if-statements. This is done by checking
for leaks every time a scope is left. This allows cppcheck to catch
more memory leaks, as well as improve some error messages which now
contain the line where the variable goes out of scope, instead of the
end of the function.