Changed severity and message formatting of argumentSize message.
This commit is contained in:
parent
7b3493322d
commit
27f7917349
|
@ -178,7 +178,7 @@ void CheckBufferOverrun::bufferNotZeroTerminatedError(const Token *tok, const st
|
||||||
|
|
||||||
void CheckBufferOverrun::argumentSizeError(const Token *tok, const std::string &functionName, const std::string &varname)
|
void CheckBufferOverrun::argumentSizeError(const Token *tok, const std::string &functionName, const std::string &varname)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::style, "argumentSize", "the array " + varname + " is too small, the function " + functionName + " expects a bigger array");
|
reportError(tok, Severity::warning, "argumentSize", "The array '" + varname + "' is too small, the function '" + functionName + "' expects a bigger one.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -2701,21 +2701,21 @@ private:
|
||||||
" char a[2];\n"
|
" char a[2];\n"
|
||||||
" f(a);\n"
|
" f(a);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) the array a is too small, the function f expects a bigger array\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) The array 'a' is too small, the function 'f' expects a bigger one.\n", errout.str());
|
||||||
|
|
||||||
check("void f(float a[10][20]);\n"
|
check("void f(float a[10][20]);\n"
|
||||||
"void g() {\n"
|
"void g() {\n"
|
||||||
" float a[2][3];\n"
|
" float a[2][3];\n"
|
||||||
" f(a);\n"
|
" f(a);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) the array a is too small, the function f expects a bigger array\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) The array 'a' is too small, the function 'f' expects a bigger one.\n", errout.str());
|
||||||
|
|
||||||
check("void f(char a[20]);\n"
|
check("void f(char a[20]);\n"
|
||||||
"void g() {\n"
|
"void g() {\n"
|
||||||
" int a[2];\n"
|
" int a[2];\n"
|
||||||
" f(a);\n"
|
" f(a);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) the array a is too small, the function f expects a bigger array\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) The array 'a' is too small, the function 'f' expects a bigger one.\n", errout.str());
|
||||||
|
|
||||||
check("void f(char a[20]);\n"
|
check("void f(char a[20]);\n"
|
||||||
"void g() {\n"
|
"void g() {\n"
|
||||||
|
|
Loading…
Reference in New Issue