diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index d53131374..13c6a6acd 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1212,9 +1212,9 @@ void CheckClass::checkMemsetType(const Scope *start, const Token *tok, const Sco for (const Function &func : type->functionList) { if (func.isVirtual()) { if (allocation) - mallocOnClassError(tok, tok->str(), type->classDef, "virtual method"); + mallocOnClassError(tok, tok->str(), type->classDef, "virtual function"); else - memsetError(tok, tok->str(), "virtual method", type->classDef->str()); + memsetError(tok, tok->str(), "virtual function", type->classDef->str()); } } @@ -1791,7 +1791,7 @@ void CheckClass::checkConst() // does the function have a body? if (func.type != Function::eFunction || !func.hasBody()) continue; - // don't warn for friend/static/virtual methods + // don't warn for friend/static/virtual functions if (func.isFriend() || func.isStatic() || func.isVirtual()) continue; // get last token of return type @@ -2381,7 +2381,7 @@ void CheckClass::virtualFunctionCallInConstructorError( errorPath.emplace_back(tok, "Calling " + tok->str()); if (!errorPath.empty()) { lineNumber = errorPath.front().first->linenr(); - errorPath.back().second = funcname + " is a virtual method"; + errorPath.back().second = funcname + " is a virtual function"; } std::string constructorName; @@ -2413,7 +2413,7 @@ void CheckClass::pureVirtualFunctionCallInConstructorError( for (const Token *tok : tokStack) errorPath.emplace_back(tok, "Calling " + tok->str()); if (!errorPath.empty()) - errorPath.back().second = purefuncname + " is a pure virtual method without body"; + errorPath.back().second = purefuncname + " is a pure virtual function without body"; reportError(errorPath, Severity::warning, "pureVirtualCall", "$symbol:" + purefuncname +"\n" diff --git a/lib/checkclass.h b/lib/checkclass.h index 01aa7deef..1b0e026ac 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -157,7 +157,7 @@ public: /** @brief Check that arbitrary usage of the public interface does not result in division by zero */ void checkUnsafeClassDivZero(bool test=false); - /** @brief Check that the override keyword is used when overriding virtual methods */ + /** @brief Check that the override keyword is used when overriding virtual functions */ void checkOverride(); private: @@ -262,7 +262,7 @@ private: "- Duplicated inherited data members\n" // disabled for now "- If 'copy constructor' defined, 'operator=' also should be defined and vice versa\n" "- Check that arbitrary usage of public interface does not result in division by zero\n" - "- Check that the 'override' keyword is used when overriding virtual methods\n"; + "- Check that the 'override' keyword is used when overriding virtual functions\n"; } // operatorEqRetRefThis helper functions diff --git a/test/testclass.cpp b/test/testclass.cpp index 40dc0321c..dc658d11f 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -2798,7 +2798,7 @@ private: " Fred fred;\n" " memset(&fred, 0, sizeof(fred));\n" "}"); - ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a virtual method.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a virtual function.\n", errout.str()); checkNoMemset("class Fred\n" "{\n" @@ -2809,7 +2809,7 @@ private: " static Fred fred;\n" " memset(&fred, 0, sizeof(fred));\n" "}"); - ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a virtual method.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a virtual function.\n", errout.str()); checkNoMemset("class Fred\n" "{\n" @@ -2824,7 +2824,7 @@ private: " Pebbles pebbles;\n" " memset(&pebbles, 0, sizeof(pebbles));\n" "}"); - ASSERT_EQUALS("[test.cpp:12]: (error) Using 'memset' on class that contains a virtual method.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:12]: (error) Using 'memset' on class that contains a virtual function.\n", errout.str()); // Fred not defined in scope checkNoMemset("namespace n1 {\n" @@ -3240,7 +3240,7 @@ private: "void foo(C*& p) {\n" " p = malloc(sizeof(C));\n" "}"); - ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:1]: (error) Memory for class instance allocated with malloc(), but class contains a virtual method.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:1]: (error) Memory for class instance allocated with malloc(), but class contains a virtual function.\n", errout.str()); checkNoMemset("struct C { std::string s; };\n" "void foo(C*& p) {\n"