Message refactorization: check64bit.cpp
Added two articles in checkautovariables.cpp as suggested by kimmov
This commit is contained in:
parent
0f1cb4c98c
commit
f5f63dc4a6
|
@ -99,22 +99,22 @@ void Check64BitPortability::assignmentAddressToIntegerError(const Token *tok)
|
|||
{
|
||||
reportError(tok, Severity::portability,
|
||||
"AssignmentAddressToInteger",
|
||||
"Assigning an address value to the integer (int/long/etc) type is not portable\n"
|
||||
"Assigning an address value to the integer (int/long/etc) type is not portable across different platforms and "
|
||||
"Assigning a pointer to an integer is not portable.\n"
|
||||
"Assigning a pointer to an integer (int/long/etc) is not portable across different platforms and "
|
||||
"compilers. For example in 32-bit Windows and linux they are same width, but in 64-bit Windows and linux "
|
||||
"they are of different width. In worst case you end up assigning 64-bit address to 32-bit integer. The safe "
|
||||
"way is to always assign addresses only to pointer types (or typedefs).");
|
||||
"way is to store addresses only in pointer types (or typedefs like uintptr_t).");
|
||||
}
|
||||
|
||||
void Check64BitPortability::assignmentIntegerToAddressError(const Token *tok)
|
||||
{
|
||||
reportError(tok, Severity::portability,
|
||||
"AssignmentIntegerToAddress",
|
||||
"Assigning an integer (int/long/etc) to a pointer is not portable\n"
|
||||
"Assigning an integer to a pointer is not portable.\n"
|
||||
"Assigning an integer (int/long/etc) to a pointer is not portable across different platforms and "
|
||||
"compilers. For example in 32-bit Windows and linux they are same width, but in 64-bit Windows and linux "
|
||||
"they are of different width. In worst case you end up assigning 32-bit integer to 64-bit pointer. The safe "
|
||||
"way is to always assign address to pointer.");
|
||||
"they are of different width. In worst case you end up assigning 64-bit integer to 32-bit pointer. The safe "
|
||||
"way is to store addresses only in pointer types (or typedefs like uintptr_t).");
|
||||
}
|
||||
|
||||
void Check64BitPortability::returnPointerError(const Token *tok)
|
||||
|
@ -132,9 +132,9 @@ void Check64BitPortability::returnIntegerError(const Token *tok)
|
|||
{
|
||||
reportError(tok, Severity::portability,
|
||||
"CastIntegerToAddressAtReturn",
|
||||
"Returning an integer in a function that returns a pointer is not portable.\n"
|
||||
"Returning an integer (int/long/etc) in a function that returns a pointer is not portable across different "
|
||||
"Returning an integer in a function with pointer return type is not portable.\n"
|
||||
"Returning an integer (int/long/etc) in a function with pointer return type is not portable across different "
|
||||
"platforms and compilers. For example in 32-bit Windows and Linux they are same width, but in 64-bit Windows "
|
||||
"and Linux they are of different width. In worst case you end up casting 32-bit integer down to 64-bit pointer. "
|
||||
"and Linux they are of different width. In worst case you end up casting 64-bit integer down to 32-bit pointer. "
|
||||
"The safe way is to always return a pointer.");
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ void CheckAutoVariables::errorAutoVariableAssignment(const Token *tok, bool inco
|
|||
if (!inconclusive) {
|
||||
reportError(tok, Severity::error, "autoVariables",
|
||||
"Address of local auto-variable assigned to a function parameter.\n"
|
||||
"Dangerous assignment - function parameter is assigned the address of a local "
|
||||
"Dangerous assignment - the function parameter is assigned the address of a local "
|
||||
"auto-variable. Local auto-variables are reserved from the stack which "
|
||||
"is freed when the function ends. So the pointer to a local variable "
|
||||
"is invalid after the function ends.");
|
||||
|
@ -303,7 +303,7 @@ void CheckAutoVariables::errorInvalidDeallocation(const Token *tok)
|
|||
Severity::error,
|
||||
"autovarInvalidDeallocation",
|
||||
"Deallocation of an auto-variable results in undefined behaviour.\n"
|
||||
"Deallocation of an auto-variable results in undefined behaviour. You should only free memory "
|
||||
"The deallocation of an auto-variable results in undefined behaviour. You should only free memory "
|
||||
"that has been allocated dynamically.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue