From 3c1c33669e0a873d39d1f2b99dfdaf8174ee0f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 21 Mar 2009 10:15:46 +0100 Subject: [PATCH] refactoring: The errmsg is no longer supposed to generate the errorLogger code --- Makefile | 4 -- tools/dmake.cpp | 4 -- tools/errmsg.cpp | 114 ----------------------------------------------- 3 files changed, 122 deletions(-) diff --git a/Makefile b/Makefile index e94563148..bf9638169 100644 --- a/Makefile +++ b/Makefile @@ -234,7 +234,3 @@ test/testunusedprivfunc.o: test/testunusedprivfunc.cpp src/tokenize.h src/settin test/testunusedvar.o: test/testunusedvar.cpp test/testsuite.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h src/checkother.h src/check.h $(CXX) $(CXXFLAGS) -c -o test/testunusedvar.o test/testunusedvar.cpp -src/errorlogger.h: tools/errmsg - tools/errmsg - mv errorlogger.h src/ - diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 769f67e46..bcb2ab7c2 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -139,10 +139,6 @@ int main() fout << "\n\t$(CXX) $(CXXFLAGS) -c -o " << objfile(testfiles[i]) << " " << testfiles[i] << "\n\n"; } - fout << "src/errorlogger.h:\ttools/errmsg\n"; - fout << "\ttools/errmsg\n"; - fout << "\tmv errorlogger.h src/\n\n"; - return 0; } diff --git a/tools/errmsg.cpp b/tools/errmsg.cpp index a0cf999f6..cec502166 100644 --- a/tools/errmsg.cpp +++ b/tools/errmsg.cpp @@ -125,120 +125,6 @@ int main() err.push_back(Message("unvalidatedInput", Message::security, "Unvalidated input")); - // Generate code.. - std::cout << "Generate code.." << std::endl; - std::ofstream fout("errorlogger.h"); - - fout << "/*\n"; - fout << " * Cppcheck - A tool for static C/C++ code analysis\n"; - fout << " * Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam,\n"; - fout << " * Leandro Penz, Kimmo Varis, Vesa Pikki\n"; - fout << " *\n"; - fout << " * This program is free software: you can redistribute it and/or modify\n"; - fout << " * it under the terms of the GNU General Public License as published by\n"; - fout << " * the Free Software Foundation, either version 3 of the License, or\n"; - fout << " * (at your option) any later version.\n"; - fout << " *\n"; - fout << " * This program is distributed in the hope that it will be useful,\n"; - fout << " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"; - fout << " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"; - fout << " * GNU General Public License for more details.\n"; - fout << " *\n"; - fout << " * You should have received a copy of the GNU General Public License\n"; - fout << " * along with this program. If not, see \n"; - fout << "#include \n"; - fout << "#include \"settings.h\"\n"; - fout << "class Token;\n"; - fout << "class Tokenizer;\n"; - fout << "\n"; - fout << "/**\n"; - fout << " * This is an interface, which the class responsible of error logging\n"; - fout << " * should implement.\n"; - fout << " */\n"; - fout << "class ErrorLogger\n"; - fout << "{\n"; - fout << "public:\n"; - fout << "\n"; - fout << " /**\n"; - fout << " * Wrapper for error messages, provided by reportErr()\n"; - fout << " */\n"; - fout << " class ErrorMessage\n"; - fout << " {\n"; - fout << " public:\n"; - fout << " /**\n"; - fout << " * File name and line number.\n"; - fout << " */\n"; - fout << " class FileLocation\n"; - fout << " {\n"; - fout << " public:\n"; - fout << " FileLocation()\n"; - fout << " {\n"; - fout << " line = 0;\n"; - fout << " }\n"; - fout << " std::string file;\n"; - fout << " unsigned int line;\n"; - fout << " };\n"; - fout << "\n"; - fout << " ErrorMessage(const std::list &callStack, const std::string &severity, const std::string &msg, const std::string &id);\n"; - fout << " ErrorMessage();\n"; - fout << " std::string toXML() const;\n"; - fout << " std::string toText() const;\n"; - fout << " std::string serialize() const;\n"; - fout << " bool deserialize(const std::string &data);\n"; - fout << " std::list _callStack;\n"; - fout << " std::string _severity;\n"; - fout << " std::string _msg;\n"; - fout << " std::string _id;\n"; - fout << " };\n"; - fout << "\n"; - fout << " ErrorLogger() { }\n"; - fout << " virtual ~ErrorLogger() { }\n"; - fout << "\n"; - fout << " /**\n"; - fout << " * Information about progress is directed here.\n"; - fout << " * Override this to receive the progress messages.\n"; - fout << " *\n"; - fout << " * @param outmsg, E.g. \"Checking main.cpp...\"\n"; - fout << " */\n"; - fout << " virtual void reportOut(const std::string &outmsg) = 0;\n"; - fout << "\n"; - fout << " /**\n"; - fout << " * Information about found errors and warnings is directed\n"; - fout << " * here. Override this to receive the errormessages.\n"; - fout << " *\n"; - fout << " * @param msg Location and other information about the found.\n"; - fout << " * error\n"; - fout << " */\n"; - fout << " virtual void reportErr(const ErrorLogger::ErrorMessage &msg) = 0;\n"; - fout << "\n"; - fout << " /**\n"; - fout << " * Information about how many files have been checked\n"; - fout << " *\n"; - fout << " * @param index This many files have been checked.\n"; - fout << " * @param max This many files there are in total.\n"; - fout << " */\n"; - fout << " virtual void reportStatus(unsigned int index, unsigned int max) = 0;\n"; - fout << "\n"; - - for (std::list::const_iterator it = err.begin(); it != err.end(); ++it) - it->generateCode(fout); - - fout << "\n"; - fout << " static std::string callStackToString(const std::list &callStack);\n"; - fout << "\n"; - fout << "private:\n"; - fout << " void _writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string &msg, const std::string &id);\n"; - fout << " void _writemsg(const Tokenizer *tokenizer, const std::list &callstack, const char severity[], const std::string &msg, const std::string &id);\n"; - fout << " void _writemsg(const std::string &msg, const std::string &id);\n"; - fout << "};\n"; - fout << "#endif\n"; - std::cout << std::endl; - // Generate documentation.. std::cout << "Generate doc.." << std::endl; const unsigned int NUMSUITE = 5;