diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 9cf9c2562..9e08eea77 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1427,14 +1427,14 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const void SymbolDatabase::validate() const { - const std::size_t functions = functionScopes.size(); - for (std::size_t i = 0; i < functions; ++i) { - const Scope* scope = functionScopes[i]; - const Function* function = scope->function; - if (scope->isExecutable() && !function) { - if (_settings->debugwarnings) { + if (_settings->debugwarnings) { + const std::size_t functions = functionScopes.size(); + for (std::size_t i = 0; i < functions; ++i) { + const Scope* scope = functionScopes[i]; + const Function* function = scope->function; + if (scope->isExecutable() && !function) { const std::list callstack(1, scope->classDef); - const std::string msg = std::string("executable scope '") + scope->classDef->str() + "' with unknown function"; + const std::string msg = std::string("Executable scope '") + scope->classDef->str() + "' with unknown function."; const ErrorLogger::ErrorMessage errmsg(callstack, &_tokenizer->list, Severity::debug, "symbolDatabaseWarning", msg, diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index db4a2c1e0..5304143f1 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -1598,7 +1598,7 @@ private: check("testing::testing()\n" "{\n" "}"); - ASSERT_EQUALS("[test.cpp:1]: (debug) executable scope 'testing' with unknown function\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (debug) Executable scope 'testing' with unknown function.\n", errout.str()); } void symboldatabase5() {