Commit Graph

7583 Commits

Author SHA1 Message Date
Alexander Mai 6ae1533cb4 #7190 Cppcheck hangs with 100% CPU load in Tokenizer::simplifyAttribute (invalidcode). Call validate() once more in Tokenizer::simplifyTokenList1 to trigger invalid code exception 2015-12-05 13:55:33 +01:00
PKEuS 308fd1ba50 Fixed false positive 'noCopyConstructor' for static member variable (#7198) 2015-12-04 18:26:49 +01:00
PKEuS 46d6623182 Refactorization: Improved performance of Tokenizer::isFunctionParameterPassedByValue()
- Skip it for C code
- Improved performance by around 80% on C++ code (3,5% of entire runtime)
2015-12-03 14:44:59 +01:00
PKEuS 70767a30c4 Small refactorizations:
- Avoid calling c_str() for functions that take std::string
- Avoid copying std::list
2015-12-03 14:19:30 +01:00
Daniel Marjamäki 7f4dae8de4 Merge pull request #714 from Dmitry-Me/betterVariableNames
Better variable names, more linear code
2015-12-03 13:46:28 +01:00
PKEuS 32e2fb2f78 Refactorization: Prefer Token::simpleMatch over Token::Match also for non-const patterns. 2015-12-03 13:04:55 +01:00
PKEuS 00662ec484 Refactorization: Improve performance of simplifyTypedef by using Token::simpleMatch by ~15% (forgotten in b8d39a2229) 2015-12-03 12:50:42 +01:00
Dmitry-Me cb84b88cb1 Better variable names, more linear code 2015-12-03 14:20:46 +03:00
amai2012 f624f6fc25 Merge pull request #713 from Dmitry-Me/eliminateRepeatedLookup2
Eliminate repeated lookup
2015-12-03 10:18:08 +01:00
Dmitry-Me be49abf460 Eliminate repeated lookup 2015-12-03 11:03:18 +03:00
Daniel Marjamäki a51df5f00d Removed unused CppCheck::analyseFile 2015-12-03 08:42:12 +01:00
PKEuS b8d39a2229 Refactorizations:
- Improve performance of simplifyTypedef by using Token::simpleMatch by ~15%
- Simplified code in simplifyTypedef
- Ran AStyle
2015-12-02 23:32:50 +01:00
PKEuS 7ea9e3ca4f Refactorization: Improve performance of simplifyTypedef by adding a pre-check for Token::link() by ~25% 2015-12-02 22:41:09 +01:00
Dmitry-Me 0a3959f201 Remove duplicate check 2015-12-02 17:28:21 +03:00
PKEuS 423b254772 Merge pull request #711 from Dmitry-Me/moreInterlockedCases
Detect more non-interlocked accesses
2015-12-02 14:13:53 +01:00
orbitcowboy 1a94b876f1 preprocessor: Improved constness of local variable. 2015-12-02 13:58:24 +01:00
Dmitry-Me 8f8a0097fe Detect more non-interlocked accesses 2015-12-02 10:58:57 +03:00
PKEuS c79bc6c59d Refactorization: Call std::string::find_first_of() only once. 2015-12-01 23:11:24 +01:00
Daniel Marjamäki 508b06abaa Fixed #6973 (ValueFlow: dont set possible tokvalues in unreachable code) 2015-12-01 07:49:19 +01:00
Alexander Mai f762affea0 Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart' 2015-11-30 22:13:49 +01:00
Matthias Krüger c7bbc27130 Preprocessor: run paths of some error messages through Path::simplifyPath()
teach Path::simplifyPath() to recursively remove "./././" from beginning of paths.
2015-11-30 19:30:37 +01:00
Daniel Marjamäki 9c3f25603e CheckBufferOverrun: Remove old checking of strings and use new ValueFlow-based checking instead (#6973) 2015-11-30 16:36:52 +01:00
Daniel Marjamäki 8fb6f33aca ValueFlow: dont set dynamic values in unreachable code (#6973) 2015-11-30 16:15:58 +01:00
Daniel Marjamäki 1b0bb02f1d invalidTestForOverflow: Fixed some false negatives (#7184) 2015-11-30 11:12:51 +01:00
Daniel Marjamäki fb8cce647c invalidTestForOverflow: Refactor; move from checkother to checkcondition 2015-11-30 08:51:15 +01:00
Daniel Marjamäki f6f4f27636 CheckOther::checkInvalidTestForOverflow: minor fix, only warn when warnings are enabled. 2015-11-29 22:03:42 +01:00
Daniel Marjamäki 26a07265a8 Fixed #7184 (Invalid test for overflow 'p + x < p') 2015-11-29 20:59:50 +01:00
Daniel Marjamäki 4fa888ec44 Warn when shifting a negative value, it is UB. (#4931) 2015-11-29 16:28:55 +01:00
Daniel Marjamäki 8a9e068129 Fixed #7119 (Cppcheck hangs with 100% CPU load in Tokenizer::copyTokens (invalidcode)) 2015-11-29 14:56:15 +01:00
Alexander Mai 53dbcb956f Small refactoring: use a single complete set for reserved for each C/C++. Replace NULL by nullptr 2015-11-29 13:23:13 +01:00
Alexander Mai f5194accfd Run dmake. Add missing include to lib/checkinternal.cpp 2015-11-29 11:09:21 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki 8bb8290a6f Fixed GCC warnings. unused variable, shadow variable. 2015-11-28 18:15:47 +01:00
Alexander Mai 78489f4293 MathLib::characterLiteralToLongNumber can encode unicode char literals, though it's incompatible to gcc/clang 2015-11-28 16:37:26 +01:00
Daniel Marjamäki 5fabe66ff7 simplifyCalculations: better handling of && and || in conditions (#4931) 2015-11-28 15:00:41 +01:00
PKEuS ac17541ca9 Refactorizations:
- Fixed a few more MSVC warnings by using correct types
- Store severity as enum instead of string in Settings::Rule
2015-11-28 12:30:21 +01:00
PKEuS 93c02ce826 Fixed compiler error introduced in previous commit and several MSVC warnings 2015-11-28 10:49:08 +01:00
Daniel Marjamäki 6b124a37d8 Cleanup some casts 2015-11-28 10:11:07 +01:00
Daniel Marjamäki 8689693d6c Fix Travis 2015-11-28 09:26:44 +01:00
Daniel Marjamäki c0da6c1541 simplifyCalculations: handle '(4%1<<1&4!=1)' better. must combine '!' '=' before constant folding. fixed the operator precedence for comparison operators. (#4931) 2015-11-28 09:04:22 +01:00
Alexander Mai 44305fd98e #6940 Unsigned overflow in TestBufferOverrun::negativeArraySize. Don't try to calculate size of array with negative array size 2015-11-28 07:27:52 +01:00
Alexander Mai c70b71e353 #5888 fsanitize=undefined: signed integer overflow: 4611686018427387904 * 2 cannot be represented in type 'long long int' in valueflow.cpp 2015-11-27 21:45:08 +01:00
Alexander Mai c6ec5ca734 Fix MathLib::characterLiteralToLongNumber for LP64 again. 2015-11-27 21:43:51 +01:00
Alexander Mai d4749c3377 Fix excessive left shift of signed integer and some doxygen errors 2015-11-27 19:32:28 +01:00
Daniel Marjamäki 1bf547c716 Fixed #4931 (Wrong calculation for '2|0*0&2>>1+0%2*1') 2015-11-27 15:02:49 +01:00
Daniel Marjamäki 1977a18a1e simplifyNumericCalculations: Don't fold negative constants in shift/bitmask calculation. Behaviour is not well defined. 2015-11-27 14:16:49 +01:00
PKEuS 3b4160600d Fixed crash in CheckMemoryLeak::functionReturnType() for unary operator:: (#7172) 2015-11-27 11:18:40 +01:00
PKEuS 0ba3d25917 CheckMemoryLeak: Correctly detect new char[...]() as array allocation (#7164) 2015-11-27 11:04:18 +01:00
Frank Zingsheim 70c20515a9 Cmake object linkage. Fix #7128: (cppcheck 1.70 doesn't report any warnings) 2015-11-26 20:25:09 +01:00
Matthias Krüger 87ce88d6ab CheckFunctions::checkProhibitedFunctions(): don't warn about alloca when --enable=warning is not given. 2015-11-25 22:05:51 +01:00