CheckNullPointer: use library instead of hard coded info
This commit is contained in:
parent
be082a8e4a
commit
0c47555423
10
cfg/std.cfg
10
cfg/std.cfg
|
@ -30,11 +30,11 @@
|
|||
<function name="ispunct"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function>
|
||||
<function name="isspace"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function>
|
||||
|
||||
<function name="memchr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memcmp"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memcpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memmove"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memset"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memchr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memcmp"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memcpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memmove"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
<function name="memset"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function>
|
||||
|
||||
<function name="strcat"> <noreturn>false</noreturn> <leak-ignore/> </function>
|
||||
<function name="strchr"> <noreturn>false</noreturn> <leak-ignore/> </function>
|
||||
|
|
|
@ -66,8 +66,6 @@ void CheckNullPointer::parseFunctionCall(const Token &tok, std::list<const Token
|
|||
functionNames1_all.insert("wcstoll");
|
||||
functionNames1_all.insert("wcstoull");
|
||||
// cstring
|
||||
functionNames1_all.insert("memchr");
|
||||
functionNames1_all.insert("memcmp");
|
||||
functionNames1_all.insert("strcat");
|
||||
functionNames1_all.insert("strncat");
|
||||
functionNames1_all.insert("strcoll");
|
||||
|
@ -135,9 +133,6 @@ void CheckNullPointer::parseFunctionCall(const Token &tok, std::list<const Token
|
|||
functionNames1_all.insert("ctime");
|
||||
functionNames1_all.insert("mktime");
|
||||
|
||||
functionNames1_nullptr.insert("memcpy");
|
||||
functionNames1_nullptr.insert("memmove");
|
||||
functionNames1_nullptr.insert("memset");
|
||||
functionNames1_nullptr.insert("strcpy");
|
||||
functionNames1_nullptr.insert("sprintf");
|
||||
functionNames1_nullptr.insert("vsprintf");
|
||||
|
@ -168,9 +163,6 @@ void CheckNullPointer::parseFunctionCall(const Token &tok, std::list<const Token
|
|||
if (functionNames2_all.empty()) {
|
||||
functionNames2_all.insert("mbstowcs");
|
||||
functionNames2_all.insert("wcstombs");
|
||||
functionNames2_all.insert("memcmp");
|
||||
functionNames2_all.insert("memcpy");
|
||||
functionNames2_all.insert("memmove");
|
||||
functionNames2_all.insert("strcat");
|
||||
functionNames2_all.insert("strncat");
|
||||
functionNames2_all.insert("strcmp");
|
||||
|
|
|
@ -75,6 +75,12 @@ private:
|
|||
|
||||
Settings settings;
|
||||
|
||||
const char cfg[] = "<?xml version=\"1.0\"?>"
|
||||
"<def>"
|
||||
" <function name=\"memcpy\"> <arg nr=\"1\"><not-null/></arg> </function>"
|
||||
"</def>";
|
||||
settings.library.loadxmldata(cfg,sizeof(cfg));
|
||||
|
||||
// Tokenize..
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
|
|
Loading…
Reference in New Issue