Merge pull request #133 from snaewe/sn/support-ming

Support MinGW32, fix compiler warnings
This commit is contained in:
Daniel Marjamäki 2013-02-09 10:34:15 -08:00
commit 79d3494189
4 changed files with 15 additions and 8 deletions

View File

@ -28,6 +28,10 @@ ifdef COMSPEC
ifndef CPPCHK_GLIBCXX_DEBUG ifndef CPPCHK_GLIBCXX_DEBUG
CPPCHK_GLIBCXX_DEBUG= CPPCHK_GLIBCXX_DEBUG=
endif # !CPPCHK_GLIBCXX_DEBUG endif # !CPPCHK_GLIBCXX_DEBUG
ifeq ($(MSYSTEM),MINGW32)
LDFLAGS=-lshlwapi
endif
else # !COMSPEC else # !COMSPEC
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')

View File

@ -2945,11 +2945,9 @@ namespace {
class Expressions { class Expressions {
public: public:
Expressions(const SymbolDatabase *symbolDatabase, const Expressions(const std::list<const Function*> &constFunctions)
std::list<const Function*> &constFunctions)
: _start(0), : _start(0),
_lastTokens(0), _lastTokens(0),
_symbolDatabase(symbolDatabase),
_constFunctions(constFunctions) { } _constFunctions(constFunctions) { }
void endExpr(const Token *end) { void endExpr(const Token *end) {
@ -2989,7 +2987,6 @@ namespace {
std::ostringstream _expression; std::ostringstream _expression;
const Token *_start; const Token *_start;
ExpressionTokens *_lastTokens; ExpressionTokens *_lastTokens;
const SymbolDatabase *_symbolDatabase;
const std::list<const Function*> &_constFunctions; const std::list<const Function*> &_constFunctions;
}; };
@ -3030,7 +3027,7 @@ void CheckOther::checkExpressionRange(const std::list<const Function*> &constFun
{ {
if (!start || !end) if (!start || !end)
return; return;
Expressions expressions(_tokenizer->getSymbolDatabase(), constFunctions); Expressions expressions(constFunctions);
std::string opName; std::string opName;
int level = 0; int level = 0;
for (const Token *tok = start->next(); tok && tok != end; tok = tok->next()) { for (const Token *tok = start->next(); tok && tok != end; tok = tok->next()) {

View File

@ -1959,7 +1959,8 @@ bool Tokenizer::tokenize(std::istream &code,
// Remove redundant parentheses // Remove redundant parentheses
simplifyRedundantParentheses(); simplifyRedundantParentheses();
for (Token *tok = list.front(); tok; tok = tok->next()) for (Token *tok = list.front(); tok; tok = tok->next())
while (TemplateSimplifier::simplifyNumericCalculations(tok)); while (TemplateSimplifier::simplifyNumericCalculations(tok))
;
// Handle templates.. // Handle templates..
simplifyTemplates(); simplifyTemplates();
@ -2171,7 +2172,8 @@ bool Tokenizer::tokenizeCondition(const std::string &code)
for (Token *tok = list.front(); for (Token *tok = list.front();
tok; tok;
tok = tok->next()) tok = tok->next())
while (TemplateSimplifier::simplifyNumericCalculations(tok)); while (TemplateSimplifier::simplifyNumericCalculations(tok))
;
while (simplifyLogicalOperators()) { } while (simplifyLogicalOperators()) { }

View File

@ -253,6 +253,10 @@ int main(int argc, char **argv)
<< " ifndef CPPCHK_GLIBCXX_DEBUG\n" << " ifndef CPPCHK_GLIBCXX_DEBUG\n"
<< " CPPCHK_GLIBCXX_DEBUG=\n" << " CPPCHK_GLIBCXX_DEBUG=\n"
<< " endif # !CPPCHK_GLIBCXX_DEBUG\n" << " endif # !CPPCHK_GLIBCXX_DEBUG\n"
<< "\n"
<< " ifeq ($(MSYSTEM),MINGW32)\n"
<< " LDFLAGS=-lshlwapi\n"
<< " endif\n"
<< "else # !COMSPEC\n" << "else # !COMSPEC\n"
<< " uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n" << " uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n"
<< "\n" << "\n"
@ -351,7 +355,7 @@ int main(int argc, char **argv)
fout << "check:\tall\n"; fout << "check:\tall\n";
fout << "\t./testrunner -g -q\n\n"; fout << "\t./testrunner -g -q\n\n";
fout << "dmake:\ttools/dmake.cpp\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 << "reduce:\ttools/reduce.cpp\n";
fout << "\t$(CXX) -g -o reduce tools/reduce.cpp -Ilib lib/*.cpp\n\n"; fout << "\t$(CXX) -g -o reduce tools/reduce.cpp -Ilib lib/*.cpp\n\n";
fout << "clean:\n"; fout << "clean:\n";