diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 9688e1915..39970a693 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -67,7 +67,7 @@ void ProjectFile::clear() mClangAnalyzer = mClangTidy = false; mAnalyzeAllVsConfigs = false; mCheckHeaders = true; - mCheckUnusedTemplates = false; + mCheckUnusedTemplates = true; mMaxCtuDepth = settings.maxCtuDepth; mMaxTemplateRecursion = settings.maxTemplateRecursion; mCheckUnknownFunctionReturn.clear(); diff --git a/gui/projectfiledialog.ui b/gui/projectfiledialog.ui index f8f459be4..343dab7d9 100644 --- a/gui/projectfiledialog.ui +++ b/gui/projectfiledialog.ui @@ -17,7 +17,7 @@ - 0 + 2 @@ -503,7 +503,7 @@ - Check code in headers (slower analysis, more results) + Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF) true @@ -513,7 +513,10 @@ - Check code in unused templates (slower and less accurate analysis) + Check code in unused templates (should be ON normally. however in theory there is no safety implications if there is something bad in a unused template so they can be skipped safely to reduce warnings and speed up analysis) + + + true diff --git a/lib/settings.cpp b/lib/settings.cpp index 0d8629c7e..f59e05aee 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -35,7 +35,7 @@ Settings::Settings() checkConfiguration(false), checkHeaders(true), checkLibrary(false), - checkUnusedTemplates(false), + checkUnusedTemplates(true), clang(false), clangExecutable("clang"), clangTidy(false), diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 458a145da..14a277689 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -349,18 +349,15 @@ private: "};"); ASSERT_EQUALS("", errout.str()); - const char code[] = "template struct A {\n" - " A() : x(0) { }\n" - " A(const T & t) : x(t.x) { }\n" - "private:\n" - " int x;\n" - " int y;\n" - "};"; - check(code); - ASSERT_EQUALS("", errout.str()); - check((code + std::string("A a(10);")).c_str()); - ASSERT_EQUALS("[test.cpp:2]: (warning) Member variable 'A < int >::y' is not initialized in the constructor.\n" - "[test.cpp:3]: (warning) Member variable 'A < int >::y' is not initialized in the constructor.\n", errout.str()); + check("template struct A {\n" + " A() : x(0) { }\n" + " A(const T & t) : x(t.x) { }\n" + "private:\n" + " int x;\n" + " int y;\n" + "};"); + ASSERT_EQUALS("[test.cpp:2]: (warning) Member variable 'A::y' is not initialized in the constructor.\n" + "[test.cpp:3]: (warning) Member variable 'A::y' is not initialized in the constructor.\n", errout.str()); } void simple7() { // ticket #4531 diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index 8320cd982..814d2ac21 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -1378,7 +1378,7 @@ private: ); // #3449 - ASSERT_EQUALS(";\n" + ASSERT_EQUALS("template < typename T > struct A ;\n" "struct B { template < typename T > struct C } ;\n" "{ } ;", checkCode("template struct A;\n"