ImportProject: Read max template recursion configuration value
This commit is contained in:
parent
b09bcdc38c
commit
57187ef876
|
@ -1098,6 +1098,8 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
|
||||||
temp.checkUnusedTemplates = (strcmp(node->GetText(), "true") == 0);
|
temp.checkUnusedTemplates = (strcmp(node->GetText(), "true") == 0);
|
||||||
else if (strcmp(node->Name(), CppcheckXml::MaxCtuDepthElementName) == 0)
|
else if (strcmp(node->Name(), CppcheckXml::MaxCtuDepthElementName) == 0)
|
||||||
temp.maxCtuDepth = std::atoi(node->GetText());
|
temp.maxCtuDepth = std::atoi(node->GetText());
|
||||||
|
else if (strcmp(node->Name(), CppcheckXml::MaxTemplateRecursionElementName) == 0)
|
||||||
|
temp.maxTemplateRecursion = std::atoi(node->GetText());
|
||||||
else if (strcmp(node->Name(), CppcheckXml::CheckUnknownFunctionReturn) == 0)
|
else if (strcmp(node->Name(), CppcheckXml::CheckUnknownFunctionReturn) == 0)
|
||||||
; // TODO
|
; // TODO
|
||||||
else if (strcmp(node->Name(), Settings::SafeChecks::XmlRootName) == 0) {
|
else if (strcmp(node->Name(), Settings::SafeChecks::XmlRootName) == 0) {
|
||||||
|
|
|
@ -174,8 +174,11 @@ Cppcheck output:
|
||||||
As you can see Cppcheck has instantiated `a<i+1>` until `a<101>` was reached
|
As you can see Cppcheck has instantiated `a<i+1>` until `a<101>` was reached
|
||||||
and then it bails out.
|
and then it bails out.
|
||||||
|
|
||||||
One way to make Cppcheck analysis faster is to limit the recursion with a
|
To limit template recursion you can;
|
||||||
template specialisation. For instance:
|
* add template specialisation
|
||||||
|
* configure cppcheck (in the GUI project file dialog)
|
||||||
|
|
||||||
|
Example code with template specialisation:
|
||||||
|
|
||||||
template <int i>
|
template <int i>
|
||||||
void a()
|
void a()
|
||||||
|
|
Loading…
Reference in New Issue