Removed the CPPCHECK2 ifdefs. I have no plan to remove simplifications anymore.
This commit is contained in:
parent
25a5ac1846
commit
b38559774d
|
@ -35,11 +35,6 @@ script:
|
||||||
- touch lib/mathlib.cpp test/testmathlib.cpp
|
- touch lib/mathlib.cpp test/testmathlib.cpp
|
||||||
- make test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE
|
- make test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE
|
||||||
- touch lib/mathlib.cpp test/testmathlib.cpp
|
- 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
|
# compile cppcheck, default build
|
||||||
- make test -j4
|
- make test -j4
|
||||||
# compile gui
|
# compile gui
|
||||||
|
|
|
@ -3417,10 +3417,8 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// replace 'NULL' and similar '0'-defined macros with '0'
|
// replace 'NULL' and similar '0'-defined macros with '0'
|
||||||
simplifyNull();
|
simplifyNull();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// replace 'sin(0)' to '0' and other similar math expressions
|
// replace 'sin(0)' to '0' and other similar math expressions
|
||||||
simplifyMathExpressions();
|
simplifyMathExpressions();
|
||||||
#endif
|
|
||||||
|
|
||||||
// combine "- %num%"
|
// combine "- %num%"
|
||||||
concatenateNegativeNumberAndAnyPositive();
|
concatenateNegativeNumberAndAnyPositive();
|
||||||
|
@ -3428,13 +3426,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// Combine tokens..
|
// Combine tokens..
|
||||||
combineOperators();
|
combineOperators();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// simplify simple calculations
|
// simplify simple calculations
|
||||||
for (Token *tok = list.front() ? list.front()->next() : nullptr; tok; tok = tok->next()) {
|
for (Token *tok = list.front() ? list.front()->next() : nullptr; tok; tok = tok->next()) {
|
||||||
if (tok->isNumber())
|
if (tok->isNumber())
|
||||||
TemplateSimplifier::simplifyNumericCalculations(tok->previous());
|
TemplateSimplifier::simplifyNumericCalculations(tok->previous());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// remove extern "C" and extern "C" {}
|
// remove extern "C" and extern "C" {}
|
||||||
if (isCPP())
|
if (isCPP())
|
||||||
|
@ -3517,13 +3513,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// remove unnecessary member qualification..
|
// remove unnecessary member qualification..
|
||||||
removeUnnecessaryQualification();
|
removeUnnecessaryQualification();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// convert Microsoft memory functions
|
// convert Microsoft memory functions
|
||||||
simplifyMicrosoftMemoryFunctions();
|
simplifyMicrosoftMemoryFunctions();
|
||||||
|
|
||||||
// convert Microsoft string functions
|
// convert Microsoft string functions
|
||||||
simplifyMicrosoftStringFunctions();
|
simplifyMicrosoftStringFunctions();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_settings->terminated())
|
if (_settings->terminated())
|
||||||
return false;
|
return false;
|
||||||
|
@ -3629,13 +3623,11 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// operator = => operator=
|
// operator = => operator=
|
||||||
simplifyOperatorName();
|
simplifyOperatorName();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// 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))
|
||||||
;
|
;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Handle templates..
|
// Handle templates..
|
||||||
simplifyTemplates();
|
simplifyTemplates();
|
||||||
|
@ -3690,10 +3682,8 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// Change initialisation of variable to assignment
|
// Change initialisation of variable to assignment
|
||||||
simplifyInitVar();
|
simplifyInitVar();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// Convert e.g. atol("0") into 0
|
// Convert e.g. atol("0") into 0
|
||||||
simplifyMathFunctions();
|
simplifyMathFunctions();
|
||||||
#endif
|
|
||||||
|
|
||||||
simplifyDoublePlusAndDoubleMinus();
|
simplifyDoublePlusAndDoubleMinus();
|
||||||
|
|
||||||
|
@ -3777,7 +3767,6 @@ bool Tokenizer::simplifyTokenList2()
|
||||||
|
|
||||||
simplifyIfAndWhileAssign();
|
simplifyIfAndWhileAssign();
|
||||||
|
|
||||||
#ifndef CPPCHECK2
|
|
||||||
// replace strlen(str)
|
// replace strlen(str)
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "strlen ( %str% )")) {
|
if (Token::Match(tok, "strlen ( %str% )")) {
|
||||||
|
@ -3803,7 +3792,6 @@ bool Tokenizer::simplifyTokenList2()
|
||||||
modified |= simplifyCalculations();
|
modified |= simplifyCalculations();
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// simplify redundant loops
|
// simplify redundant loops
|
||||||
simplifyWhile0();
|
simplifyWhile0();
|
||||||
|
|
Loading…
Reference in New Issue