Commit Graph

5574 Commits

Author SHA1 Message Date
Alexander Mai 2c8087e34f #4375 New check: add style warning about 'double d=false;' Add a new check to CheckBool. Also implement Variable::isFloatingType() 2014-05-24 18:35:49 +02:00
PKEuS effa38c322 Fixed #5863 (False positive: array index is used before limits check) 2014-05-24 17:50:01 +02:00
PKEuS a04036337d Fixed #5860: Don't show returnTempReference for calculations on unknown types 2014-05-24 12:50:04 +02:00
PKEuS adf38fcfd0 Further include cleanup 2014-05-24 12:50:04 +02:00
amai2012 00e28de3b7 Merge pull request #315 from simartin/ticket_5823
Ticket #5823: Properly count template parameters in TemplateSimplifier::useDefaultArgumentValues
2014-05-24 11:47:14 +02:00
PKEuS b78131cfcf Improved cast detection in AST:
-> Make use of it in checkother.cpp

Use tokenizer simplification instead of reimplementation for test suite
2014-05-24 11:29:32 +02:00
Simon Martin 2b809800b6 Ticket #5823: Properly count template parameters in TemplateSimplifier::useDefaultArgumentValues and handle casts in template parameters' default values. 2014-05-23 23:38:40 +02:00
Simon Martin fcff8d39d9 Ticket #5816: Properly handle template'd template parameters in enum initializers. 2014-05-23 21:25:42 +02:00
PKEuS bc0682d1e9 Enhancements related to duplicate expression checking:
- Fixed astIsFloat() for complex expressions
- Enhanced support for commutative operators (#5260)
2014-05-22 21:46:48 +02:00
PKEuS f7a41057ad Use AST in CheckIO::checkCoutCerrMisusage() - fixes #3254. 2014-05-22 20:25:54 +02:00
PKEuS 9dd4ac68c0 Refactorization in CheckNullPointer:
- Use AST to detect dereferences
- Added more unit tests
- Removed handling of unknown constructs in CheckNullPointer::isPointerDeRef()

Added link to verbose message cstyleCast.
2014-05-22 19:48:00 +02:00
PKEuS 6635abbe55 Improved check: Complain about returning reference to literals or reference to calculation result (#4317) 2014-05-22 11:39:11 +02:00
orbitcowboy 031020ae4a #Fixed 5485: Wrong simplification of numbers like 1e+007 to 1e+007.0 2014-05-22 17:40:15 +02:00
PKEuS 4cad064c3c Fixed false positive on C code introduced by last commit 2014-05-21 20:36:19 +02:00
PKEuS d19eabde42 New Check: Compare pointer with '\0' (#4070) 2014-05-21 19:12:07 +02:00
PKEuS cdfed32500 Merged checkSelfAssignment() into checkDuplicateExpression():
- Fixed false negatives on self assignments of more complex expressions like "a.b"
- New false negative on self assignment in initialization
- Support this->... pattern in isSameExpression()
- Fixed #5819: Check type of operands
2014-05-21 18:19:42 +02:00
PKEuS 7b1eca700b Fixed bug in setVarId: VarIds for member functions defined inline in class were not properly set 2014-05-21 17:30:58 +02:00
PKEuS 48c3d02fc3 Fixed false positives and false negatives in 'oppositeInnerCondition' (among others: #5808) 2014-05-21 14:38:41 +02:00
PKEuS 01a0154daa Fixed false positive #5848 2014-05-21 13:45:36 +02:00
orbitcowboy 90c1016c74 Fixed #5842: remove C99 static keyword between [] in tokenizer. 2014-05-13 16:28:28 +02:00
Alexander Mai be9a566d48 Refactoring/small corrections to fix warnings from clang -fsanitize=undefined 'member call on null pointer' 2014-05-20 21:55:08 +02:00
Robert Reif e993e2927c Fixed #5831 (FP in 1.65: call of pure virtual function 'throw' in destructor) 2014-05-20 06:10:34 +02:00
PKEuS d1c4777053 Fixed two bugs in AST compilation (#5830):
- Correctly parse operators .* and ->*
- Support empty branch in ternary expression (a?:c)
2014-05-19 21:54:59 +02:00
PKEuS 5c566e838c Fixed false positive "multiplySizeof" in TortoiseSVN 2014-05-19 20:57:13 +02:00
Philipp Kloke ed7d0b321b Bugfixes for AST and AST testing:
- Validate AST in test suite: Check for operand1 being set if operand2 is non-zero
- Fixed buggy unit tests in AST
- Fixed detection unary operator* after return statement (MPC-HC false positive)
2014-05-19 11:17:37 +02:00
Mark de Wever d6db261213 Fixed #5827 (Invalid token match patterns) 2014-05-19 06:31:38 +02:00
PKEuS 5fbd58d98d Fixed messages of CheckInternal, fixed a false positive. 2014-05-18 20:39:52 +02:00
PKEuS 9cb544241d Internal checking is now enabled by the macro CHECK_INTERNAL 2014-05-18 19:50:06 +02:00
PKEuS 683d0b7e82 Partially rewritten AST compilation:
- More straightforward approach for handling right-to-left associativity
 - More straightforward approach to handling unary operators
 - Improved handling of brackets

This fixes #5784, #5795, #5797, #5799, #5810 and a bunch of other problems
2014-05-18 12:10:39 +02:00
Alexander Mai 91e7116de1 Fix regression from first attempt fixing #5811 (9dce9bddcb) 2014-05-17 19:14:29 +02:00
Alexander Mai 9dce9bddcb #5811 false postive: (error) Null pointer dereference 2014-05-17 18:18:20 +02:00
Daniel Marjamäki e04351ec33 re-enable tests in testnullpointer 2014-05-17 16:44:44 +02:00
Simon Martin 69d294c6c4 Ticket #5816: Skip typename in template arguments for enum initializers. 2014-05-17 08:50:12 +02:00
PKEuS dd76aa44be Merge pull request #309 from simartin/ticket_5814
Ticket #5814: Handle A::B as template parameter for enum initializers.
2014-05-16 08:24:45 +02:00
Simon Martin 92cc17110d Ticket #5814: Handle A::B as template parameter for enum initializers. 2014-05-15 21:52:57 +02:00
Alexander Mai f2e5da290b Replace 2 invalid test cases added while fixing #5793 by a valid one 2014-05-15 21:20:16 +02:00
Simon Martin e61e1cb13d Ticket #5786: Properly handle cv-qualified member pointers as template parameter. 2014-05-14 22:27:31 +02:00
Daniel Marjamäki 7ecdb30308 Fixed #5771 (false positive: (warning) When using 'char' variables in bit operations, sign extension can generate unexpected results.) 2014-05-13 15:53:31 +02:00
Alexander Mai 146bf11aa7 #5793 - False positive: Deallocation of an auto-variable (at reference notation) 2014-05-12 19:53:49 +02:00
PKEuS a3bb8bf39c AST: Parse ternary and assignment operators as right-to-left and on the same precedence level 2014-05-11 17:50:58 +02:00
Alexander Mai b139ae3209 #5782 Endless recursion in CheckClass::checkReturnPtrThis(). Break endless recursion by remembering the callstack 2014-05-11 12:26:24 +02:00
Daniel Marjamäki 0dfbbd0f80 Fixed #5479 (Tokenizer: don't remove parentheses in code 'a<b<c>>(2)') 2014-05-11 08:22:28 +02:00
Daniel Marjamäki 8cc1f664d8 Uninitialized member variable: Fixed false negative when struct is read 2014-05-10 20:20:55 +02:00
Daniel Marjamäki 4c344adcf1 Uninitialized struct member: fixed false negative when struct assignment is seen 2014-05-10 19:56:44 +02:00
PKEuS 04fbbdb5e8 Refactorized CheckBufferOverrun::arrayIndexThenCheck() and fixed false negative 2014-05-10 13:00:44 +02:00
Daniel Marjamäki 4e2c0617d3 Merge pull request #303 from simartin/ticket_5297
Ticket #5297: simplifyCalculations should pass once more on simplified tokens
2014-05-10 10:18:29 +02:00
Simon Martin 1e4902cb65 Ticket #5297: simplifyCalculations should pass once more on tokens being simplified. 2014-05-10 09:37:56 +02:00
Daniel Marjamäki 2905593cf6 Merge pull request #302 from simartin/ticket_5774
Ticket #5774: Properly handle "typename..." in template parameter list.
2014-05-10 09:32:06 +02:00
Simon Martin 46d8d81176 Ticket #5774: Properly handle "typename..." in template parameter list. 2014-05-09 22:20:22 +02:00
PKEuS edd84c0906 Fixed #5773: Don't prepend "std::" to function definitions 2014-05-09 21:58:28 +02:00