From e064208f54493dfedc1c4c77a06a6203eb4139d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 28 Feb 2010 16:10:21 +0100 Subject: [PATCH] Preprocessor: Removed unused function renameMacroVariables --- lib/preprocessor.cpp | 66 -------------------------------------------- 1 file changed, 66 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 14437fc08..befb6ccca 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1424,72 +1424,6 @@ public: } } - /** - * To avoid name collisions, we will rename macro variables by - * adding _prefix in front of the name of each variable. - * Returns the macro with converted names - * @param result If return value is false, this is not touched. If - * return value is true, this will contain new macro line - * (all that comes after #define) e.g. - * "A(__cppcheck__x) foo(__cppcheck__x);" - * @param macro The macro which is about to cause name collision. - * @return true if code needs to be changed, false is no changes - * are required. - */ - bool renameMacroVariables(std::string &result, const PreprocessorMacro ¯o) - { - // No variables - if (_params.empty()) - return false; - - // Already renamed - if (_params[0].compare(0, _prefix.length(), _prefix) == 0) - return false; - - // Check does the macro contain tokens that have - // the same name as parameters in this macro. - const Token *tok = macro.tokens(); - if (Token::Match(tok->next(), "(")) - { - std::map paramMap; - for (unsigned int i = 0; i < _params.size(); ++i) - paramMap[_params[i]] = true; - - bool collision = false; - tok = Token::findmatch(tok, ")", 0); - for (; tok; tok = tok->next()) - { - if (paramMap.find(tok->str()) != paramMap.end()) - { - // Name collision - collision = true; - break; - } - } - - if (!collision) - return false; - } - - result = ""; - result.append(_name); - result.append("("); - std::vector values; - for (unsigned int i = 0; i < _params.size(); ++i) - { - if (i > 0) - result.append(","); - values.push_back(_prefix + _params[i]); - result.append(values.back()); - } - - result.append(") "); - std::string temp; - this->code(values, temp); - result.append(temp); - return true; - } - /** return tokens of this macro */ const Token *tokens() const {