From 1bc57407429554166eae80614405955ea4c2821b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 8 Jan 2009 17:31:07 +0000 Subject: [PATCH] errormessage: updated the files. the errormessage.h is automaticly generated by the tools/errmsg program --- src/errormessage.cpp | 11 +++++------ src/errormessage.h | 33 ++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/errormessage.cpp b/src/errormessage.cpp index ef8188c97..70b8647e5 100644 --- a/src/errormessage.cpp +++ b/src/errormessage.cpp @@ -1,11 +1,10 @@ #include "errormessage.h" +#include "tokenize.h" +#include "token.h" -ErrorMessage::ErrorMessage() +std::string ErrorMessage::msg1(const Tokenizer *tokenizer, const Token *Location) { - //ctor + return tokenizer->fileLine(Location) + ": "; } -ErrorMessage::~ErrorMessage() -{ - //dtor -} + diff --git a/src/errormessage.h b/src/errormessage.h index 56797b7ff..37ce1b9b5 100644 --- a/src/errormessage.h +++ b/src/errormessage.h @@ -1,19 +1,22 @@ -#ifndef ErrorMessageH -#define ErrorMessageH - -/** - * This class is used by the Cppcheck application to get - * informative error messages when e.g. memory leak is found - * from the inspected source file. This is also used another - * program to generate text for wiki and man page. - */ +#ifndef errormessageH +#define errormessageH +#include +#include "settings.h" +class Token; +class Tokenizer; class ErrorMessage { public: - ErrorMessage(); - virtual ~ErrorMessage(); -protected: -private: -}; + static std::string msg1(const Tokenizer *tokenizer, const Token *Location); + static std::string memleak(const Tokenizer *tokenizer, const Token *Location, const std::string &varname) + { return msg1(tokenizer, Location) + "Memory leak: " + varname + ""; } -#endif // ErrorMessageH + static bool memleak(const Settings &s) + { return true; } + static std::string resourceLeak(const Tokenizer *tokenizer, const Token *Location, const std::string &varname) + { return msg1(tokenizer, Location) + "Resource leak: " + varname + ""; } + + static bool resourceLeak(const Settings &s) + { return true; } +}; +#endif