diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 1b4c91ef4..586d23e94 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2525,7 +2525,7 @@ void CheckOther::checkRedundantPointerOp() void CheckOther::redundantPointerOpError(const Token* tok, const std::string &varname, bool inconclusive) { reportError(tok, Severity::style, "redundantPointerOp", - "Redundant pointer operation on " + varname + " - it's already a pointer.", CWE398, inconclusive); + "Redundant pointer operation on '" + varname + "' - it's already a pointer.", CWE398, inconclusive); } void CheckOther::checkInterlockedDecrement() diff --git a/test/testother.cpp b/test/testother.cpp index 1431c726a..4a4ba5dc0 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5583,12 +5583,12 @@ private: check("int *f(int *x) {\n" " return &*x;\n" "}\n", nullptr, false, true); - ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on x - it's already a pointer.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on 'x' - it's already a pointer.\n", errout.str()); check("int *f(int *y) {\n" " return &(*y);\n" "}\n", nullptr, false, true); - ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on y - it's already a pointer.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on 'y' - it's already a pointer.\n", errout.str()); // no warning for bitwise AND check("void f(int *b) {\n" @@ -5618,14 +5618,14 @@ private: check("void f(Mutex *mut) {\n" " pthread_mutex_lock(&*mut);\n" "}\n", nullptr, false, false); - ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on mut - it's already a pointer.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on 'mut' - it's already a pointer.\n", errout.str()); // make sure we got the AST match for "(" right check("void f(char *ptr) {\n" " if (&*ptr == NULL)\n" " return;\n" "}\n", nullptr, false, true); - ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on ptr - it's already a pointer.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Redundant pointer operation on 'ptr' - it's already a pointer.\n", errout.str()); // no warning for macros check("#define MUTEX_LOCK(m) pthread_mutex_lock(&(m))\n"