From 494f64cb88c9c51c888a13b5f159828a3c81e3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 9 Apr 2017 16:59:41 +0200 Subject: [PATCH] tests: fix some self-check findings about functions that can be static. Was: [test/testtype.cpp:223]: (performance, inconclusive) Technically the member function 'TestType::removeFloat' can be static. [test/testsymboldatabase.cpp:61]: (performance, inconclusive) Technically the member function 'TestSymbolDatabase::getSymbolDB_inner' can be static. [test/teststl.cpp:1437]: (performance, inconclusive) Technically the member function 'TestStl::getArraylength' can be static. --- test/teststl.cpp | 2 +- test/testsymboldatabase.cpp | 2 +- test/testtype.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/teststl.cpp b/test/teststl.cpp index 985ffe984..6607b4176 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1434,7 +1434,7 @@ private: } template - size_t getArraylength(const T(&)[n]) { + static size_t getArraylength(const T(&)[n]) { return n; } diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 5751dedb4..2d2d32e9e 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -58,7 +58,7 @@ private: found = false; } - const SymbolDatabase* getSymbolDB_inner(Tokenizer& tokenizer, const char* code, const char* filename) { + const static SymbolDatabase* getSymbolDB_inner(Tokenizer& tokenizer, const char* code, const char* filename) { errout.str(""); std::istringstream istr(code); tokenizer.tokenize(istr, filename); diff --git a/test/testtype.cpp b/test/testtype.cpp index 3788e0df4..22684983a 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -220,7 +220,7 @@ private: // This function ensure that test works with different compilers. Floats can // be stringified differently. - std::string removeFloat(const std::string& msg) { + static std::string removeFloat(const std::string& msg) { std::string::size_type pos1 = msg.find("float ("); std::string::size_type pos2 = msg.find(") conversion"); if (pos1 == std::string::npos || pos2 == std::string::npos || pos1 > pos2)