Commit Graph

6930 Commits

Author SHA1 Message Date
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 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
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
Alexander Mai f4aaa76639 Fix compile error with clang 2015-11-28 16:50:12 +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
Alexander Mai 174317429f Reduce number of threads TestThreadExecutor::many_threads a bit. Especially runs with dynamic analysis tools (asan/ubsan/etc.) cause very high system load. 2015-11-28 12:04:03 +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 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
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 1d7fac3ca9 Added testrunner test to cmake. #7098 2015-11-26 21:01:07 +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
Daniel Marjamäki 2737f63f71 Wrong calculation of constants (simplifying: +,<<,% operations) 2015-11-25 16:46:39 +01:00
orbitcowboy f84af529af Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects. 2015-11-25 11:02:32 +01:00
Alexander Mai a7ab5ecf08 Fix some compiler in MathLib::characterLiteralToLongNumber + some small refactoring 2015-11-23 20:41:21 +01:00
Daniel Marjamäki e8182395f7 Fix 'make checkcfg' by adding inline suppressions when obsolete functions are used. 2015-11-22 17:52:47 +01:00
Alexander Mai b7030fcfa1 Fix compiler error (VS2010) and warning 2015-11-22 16:56:44 +01:00
Daniel Marjamäki d93cf96a29 Fixed #6769 (false positive: Uninitialized struct member: epoch.integer) 2015-11-22 16:20:46 +01:00
Alexander Mai 63b7700660 Use clang/gcc-conforming encoding of multicharacter literals 2015-11-22 14:20:36 +01:00
PKEuS f516de8633 Moved a few checks from CheckOther to CheckFunctions 2015-11-22 13:49:10 +01:00
Alexander Mai 9ca6704c81 #7162 Support multicharacter char literals. 2015-11-22 13:31:31 +01:00
Matthias Krüger 8db72994fb make checkcfg / runtests.sh: be verbose (set -x) 2015-11-22 11:03:10 +01:00
Alexander Mai b1385dd951 Run dmake to update Makefile etc. 2015-11-22 10:40:48 +01:00
PKEuS 57d1196386 Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library (#6529) 2015-11-22 09:18:07 +01:00
Alexander Mai 517922feb6 MathLib::characterLiteralToLongNumber now reports more specific error messages for unsupported unicode literals (see #7162) 2015-11-22 07:38:38 +01:00
Alexander Mai 714579401f #7160 Internal error: Unhandled char constant '\1'. Correct MathLib::toLongNumber. Create new utility function MathLib::characterLiteralToLongNumber 2015-11-21 22:35:58 +01:00
Daniel Marjamäki 5f68f3ddf6 Fixed #6264 (FP: gimp: struct initialized via pointers to member variables) 2015-11-21 19:31:18 +01:00
Daniel Marjamäki fb0477affd CheckUninitVar: Fixed false negatives when there are conditions 2015-11-21 10:00:21 +01:00
PKEuS 12af125fd3 Fixed false positive stlIfStrFind for function call inside condition.
Removed unnecessary suppressions in .travis_suppressions
2015-11-20 20:08:53 +01:00
Daniel Marjamäki 8fd62e0cf9 Fixed #4931 (Wrong calculation of constants (simplifying: +,<<,% operations)) 2015-11-20 19:43:11 +01:00
Daniel Marjamäki 79a70c1277 MathLib::toLongNumber: Better handling of '\x12' and '\000' char constants 2015-11-20 18:57:48 +01:00
Daniel Marjamäki 4abc0b7c1f Partial fix for #4931 (Wrong calculation of constants (simplifying: +,<<,% operations)) 2015-11-20 16:09:47 +01:00
PKEuS c0e33e20b4 Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries 2015-11-20 15:53:14 +01:00
PKEuS 53b2eca983 Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries 2015-11-20 15:53:14 +01:00
Daniel Marjamäki 0022ce8075 Refactor handling of char constants 2015-11-20 10:10:38 +01:00
PKEuS c5b21d12cf Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg 2015-11-19 18:51:32 +01:00
PKEuS 2e7c5d37df Refactorizations in checkmemoryleak.cpp:
- Rely more on <alloc> declarations in Libraries
- Removed unreachable debug message
- Simplified code
2015-11-19 17:34:17 +01:00
PKEuS 0d25a43a5d checkmemoryleak.cpp: Refactorized CheckMemoryLeakNoVar::check() and replaced a redundant whitelist by CheckMemoryLeakInFunction::test_white_list() 2015-11-19 17:34:17 +01:00
Daniel Marjamäki 40851a12ef Fixed #4627 (Tokenizer::setVarId: function declaration in function body) 2015-11-19 16:27:16 +01:00
PKEuS ab171fc027 Fixed false negatives in CheckMemoryLeakStructMember::checkStructVariable():
- Use generic detection of allocation/deallocation (#4770)
- Make the checker usable for C++ by checking for destructors
- Reduced unit test duplication
2015-11-19 16:10:26 +01:00
PKEuS db6174bb60 Refactorization: Support Types that consist of more than a single token in CheckMemoryLeakNoVar::checkForUnsafeArgAlloc
Removed obsolete comments
2015-11-19 16:10:26 +01:00
Daniel Marjamäki 4d3e231bd0 Fixed #3948 (False positive: variable not initialised - used in multi-condition if-clause) 2015-11-19 13:09:45 +01:00
PKEuS 87d3ed91ab Refactorization:
- Improved and cleaned up CheckMemoryLeak::functionReturnType()
- Cleaned up whitelist from functions declared as <leak-ignore/> in std.cfg
2015-11-18 22:09:27 +01:00