#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) void CheckBufferOverrun::negativeMemoryAllocationSizeError(const Token *tok)
{ {
reportError(tok, Severity::error, "negativeMemoryAllocationSize", reportError(tok, Severity::error, "negativeMemoryAllocationSize",
"Memory allocation size have to be greater or equal to 0.\n" "Memory allocation size is negative.\n"
"Memory allocation size have to be greater or equal to 0." "Memory allocation size is negative."
"The allocation size of memory have to be greater or equal to 0 because" "Negative allocation size has no specified behaviour.");
"negative size have no speficied behaviour.");
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -4137,7 +4137,7 @@ private:
" a = new int[-1];\n" " a = new int[-1];\n"
" delete [] a;\n" " delete [] a;\n"
"}\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" check("void f()\n"
"{\n" "{\n"
@ -4145,7 +4145,7 @@ private:
" a = malloc( -10 );\n" " a = malloc( -10 );\n"
" free(a);\n" " free(a);\n"
"}\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" check("void f()\n"
"{\n" "{\n"
@ -4153,7 +4153,7 @@ private:
" a = malloc( -10);\n" " a = malloc( -10);\n"
" free(a);\n" " free(a);\n"
"}\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" check("void f()\n"
"{\n" "{\n"
@ -4161,7 +4161,7 @@ private:
" a = alloca( -10 );\n" " a = alloca( -10 );\n"
" free(a);\n" " free(a);\n"
"}\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());
} }
}; };