pointerArithBool: Updated error message
This commit is contained in:
parent
6182394966
commit
aa65799c19
|
@ -551,5 +551,6 @@ void CheckBool::pointerArithBoolError(const Token *tok)
|
|||
reportError(tok,
|
||||
Severity::error,
|
||||
"pointerArithBool",
|
||||
"Converting pointer arithmetic result to bool. Either a dereference is forgot, or pointer overflow is required to get a false value");
|
||||
"Converting pointer arithmetic result to bool. The bool is always true unless there is undefined behaviour.\n"
|
||||
"Converting pointer arithmetic result to bool. The boolean result is always true unless there is pointer arithmetic overflow, and overflow is undefined behaviour. Probably a dereference is forgotten.");
|
||||
}
|
||||
|
|
|
@ -877,12 +877,12 @@ private:
|
|||
check("void f(char *p) {\n"
|
||||
" if (p+1){}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Converting pointer arithmetic result to bool. Either a dereference is forgot, or pointer overflow is required to get a false value\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Converting pointer arithmetic result to bool. The bool is always true unless there is undefined behaviour.\n", errout.str());
|
||||
|
||||
check("void f(char *p) {\n"
|
||||
" if (p && p+1){}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Converting pointer arithmetic result to bool. Either a dereference is forgot, or pointer overflow is required to get a false value\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Converting pointer arithmetic result to bool. The bool is always true unless there is undefined behaviour.\n", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue