Commit Graph

5887 Commits

Author SHA1 Message Date
PKEuS 1cb14f687f Merge pull request #322 from simartin/del_useless_fwd_decl
Remove unnecessary declaration (one line before the actual definition...)
2014-05-25 23:54:20 +02:00
PKEuS 8f083af1e4 Attempt to fix travis build 2014-05-25 22:11:56 +02:00
Simon Martin c027c526a9 Remove unnecessary declaration (one line before the actual definition... 2014-05-25 22:04:51 +02:00
PKEuS a407b55945 Added support for lambdas to AST
Fixed bug that return statement left an operand on the stack
2014-05-25 21:55:39 +02:00
PKEuS 04f3caf8e8 Fixed debug message #5159 2014-05-25 14:16:03 +02:00
PKEuS 55c87248ba Fixed crash on complex cast. 2014-05-24 20:21:08 +02:00
PKEuS d42275c5f1 Fixed TODO in checkAssignBoolToFloat 2014-05-24 20:06:45 +02:00
Alexander Mai e6a394d514 CheckBool::checkAssignBoolToFloat() - don't crash on unknown variables 2014-05-24 19:15:43 +02:00
PKEuS 38aaa46804 Stabilized AST:
- Fixed broken simplification causing crashs when cast was followed by unary minus (real world examples from arch/parisc/math-emu/ (linux-kernel))
- Stabilized determination of unary and binary operators
2014-05-24 19:05:04 +02:00
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
Daniel Marjamäki bb8973aac7 Updated Makefile 2014-05-24 12:54:16 +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
PKEuS 1fc1ff1993 Moved implementation of two functions to new file check.cpp -> Don't include <iostream> everywhere 2014-05-24 12:50:04 +02:00
PKEuS 8f79dc3ff8 Cleaned up includes and forward declarations in checkers:
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
 - Removed unused includes
2014-05-24 12:50:03 +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
PKEuS b0b0562247 Removed obsolete piece of code from checkbufferoverrun.cpp 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
orbitcowboy d299cae5ef Fixed typo in comment, no functional changes [ci-skip] 2014-05-23 22:31:01 +02:00
orbitcowboy 6183f21070 Fixed CID 1037088 Dereference after null check in Tokenizer::simplifyLabelsCaseDefault. 2014-05-23 21:38:56 +02:00
orbitcowboy 7920afdc60 Fixed CID 1037101 Dereference after null check in ExecutionPath::checkScope. 2014-05-23 18:27:34 +02:00
orbitcowboy 85496cfadc Fixed CID 1192595: Dereference null return value in checkother. 2014-05-23 18:11:44 +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 f1c303d399 Fixed recently introduced verbose message for cstyleCast
[ci skip]
2014-05-22 15:46:28 +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 d19f676547 Fixed travis build warning (Check Internal). 2014-05-22 18:00:06 +02:00
orbitcowboy ee5cd91d51 MathLib: removed duplicated #include 2014-05-22 17:53:13 +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 3275881056 Improved checkBufferOverrun::classInfo (#4667) 2014-05-22 09:13:29 +02:00
PKEuS 35528ca708 Added verbose message for "C-style pointer casting" (#4140) 2014-05-22 08:57:45 +02:00
Alexander Mai cccddc20bf #5843 MathLib::toLongNumber()/MathLib::toULongNumber() now use min/max values for bigint/biguint type in case the number to converted cannot be converted properly 2014-05-21 21:36:17 +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 d500f50670 Fixed problem in VS solution if spaces are in the solution path 2014-05-21 15:42:05 +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 e3009bdd0b Tokenizer:simplifyKeyword(): Improved matching when the static keyword is removed. 2014-05-13 16:47:55 +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
orbitcowboy ac8d283afb Fixed CID 1214638: Dereference before null check (REVERSE_INULL). 2014-05-12 17:18:51 +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 d3d3803ae4 Merge pull request #312 from matthiaskrgr/travis
travis: compile one pair of jobs with -DCHECK_INTERNAL and run --enable=internal,...
2014-05-19 22:36:45 +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
Matthias Krüger 879023b6b2 travis: compile one pair of jobs with -DCHECK_INTERNAL and run --enable=internal,...
suppress warnings in testtoken.cpp
fix warnings in valueflow
2014-05-19 21:44:00 +02:00
PKEuS 5c566e838c Fixed false positive "multiplySizeof" in TortoiseSVN 2014-05-19 20:57:13 +02:00
PKEuS 8cb1f09fc2 Silenced travis errors (avoid false positive) 2014-05-19 20:56:05 +02:00
PKEuS 09e03fa6ef Fixed some complaints of PVS Studio 2014-05-19 14:37:54 +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 e713ad45cb Refactorizations:
- Simplified pattern ".|->" to "."
- Use nextArgument() where appropriate
2014-05-18 17:07:21 +02:00
PKEuS b162560755 Refactorizations:
- Removed some duplicate nullpointer checks
- Simplified tok->link() on '<' usage.
2014-05-18 17:07:21 +02:00
PKEuS 780719665f Fixed crash when checking tinyxml introduced by previous commit 2014-05-18 13:40:49 +02:00
PKEuS 20753f4697 Refactorization: Use AST in CheckOther::checkRedundantCopy(), CheckOther::clarifyStatement() and CheckPostfixOperator::postfixOperator(). 2014-05-18 13:00:58 +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
Simon Martin 69d294c6c4 Ticket #5816: Skip typename in template arguments for enum initializers. 2014-05-17 08:50:12 +02:00
Simon Martin 92cc17110d Ticket #5814: Handle A::B as template parameter for enum initializers. 2014-05-15 21:52:57 +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
PKEuS 70dfb55f21 Simplified some Token::Match patterns 2014-05-11 17:50:58 +02:00
Alexander Mai 6fe2f8b01b #5782 Endless recursion in CheckClass::checkReturnPtrThis(). Break endless recursion by remembering the callstack (missing header file) 2014-05-11 12:27:43 +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 827cfac91e Refactoring of CheckOther::checkModuloAlwaysTrueFalse using AST 2014-05-10 20:49:29 +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
PKEuS 59418e605f Increased version number to 1.65.99/1.66 dev. 2014-05-10 12:57:33 +02:00
Daniel Marjamäki c0131eea9e 1.65: Set version 2014-05-10 12:02:06 +02:00
Daniel Marjamäki f31ec37d52 Fixed 2 Cppcheck warnings. Function can be static|const 2014-05-10 11:49:14 +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
PKEuS c0fc47643f Fixed false positive #5772: Use AST to check if modulo operation is preceded by an arithmetical operation. 2014-05-09 21:58:28 +02:00
Daniel Marjamäki 1541e27e4a Fixed #5533 (False positive: 'Assignment of function parameter has no effect outside the function.') 2014-05-09 18:43:29 +02:00
Daniel Marjamäki cb43bee10d Same expression: don't warn for same expressions when there is assignment 2014-05-09 06:16:27 +02:00
Simon Martin 512e22d1ba Ticket #5315: Memory leak analysis confused by ((variable).attribute) notation. 2014-05-08 20:58:24 +02:00
Daniel Marjamäki 25f40b8b97 Merge pull request #298 from simartin/clang_s-getFlag_warn
Silence clang -Wsign-conversion warning with Token::setFlag.
2014-05-08 15:54:25 +02:00
Daniel Marjamäki 331d7e2e42 Merge pull request #297 from simartin/ticket_5605_5759
Fix ticket #5605 (take 3)
2014-05-08 15:51:42 +02:00
Simon Martin 53d5df8cef Silence clang -Wsign-conversion warning with Token::setFlag. 2014-05-08 14:16:43 +02:00
Simon Martin 2a6acdf357 Ticket #5605: Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values.
Ticket #5759: Properly handle pointers to class members in template parameter lists.
Ticket #5762: Handle template specialization tokens.
2014-05-08 13:54:56 +02:00
Daniel Marjamäki 9fc8bdcbac Fixed #5770 (AST: better handling of 'a.b[c.d]==0') 2014-05-08 06:48:53 +02:00
Daniel Marjamäki 4710c5c4f1 Merge pull request #296 from mpaladin/master
Fix redundantConditionError check description
2014-05-07 16:01:26 +02:00
Robert Reif 0bdecfd9cb Fixed #5767 (move bool Variable flag into flag variable) 2014-05-07 15:59:21 +02:00
Massimo Paladin 5e996bc63b Fix redundantConditionError check description 2014-05-07 14:54:50 +02:00
Daniel Marjamäki 5ad3ac2653 Fixed #5695 (FP: Mismatching assignment and comparison) 2014-05-06 19:35:47 +02:00