* Add test for #6541, avoid duplicate warning * Add test for #5475 * Fix test * Merge * Add test for #8666 * Fix #11239 checkLibraryCheckType with asm goto() (invalid varid) * Format * Add tests for #1201, #2654 * Fix test * Add test for #6379 * Add tests for #1770, #10130
This commit is contained in:
parent
32c7b919ba
commit
33fde8ae6b
|
@ -2612,6 +2612,16 @@ private:
|
|||
"ImageSet *ActorSprite::targetCursorImages[2][10];");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(const std::size_t s) {\n" // #10130
|
||||
" const char a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };\n"
|
||||
" return (s > sizeof(a)) ? 11 : (int)a[s];\n"
|
||||
"}\n"
|
||||
"int g() {\n"
|
||||
" return f(16);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:3]: (warning) Either the condition 's>sizeof(a)' is redundant or the array 'a[16]' is accessed at index 16, which is out of bounds.\n",
|
||||
errout.str());
|
||||
|
||||
}
|
||||
|
||||
void array_index_valueflow_pointer() {
|
||||
|
|
|
@ -763,6 +763,9 @@ private:
|
|||
|
||||
check("size_t f() { wchar_t x = L'x'; return wcslen(&x); }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid wcslen() argument nr 1. A nul-terminated string is required.\n", errout.str());
|
||||
|
||||
check("void f() { char a[10] = \"1234567890\"; puts(a); }", "test.c"); // #1770
|
||||
ASSERT_EQUALS("[test.c:1]: (error) Invalid puts() argument nr 1. A nul-terminated string is required.\n", errout.str());
|
||||
}
|
||||
|
||||
void mathfunctionCall_sqrt() {
|
||||
|
|
Loading…
Reference in New Issue