From 9c68aa0a94aada5dd5eaab3c6b5fab69ec376e97 Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 8 Feb 2013 11:32:06 +0100 Subject: [PATCH 1/4] Makefile: set LDFLAGS correct when built with MINGW32 Signed-off-by: Stefan Naewe --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index e4b8ffa2e..62f2a955d 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,10 @@ ifdef COMSPEC ifndef CPPCHK_GLIBCXX_DEBUG CPPCHK_GLIBCXX_DEBUG= endif # !CPPCHK_GLIBCXX_DEBUG + + ifeq ($(MSYSTEM),MINGW32) + LDFLAGS=-lshlwapi + endif else # !COMSPEC uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') From 26ddf073666e32445265844559431c0ec8a26cb4 Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 8 Feb 2013 12:10:07 +0100 Subject: [PATCH 2/4] tools/dmake: update with MINGW32 support Signed-off-by: Stefan Naewe --- tools/dmake.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 1d9d35d02..dbf2a4647 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -253,6 +253,10 @@ int main(int argc, char **argv) << " ifndef CPPCHK_GLIBCXX_DEBUG\n" << " CPPCHK_GLIBCXX_DEBUG=\n" << " endif # !CPPCHK_GLIBCXX_DEBUG\n" + << "\n" + << " ifeq ($(MSYSTEM),MINGW32)\n" + << " LDFLAGS=-lshlwapi\n" + << " endif\n" << "else # !COMSPEC\n" << " uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n" << "\n" @@ -351,7 +355,7 @@ int main(int argc, char **argv) fout << "check:\tall\n"; fout << "\t./testrunner -g -q\n\n"; fout << "dmake:\ttools/dmake.cpp\n"; - fout << "\t$(CXX) -o dmake tools/dmake.cpp cli/filelister.cpp lib/path.cpp -Ilib\n\n"; + fout << "\t$(CXX) -o dmake tools/dmake.cpp cli/filelister.cpp lib/path.cpp -Ilib $(LDFLAGS)\n\n"; fout << "reduce:\ttools/reduce.cpp\n"; fout << "\t$(CXX) -g -o reduce tools/reduce.cpp -Ilib lib/*.cpp\n\n"; fout << "clean:\n"; From 46fb31f9e5c378c3a2f152750828fb615a2d9eea Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 8 Feb 2013 11:35:08 +0100 Subject: [PATCH 3/4] lib/tokenize: fix two compiler warnings about emtpy while loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these warnings: lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenize(std::istream&, const char*, const std::string&)’: lib/tokenize.cpp:1962: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenizeCondition(const std::string&)’: lib/tokenize.cpp:2174: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement Signed-off-by: Stefan Naewe --- lib/tokenize.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index dee14bf07..c422b84a1 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1959,7 +1959,8 @@ bool Tokenizer::tokenize(std::istream &code, // Remove redundant parentheses simplifyRedundantParentheses(); for (Token *tok = list.front(); tok; tok = tok->next()) - while (TemplateSimplifier::simplifyNumericCalculations(tok)); + while (TemplateSimplifier::simplifyNumericCalculations(tok)) + ; // Handle templates.. simplifyTemplates(); @@ -2171,7 +2172,8 @@ bool Tokenizer::tokenizeCondition(const std::string &code) for (Token *tok = list.front(); tok; tok = tok->next()) - while (TemplateSimplifier::simplifyNumericCalculations(tok)); + while (TemplateSimplifier::simplifyNumericCalculations(tok)) + ; while (simplifyLogicalOperators()) { } From e786a2fa5e0413b094c5cf358ff53c0a5943965f Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 8 Feb 2013 11:43:35 +0100 Subject: [PATCH 4/4] lib/checkother: fix compiler warning about unused member Found by clang: lib/checkother.cpp:2992:31: warning: private field '_symbolDatabase' is not used [-Wunused-private-field] const SymbolDatabase *_symbolDatabase; Signed-off-by: Stefan Naewe --- lib/checkother.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 3fb2b226c..3b9580446 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2945,11 +2945,9 @@ namespace { class Expressions { public: - Expressions(const SymbolDatabase *symbolDatabase, const - std::list &constFunctions) + Expressions(const std::list &constFunctions) : _start(0), _lastTokens(0), - _symbolDatabase(symbolDatabase), _constFunctions(constFunctions) { } void endExpr(const Token *end) { @@ -2989,7 +2987,6 @@ namespace { std::ostringstream _expression; const Token *_start; ExpressionTokens *_lastTokens; - const SymbolDatabase *_symbolDatabase; const std::list &_constFunctions; }; @@ -3030,7 +3027,7 @@ void CheckOther::checkExpressionRange(const std::list &constFun { if (!start || !end) return; - Expressions expressions(_tokenizer->getSymbolDatabase(), constFunctions); + Expressions expressions(constFunctions); std::string opName; int level = 0; for (const Token *tok = start->next(); tok && tok != end; tok = tok->next()) {