diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 61cb54782..3745a2f6b 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -3066,15 +3066,12 @@ void CheckOther::unsignedPositiveError(const Token *tok, const std::string &varn { if (inconclusive) { reportInconclusiveError(tok, Severity::style, "unsignedPositive", - "Checking if unsigned variable '" + varname + "' is positive is always true. This might be a false warning.\n" - "Checking if unsigned variable '" + varname + "' is positive is always true. " - "An unsigned variable will always be positive so it is either pointless or " - "an error to check if it is. It's not known if the used constant is a " + "An unsigned variable '" + varname + "' can't be negative so it is unnecessary to test it. This might be a false warning.\n" + "An unsigned variable '" + varname + "' can't be negative so it is unnecessary to test it. " + "It's not known if the used constant is a " "template parameter or not and therefore this message might be a false warning"); } else { reportError(tok, Severity::style, "unsignedPositive", - "Checking if unsigned variable '" + varname + "' is positive is always true.\n" - "An unsigned variable will always be positive so it is either pointless or " - "an error to check if it is."); + "An unsigned variable '" + varname + "' can't be negative so it is unnecessary to test it."); } } diff --git a/test/testother.cpp b/test/testother.cpp index 1756d9bf9..ef5a6701c 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -4153,14 +4153,14 @@ private: " for(unsigned char i = 10; i >= 0; i--)" " printf(\"%u\", i);\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'i' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'i' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "void foo(bool b) {\n" " for(unsigned int i = 10; b || i >= 0; i--)" " printf(\"%u\", i);\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'i' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'i' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "bool foo(unsigned int x) {\n" @@ -4200,7 +4200,7 @@ private: " return true;\n" " return false;\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'x' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'x' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "bool foo(int x) {\n" @@ -4249,7 +4249,7 @@ private: " return true;\n" " return false;\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'x' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'x' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "bool foo(int x, bool y) {\n" @@ -4298,7 +4298,7 @@ private: " return true;\n" " return false;\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'x' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'x' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "bool foo(int x, bool y) {\n" @@ -4347,7 +4347,7 @@ private: " return true;\n" " return false;\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Checking if unsigned variable 'x' is positive is always true.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) An unsigned variable 'x' can't be negative so it is unnecessary to test it.\n", errout.str()); check_signOfUnsignedVariable( "bool foo(int x, bool y) {\n"