#5631 Typo and misleading error message in negativeMemoryAllocationSize

This commit is contained in:
Alexander Mai 2014-04-08 20:23:00 +02:00
parent a06371e063
commit 89dc652af9
2 changed files with 7 additions and 8 deletions

View File

@ -217,10 +217,9 @@ void CheckBufferOverrun::argumentSizeError(const Token *tok, const std::string &
void CheckBufferOverrun::negativeMemoryAllocationSizeError(const Token *tok)
{
reportError(tok, Severity::error, "negativeMemoryAllocationSize",
"Memory allocation size have to be greater or equal to 0.\n"
"Memory allocation size have to be greater or equal to 0."
"The allocation size of memory have to be greater or equal to 0 because"
"negative size have no speficied behaviour.");
"Memory allocation size is negative.\n"
"Memory allocation size is negative."
"Negative allocation size has no specified behaviour.");
}
//---------------------------------------------------------------------------

View File

@ -4137,7 +4137,7 @@ private:
" a = new int[-1];\n"
" delete [] a;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size have to be greater or equal to 0.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size is negative.\n", errout.str());
check("void f()\n"
"{\n"
@ -4145,7 +4145,7 @@ private:
" a = malloc( -10 );\n"
" free(a);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size have to be greater or equal to 0.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size is negative.\n", errout.str());
check("void f()\n"
"{\n"
@ -4153,7 +4153,7 @@ private:
" a = malloc( -10);\n"
" free(a);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size have to be greater or equal to 0.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size is negative.\n", errout.str());
check("void f()\n"
"{\n"
@ -4161,7 +4161,7 @@ private:
" a = alloca( -10 );\n"
" free(a);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size have to be greater or equal to 0.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (error) Memory allocation size is negative.\n", errout.str());
}
};