Check unused templates by default
This commit is contained in:
parent
5dbdb90541
commit
208a4a4548
|
@ -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();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mTabPathsAndDefines">
|
||||
<attribute name="title">
|
||||
|
@ -503,7 +503,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="mCheckHeaders">
|
||||
<property name="text">
|
||||
<string>Check code in headers (slower analysis, more results)</string>
|
||||
<string>Check code in headers (should be ON normally. if you want a limited quick analysis then turn this OFF)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -513,7 +513,10 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="mCheckUnusedTemplates">
|
||||
<property name="text">
|
||||
<string>Check code in unused templates (slower and less accurate analysis)</string>
|
||||
<string>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)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -35,7 +35,7 @@ Settings::Settings()
|
|||
checkConfiguration(false),
|
||||
checkHeaders(true),
|
||||
checkLibrary(false),
|
||||
checkUnusedTemplates(false),
|
||||
checkUnusedTemplates(true),
|
||||
clang(false),
|
||||
clangExecutable("clang"),
|
||||
clangTidy(false),
|
||||
|
|
|
@ -349,18 +349,15 @@ private:
|
|||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
const char code[] = "template <class T> struct A {\n"
|
||||
" A<T>() : x(0) { }\n"
|
||||
" A<T>(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<int> 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 <class T> struct A {\n"
|
||||
" A<T>() : x(0) { }\n"
|
||||
" A<T>(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
|
||||
|
|
|
@ -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<typename T> struct A;\n"
|
||||
|
|
Loading…
Reference in New Issue