diff --git a/.travis.yml b/.travis.yml index 654ed73f0..7fc51d7eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,11 +35,6 @@ script: - touch lib/mathlib.cpp test/testmathlib.cpp - make test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE - touch lib/mathlib.cpp test/testmathlib.cpp -# check with CPPCHECK2 enabled that disables various simplifications - - touch lib/tokenize.cpp - - make testrunner -j4 CPPFLAGS=-DCPPCHECK2 - - ./testrunner TestValueFlow - - touch lib/tokenize.cpp # compile cppcheck, default build - make test -j4 # compile gui diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index f8d36d5a7..53fb51a60 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3417,10 +3417,8 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // replace 'NULL' and similar '0'-defined macros with '0' simplifyNull(); -#ifndef CPPCHECK2 // replace 'sin(0)' to '0' and other similar math expressions simplifyMathExpressions(); -#endif // combine "- %num%" concatenateNegativeNumberAndAnyPositive(); @@ -3428,13 +3426,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // Combine tokens.. combineOperators(); -#ifndef CPPCHECK2 // simplify simple calculations for (Token *tok = list.front() ? list.front()->next() : nullptr; tok; tok = tok->next()) { if (tok->isNumber()) TemplateSimplifier::simplifyNumericCalculations(tok->previous()); } -#endif // remove extern "C" and extern "C" {} if (isCPP()) @@ -3517,13 +3513,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // remove unnecessary member qualification.. removeUnnecessaryQualification(); -#ifndef CPPCHECK2 // convert Microsoft memory functions simplifyMicrosoftMemoryFunctions(); // convert Microsoft string functions simplifyMicrosoftStringFunctions(); -#endif if (_settings->terminated()) return false; @@ -3629,13 +3623,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // operator = => operator= simplifyOperatorName(); -#ifndef CPPCHECK2 // Remove redundant parentheses simplifyRedundantParentheses(); for (Token *tok = list.front(); tok; tok = tok->next()) while (TemplateSimplifier::simplifyNumericCalculations(tok)) ; -#endif // Handle templates.. simplifyTemplates(); @@ -3690,10 +3682,8 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // Change initialisation of variable to assignment simplifyInitVar(); -#ifndef CPPCHECK2 // Convert e.g. atol("0") into 0 simplifyMathFunctions(); -#endif simplifyDoublePlusAndDoubleMinus(); @@ -3777,7 +3767,6 @@ bool Tokenizer::simplifyTokenList2() simplifyIfAndWhileAssign(); -#ifndef CPPCHECK2 // replace strlen(str) for (Token *tok = list.front(); tok; tok = tok->next()) { if (Token::Match(tok, "strlen ( %str% )")) { @@ -3803,7 +3792,6 @@ bool Tokenizer::simplifyTokenList2() modified |= simplifyCalculations(); validate(); } -#endif // simplify redundant loops simplifyWhile0();