From f5f63dc4a6cd8d949c4d6c43c2b7d5522d272bf2 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 8 Jul 2012 02:38:58 -0700 Subject: [PATCH] Message refactorization: check64bit.cpp Added two articles in checkautovariables.cpp as suggested by kimmov --- lib/check64bit.cpp | 18 +++++++++--------- lib/checkautovariables.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index ead4971f6..c86be935e 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -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."); } diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 0415f232c..483b101d6 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -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."); }