From 0fd16be44bb81b5b0045fecc3f21c784d493c3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 10 May 2007 17:25:52 +0000 Subject: [PATCH] Minor updates. Make sure there is no doublechecking. Don't perform certain checks upon c-files. --- main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index ff76362c4..ee5c529e7 100644 --- a/main.cpp +++ b/main.cpp @@ -94,7 +94,9 @@ static void CppCheck(const char FileName[]) //WarningHeaderWithImplementation(); // Warning upon c-style pointer casts - WarningOldStylePointerCast(); + const char *ext = strrchr(FileName, '.'); + if (ext && stricmp(ext,".c")) + WarningOldStylePointerCast(); // Use standard functions instead WarningIsDigit(); @@ -159,6 +161,13 @@ void combine_2tokens(TOKEN *tok, const char str1[], const char str2[]) void Tokenize(const char FileName[]) { + // Has this file been tokenized already? + for (unsigned int i = 0; i < Files.size(); i++) + { + if ( stricmp(Files[i].c_str(), FileName) == 0 ) + return; + } + std::ifstream fin(FileName); if (!fin.is_open()) return; @@ -1106,6 +1115,13 @@ void WarningIncludeHeader() } //--------------------------------------------------------------------------- + + + +//--------------------------------------------------------------------------- +// Redundant code.. +//--------------------------------------------------------------------------- + void WarningRedundantCode() { for (TOKEN *tok = tokens; tok; tok = tok->next) @@ -1149,3 +1165,5 @@ void WarningRedundantCode() } } + +