Check unused templates by default
This commit is contained in:
parent
5dbdb90541
commit
208a4a4548
|
@ -67,7 +67,7 @@ void ProjectFile::clear()
|
||||||
mClangAnalyzer = mClangTidy = false;
|
mClangAnalyzer = mClangTidy = false;
|
||||||
mAnalyzeAllVsConfigs = false;
|
mAnalyzeAllVsConfigs = false;
|
||||||
mCheckHeaders = true;
|
mCheckHeaders = true;
|
||||||
mCheckUnusedTemplates = false;
|
mCheckUnusedTemplates = true;
|
||||||
mMaxCtuDepth = settings.maxCtuDepth;
|
mMaxCtuDepth = settings.maxCtuDepth;
|
||||||
mMaxTemplateRecursion = settings.maxTemplateRecursion;
|
mMaxTemplateRecursion = settings.maxTemplateRecursion;
|
||||||
mCheckUnknownFunctionReturn.clear();
|
mCheckUnknownFunctionReturn.clear();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="mTabPathsAndDefines">
|
<widget class="QWidget" name="mTabPathsAndDefines">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -503,7 +503,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="mCheckHeaders">
|
<widget class="QCheckBox" name="mCheckHeaders">
|
||||||
<property name="text">
|
<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>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -513,7 +513,10 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="mCheckUnusedTemplates">
|
<widget class="QCheckBox" name="mCheckUnusedTemplates">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -35,7 +35,7 @@ Settings::Settings()
|
||||||
checkConfiguration(false),
|
checkConfiguration(false),
|
||||||
checkHeaders(true),
|
checkHeaders(true),
|
||||||
checkLibrary(false),
|
checkLibrary(false),
|
||||||
checkUnusedTemplates(false),
|
checkUnusedTemplates(true),
|
||||||
clang(false),
|
clang(false),
|
||||||
clangExecutable("clang"),
|
clangExecutable("clang"),
|
||||||
clangTidy(false),
|
clangTidy(false),
|
||||||
|
|
|
@ -349,18 +349,15 @@ private:
|
||||||
"};");
|
"};");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
const char code[] = "template <class T> struct A {\n"
|
check("template <class T> struct A {\n"
|
||||||
" A<T>() : x(0) { }\n"
|
" A<T>() : x(0) { }\n"
|
||||||
" A<T>(const T & t) : x(t.x) { }\n"
|
" A<T>(const T & t) : x(t.x) { }\n"
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" int x;\n"
|
" int x;\n"
|
||||||
" int y;\n"
|
" int y;\n"
|
||||||
"};";
|
"};");
|
||||||
check(code);
|
ASSERT_EQUALS("[test.cpp:2]: (warning) Member variable 'A::y' is not initialized in the constructor.\n"
|
||||||
ASSERT_EQUALS("", errout.str());
|
"[test.cpp:3]: (warning) Member variable 'A::y' is not initialized in the constructor.\n", 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void simple7() { // ticket #4531
|
void simple7() { // ticket #4531
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ private:
|
||||||
);
|
);
|
||||||
|
|
||||||
// #3449
|
// #3449
|
||||||
ASSERT_EQUALS(";\n"
|
ASSERT_EQUALS("template < typename T > struct A ;\n"
|
||||||
"struct B { template < typename T > struct C } ;\n"
|
"struct B { template < typename T > struct C } ;\n"
|
||||||
"{ } ;",
|
"{ } ;",
|
||||||
checkCode("template<typename T> struct A;\n"
|
checkCode("template<typename T> struct A;\n"
|
||||||
|
|
Loading…
Reference in New Issue