Commit Graph

6077 Commits

Author SHA1 Message Date
Robert Reif 193645318b Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later 2015-01-17 07:42:49 +01:00
Thomas Jarosch 08985bf68a Throw exception in getVariableFromVarId() if called with out_of_range varId
That way we have a chance to catch code bugs at all.
2015-01-15 18:52:11 +01:00
Thomas Jarosch cf64fd3dad Add more complex variation of the #6406 unit test
This is a false negative right now.
2015-01-15 14:45:10 +01:00
Thomas Jarosch 0286abfb45 Add unit test for #6406 2015-01-14 23:05:33 +01:00
Thomas Jarosch 1cc85bfce3 Add bounds check to getVariableFromVarId()
While poking around the memory leak check,
I managed to trigger an out-of-bounds access
in the symbol database.

Fix it by sanity checking the variable id
passed to getVariableFromVarId().
2015-01-14 23:00:38 +01:00
orbitcowboy a26aa1cd16 testmathlib: Fixed typo in comment, no functional changes. 2015-01-14 00:51:50 +01:00
Robert Reif 68bb197bcb Destructor detected as constructor resulting in false variable not initialized warnings 2015-01-12 06:11:22 +01:00
Martin Ettl 910af75e3a testmemleak: Added missing () in test case. 2015-01-11 10:27:37 +01:00
Martin Ettl 37c89a6b70 Fixed #6311: Add support for GNU get_current_dir_name(). 2015-01-11 10:12:39 +01:00
Aneesh Azhakesan S fe5d2fc245 Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure)) 2015-01-10 12:21:55 +01:00
PKEuS 7452613479 Refactorization:
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
Daniel Marjamäki 6a8293a8b7 Library: More strict matching of functions 2015-01-08 19:31:41 +01:00
Robert Reif ba1c24ee65 Fixed #6422 (symbol database: put function flags into a single flag variable) 2015-01-08 05:45:31 +01:00
Matthias Krüger 0259b4a672 testgarbage: add code example from #6361 to testrunner 2015-01-07 16:44:46 +01:00
Thomas Jarosch 2cb2161c5d Fix unmatched local suppression error message for "unusedFunction" (#6228)
This fixes a regression from commit
e35329aba3
(fix for #4946)
2015-01-07 15:40:12 +01:00
orbitcowboy 4c2e42a52c alwaysTrueFalseStringCompare: Added more test cases to ensure no FP appears. 2015-01-07 08:38:39 +01:00
orbitcowboy c07b07b8fe Fixed #6415 - FP stringCompare memcmp(ptr, ptr+offset, length). 2015-01-07 08:30:05 +01:00
Daniel Marjamäki a87fb96eaf Uninitialized variables: fix fp when 'a=((b)=c)' is used 2015-01-06 18:03:40 +01:00
Daniel Marjamäki eee9183406 ValueFlow: improved handling of conditional noreturn scope in valueFlowForward 2015-01-06 14:12:35 +01:00
Daniel Marjamäki f2e5fbd30d Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better. 2015-01-06 07:44:04 +01:00
Daniel Marjamäki 1f698ca493 ValueFlow: Fixed valueFlowForward, when condition is false and else-block returns dont set values below the else-code 2015-01-05 16:39:47 +01:00
Daniel Marjamäki fe8d04e840 CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]' 2015-01-05 14:54:24 +01:00
Daniel Marjamäki c5467766e2 ValueFlow: Fix for valueflow analysis after for loop 2015-01-05 14:00:12 +01:00
Daniel Marjamäki a80101f277 CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it 2015-01-05 13:23:38 +01:00
Daniel Marjamäki fb685f096a CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?: 2015-01-05 10:01:04 +01:00
Daniel Marjamäki d1927e3492 Removed Tokenizer::simplifyStructInit simplification. 2015-01-04 16:48:52 +01:00
Daniel Marjamäki 7bafbfbd6e Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux) 2015-01-04 13:50:54 +01:00
PKEuS e06a4cdf00 Refactorized CheckStl::if_find():
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
Daniel Marjamäki f94243f85e CheckMemoryLeak: Fix fp for allocation function that returns success value 2015-01-04 11:46:26 +01:00
Daniel Marjamäki b3c2ea2c4f CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro 2015-01-04 11:13:20 +01:00
Zachary Blair 22bd20c94a New check: Use make_shared/make_unique (#5673) 2015-01-04 11:07:53 +01:00
PKEuS 11fa185cae Fixed crash on range-based for-loop 2015-01-03 22:36:39 +01:00
PKEuS 7ece58c3a0 CheckStl::stlOutOfBounds() now uses <container> information from Libraries 2015-01-03 22:18:33 +01:00
PKEuS e39729ffcc Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki eb1c048d2a Tokenizer: Fix wrong simplification when checking linux kernel 2015-01-03 21:35:03 +01:00
PKEuS 267552779d Improved check (#6391): Detect identical code in both branches of ternary operator 2015-01-03 18:01:49 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 1355f49af7 Fixed false positive: Support assignments in CheckStl::if_find() 2015-01-03 11:29:13 +01:00
PKEuS 8885ac3eba Fixed #6217, refactorized CheckStl::if_find(): allow all comparison operators, use AST, fixed wrong unit tests 2015-01-03 11:07:11 +01:00
Martin Ettl 465f74b3bb Fixed #6398 - false negative: (warning) Unnecessary comparison of static strings. 2015-01-02 12:58:04 +01:00
PKEuS 417f42f732 Fixed #6096: bool is an integral type, but there is no portability issue if a pointer is assigned to a bool. 2015-01-02 21:07:02 +01:00
PKEuS 274e1a838a Fixed #5871: Properly parse initialization list in setVarId() if constructor is declared as noexcept 2015-01-02 20:03:06 +01:00
orbitcowboy d53f2f583c Fixed #6388: Support strncasecmp 2015-01-02 14:04:55 +01:00
PKEuS c4fd8919a2 Fixed #6014: Added plausibility check before issuing null pointer messages on function calls defined in library 2015-01-02 13:35:39 +01:00
PKEuS 88990bac59 Fixed #6386: Improved behaviour on unknown language (header file) 2015-01-02 12:32:23 +01:00
Daniel Marjamäki 2831bbd420 ValueFlow: better handling of goto to avoid false positives 2015-01-01 14:29:49 +01:00
Alexander Mai d2caf89706 #6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095. 2014-12-31 18:19:10 +01:00
Daniel Marjamäki 5c2a2a5c22 Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects) 2014-12-31 15:14:22 +01:00
PKEuS 58f4660c94 Fixed #5223: Bailout in valueFlowForLoop1() for complex conditions
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS 5dc45bd4ac Fixed #5497: Support designated initializers in array size detection 2014-12-30 19:23:01 +01:00