Commit Graph

7145 Commits

Author SHA1 Message Date
Daniel Marjamäki 05a21d45eb Fixed #6670 (Analysis failed when there are {} in LHS in compound assignment) 2015-07-27 13:44:35 +02:00
Daniel Marjamäki 35eb1a393d AST: handle concatening of strings better. this is not ideal but better. 2015-07-27 13:13:30 +02:00
Daniel Marjamäki 64b72bd6e5 Fixed #6227 (False positive (oppositeInnerCondition) - if (!dynamic_cast<>)) 2015-07-27 10:43:52 +02:00
Daniel Marjamäki 5cc744b941 Fixed #6872 (Major performance regression - valueFlowSwitchVariable) 2015-07-27 06:45:06 +02:00
Daniel Marjamäki 389aec51ae Fixed #6598 (False positive zerodivcond - cast to double ignored) 2015-07-26 22:08:36 +02:00
Daniel Marjamäki ed1c6e41d9 Fixed #6876 (valueFlowForward: lambda function) 2015-07-26 19:28:42 +02:00
Alexander Mai 7c48bf3ca5 MathLib::isFloat now detects C99 hexadecimal float literals. MathLib::isDecimalFloat was added for C++ and pre-C99 compatibility. 2015-07-26 19:21:53 +02:00
Daniel Marjamäki 190550f9f9 Fixed #6877 (ValueFlow: valueFlowForward, after goto label the value is not known) 2015-07-26 17:05:21 +02:00
Daniel Marjamäki ae124cb365 ValueFlow: Attempt to make --debug output easier to understand by using words 2015-07-26 16:32:31 +02:00
Daniel Marjamäki 9197e70a8d ValueFlow: Changed --debug output so we can see if a variable is known or possible 2015-07-26 15:36:09 +02:00
PKEuS 7f9a313b94 Fixed hang in VS10 debug mode (AppVeyor) 2015-07-26 14:20:18 +02:00
Daniel Marjamäki 7f1af06df0 Preprocessor: fixed gcc -Wreorder warning 2015-07-26 13:48:01 +02:00
PKEuS 2342b604b0 Refactorized preprocessor (speedup of preprocessing time by ~10%):
- Reduced memory usage of PreprocessorMacro by 87,5% (removed redundant or unused members)
- Use char overload of std::string::find where possible
- Reordered conditions
2015-07-26 12:03:40 +02:00
Daniel Marjamäki 4e293d47c5 CheckMemoryLeak: Fix handling of comparisons after simplifyIfNotNull is removed, detected problem with run_more_tests 2015-07-26 11:27:52 +02:00
Alexander Mai bbec54db8e Implement MathLib::isFloatHex to detect C99 hexadecimal floating pointer literals. Rename MathLib::isHex to MathLib::isIntHex 2015-07-26 08:06:56 +02:00
Daniel Marjamäki afd9f071c0 simplified the code for ValueFlow Known/Possible values 2015-07-25 19:36:29 +02:00
PKEuS 92b867dd2c Fixed behaviour of --quiet/-q and its description 2015-07-25 17:55:12 +02:00
Daniel Marjamäki acc1566f64 uninitvar: Improved condition handling. Fixes one problem when running 'tools/run_more_tests.sh test/testuninitvar.cpp' 2015-07-25 17:55:01 +02:00
PKEuS 8ed0180279 Use C++11 string.back() instead of string[string.length()-1] 2015-07-25 17:19:53 +02:00
Daniel Marjamäki b0df668975 fix VS warning 2015-07-25 13:23:48 +02:00
Daniel Marjamäki e5151a13ab Fixed #6867 (False positive memleak) 2015-07-25 11:37:03 +02:00
PKEuS 53d7620b1a VS solution: Use check.h as precompiled header (reduces build time for core by 50%) 2015-07-25 11:13:19 +02:00
Daniel Marjamäki f939381673 Preprocessor: Fix buffer overflow if line is empty 2015-07-24 19:19:07 +02:00
Simon Shanks 9910c1fa0c Fixed #6617 (preprocessor performance improvement) 2015-07-24 13:30:41 +02:00
Daniel Marjamäki 8ffa917fa2 Fixed #6863 (AST: wrong handling of assignment between ? and :) 2015-07-24 13:02:00 +02:00
Daniel Marjamäki 234669b02b Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected. 2015-07-24 08:30:38 +02:00
PKEuS 795e5de903 Refactorization: Cleaned up after ExecutionPath removal 2015-07-23 20:37:09 +02:00
Daniel Marjamäki 367eecf0db Fixed Cppcheck internal warning, simpleMatch can be used instead of Match 2015-07-23 19:13:50 +02:00
Daniel Marjamäki c2a15ac286 Removed ExecutionPath 2015-07-23 19:01:12 +02:00
Daniel Marjamäki 3dbf290220 Refactor CheckStl::erase so it doesn't use ExecutionPath 2015-07-23 18:53:31 +02:00
Daniel Marjamäki ea933e9873 CheckUninitVar: Removed ExecutionPath based checker 2015-07-23 17:28:18 +02:00
PKEuS d45021673e Assign different IDs for different nullPointer messages (#6166) 2015-07-23 14:53:18 +02:00
Daniel Marjamäki 0b81a267f4 uninitvar: handling arrays in non-executionpath checker 2015-07-23 14:51:38 +02:00
PKEuS ce9272a4ed Refactorized file listing code (CLI):
- Apply PathMatch in FileLister::recursiveAddFiles() already to avoid touching directories that are ignored (#5775)
- Simplified code to warn about header exclusion; use Path::isHeader() instead of custom header filename detection
2015-07-23 14:28:17 +02:00
PKEuS 229d488048 Fixed build 2015-07-23 13:15:58 +02:00
Frank Zingsheim 1c12378ce9 Simplified pattern in Tokenizer::simplifyExternC() (#5544) 2015-07-23 13:04:25 +02:00
Daniel Marjamäki eda3fdc96a CheckCondition: Refactoring function parameter lookup 2015-07-23 12:06:33 +02:00
Frank Zingsheim 907dea92b1 Fixed #6844 (CMake with matchcompiler) 2015-07-23 10:49:53 +02:00
Frank Zingsheim 6485339d66 Support lambdas in "else if" simplification (#6860) 2015-07-23 09:41:35 +02:00
Daniel Marjamäki 8d8c03dad8 uninitvar: removed returns from new checking to fix 'more' tests. these returns should be readded when the executionpath checking is removed. 2015-07-23 09:21:53 +02:00
Daniel Marjamäki 79067ac031 uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases. 2015-07-23 08:46:59 +02:00
Daniel Marjamäki 1de1aaa2f4 CheckUninitVar: Fix crash when AST is not created properly 2015-07-22 22:17:12 +02:00
Daniel Marjamäki 1f5eea98b5 CheckUninitVar: Fix a FP reported for invalid code 2015-07-22 21:58:06 +02:00
Daniel Marjamäki 42ed436e9d Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath 2015-07-22 20:31:58 +02:00
Daniel Marjamäki 75f922e799 cleanup checkother 2015-07-22 18:48:43 +02:00
Daniel Marjamäki b38062743d Refactoring handling of if conditions in CheckMemoryLeak 2015-07-22 16:45:14 +02:00
PKEuS 258e3b9dc3 Refactorization: Renamed Token::isOperator() to Token::isOperatorKeyword() to avoid confusion with Token::isOp(), use Token::isOperatorKeyword() in setVarId(). 2015-07-22 13:57:51 +02:00
Robert Reif 4e693f1620 Fixed #6827 2015-07-22 13:57:51 +02:00
PKEuS ab1113fb16 Fixed crash on garbage code #6859 2015-07-22 13:33:24 +02:00
Daniel Marjamäki b2b4bb49fa Refactoring handling of comparisons 2015-07-22 12:31:18 +02:00
Daniel Marjamäki c67776c04d Testing: extract testcases, edit comparisons, run cppcheck, compare results 2015-07-22 09:52:24 +02:00
Daniel Marjamäki 6313304f77 Fix Travis build 2015-07-22 01:52:24 +02:00
Daniel Marjamäki c6cadf5252 Fix Travis build 2015-07-22 01:41:01 +02:00
Daniel Marjamäki 350cba1c59 CheckLeakAutoVar: updated handling of comparisons after Tokenizer::simplifyIfNot was removed 2015-07-22 01:24:07 +02:00
Daniel Marjamäki f711520892 Fixed #6852 (false negative: logical conjunction 'x == 0') 2015-07-21 22:26:22 +02:00
Daniel Marjamäki f9d22f70db Removed simplifyIfNot simplification (#6072) 2015-07-21 20:56:47 +02:00
Daniel Marjamäki 24269b1061 Refactoring CheckMemoryLeak::notvar, use AST instead of token parsing 2015-07-21 20:27:59 +02:00
Daniel Marjamäki 1b8252181d Tokenizer: Removed Tokenizer::simplifyIfNotNull (#6072) 2015-07-21 17:58:44 +02:00
Daniel Marjamäki ffc707246b ValueFlow: Better handling of Known/Possible values after conditional unknown function call 2015-07-21 17:56:40 +02:00
PKEuS 7f6b6e43b1 Support strings in CheckStl::mismatchingContainers() (#6839) 2015-07-21 14:13:26 +02:00
PKEuS a3eb725c3f Support C++03-style of declaring a copy ctor as deleted (#6585) 2015-07-21 13:46:50 +02:00
amai2012 e8ac4d8e87 #6847 segmentation fault (invalid code) in Token::multiCompare. Fix and simple refactoring in Tokenizer 2015-07-21 13:40:50 +02:00
PKEuS bdd53b4142 Fixed false positive #6717 2015-07-21 12:13:59 +02:00
PKEuS dd9cb929bf Refactorization in Preprocessor: Support beginning/end of file in removeSpaceNearNL(), avoid string copying when calling replaceIfDefined() 2015-07-21 12:13:58 +02:00
Daniel Marjamäki 2e2735518e AST: Updated printAst 2015-07-21 11:54:11 +02:00
Daniel Marjamäki 8a72bb8aa8 AST: Fixed AST for struct initialisation 2015-07-21 11:40:42 +02:00
PKEuS 149d11d9ad Improved handling of inline assembly (#6813):
- Add ; after asm {} block if required
- Fixed inline suppressions
2015-07-20 23:09:54 +02:00
PKEuS a0890ecd2c Fixed false positive: Do not print useClosedFile on arrays (#6823) 2015-07-20 22:40:19 +02:00
PKEuS c987a99ac8 Fixed hang on garbage code (#6824) 2015-07-20 22:33:32 +02:00
Daniel Marjamäki 749bb34deb Fixed #6830 (ValueFlow: value of switch-variable inside switch) 2015-07-20 19:45:38 +02:00
Alexander Mai defee734f5 #6846 segmentation fault (invalid code) in CheckClass::hasAssignSelf 2015-07-20 19:04:34 +02:00
Daniel Marjamäki c0880c8d79 ValueFlow: Values that are assigned in switch are possible after switch 2015-07-20 09:36:56 +02:00
Frank Zingsheim 8416be4d9d #6345 Tokenizer::simplifyTypedef() adds redundant 'typename' to declaration 2015-07-20 07:55:22 +02:00
amai2012 af9b67562b Merge pull request #626 from simartin/ticket_6648
Ticket #6648: Properly handle variables that have been deallocated and whose _address_ is taken after
2015-07-19 18:04:47 +02:00
Simon Martin fa94f2e0f4 Ticket #6648: Properly handle variables that have been deallocated and whose _address_ is taken after in CheckLeakAutoVar. 2015-07-19 17:37:50 +02:00
Alexander Mai 8b97f04de4 Try to address some Coverity issues. Add TODO testcase for #5783. Introduce TODO_ASSERT macro. 2015-07-19 15:03:35 +02:00
Daniel Marjamäki ce7e879460 ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction 2015-07-18 15:35:39 +02:00
Daniel Marjamäki 5aa0b284dc ValueFlow: Evaluate more calculations when operands have known values 2015-07-18 15:03:57 +02:00
Simon Martin 1f73d71542 Ticket #5776: Simplify (&a)->b into a.b 2015-07-17 23:27:35 +02:00
Simon Martin af1b0cfddf Ticket #6835: Don't get confused by parentheses while detecting template parameter default values. 2015-07-17 21:30:34 +02:00
Daniel Marjamäki 25d9ebedd8 ValueFlow: fixed known/possible value of static variable 2015-07-17 20:48:37 +02:00
Daniel Marjamäki f1e410a878 ValueFlow: value that is changed in do while loop must be possible instead of known. 2015-07-17 20:30:34 +02:00
Daniel Marjamäki 69c1a7ecb1 ValueFlow: default argument values are not known, they are possible 2015-07-17 16:05:07 +02:00
Daniel Marjamäki cb04dfbd37 Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition)) 2015-07-17 15:30:23 +02:00
Daniel Marjamäki 577ab1c2ac ValueFlow: result of ? is not 'known' 2015-07-17 15:22:24 +02:00
Daniel Marjamäki 61cf224f32 ValueFlow: Make known loop value possible 2015-07-17 10:24:24 +02:00
Daniel Marjamäki 9bdee7fce9 ValueFlow: Refactoring setTokenValue() 2015-07-17 09:46:31 +02:00
Daniel Marjamäki 3d5781743c ValueFlow: Restore handling of not 2015-07-16 21:17:44 +02:00
Daniel Marjamäki 15a8e4d2df Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
This reverts commit a3fbad50cb.

The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki 09efe140fe ValueFlow: Change value to 'Possible' after conditional assignment in inner loop 2015-07-16 21:08:32 +02:00
Daniel Marjamäki 38214b6907 ValueFlow: function arguments only has 'possible' values 2015-07-16 20:49:14 +02:00
Daniel Marjamäki fa13179c68 Fixed Cppcheck warning, condition is always true 2015-07-16 20:23:25 +02:00
Daniel Marjamäki a3fbad50cb Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition)) 2015-07-16 20:17:57 +02:00
Daniel Marjamäki 88491267d6 ValueFlow: Added Value::valueKind that says if value is known or possible 2015-07-16 17:33:16 +02:00
Alexander Mai d45aa6170b Minor refactoring in Tokenizer: Optimize for C code and use nullptr instead of 0 2015-07-16 00:29:48 +02:00
Simon Martin 2d8993319c Ticket #6810: Avoid infinite loop upon invalid typed enum declaration. 2015-07-15 21:39:15 +02:00
Daniel Marjamäki b821e996e1 MathLib: Add TEST_MATHLIB_VALUE that is used to test MathLib::value 2015-07-15 17:36:41 +02:00
Alexander Mai b604d63dd8 #6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code 2015-07-15 15:19:48 +02:00
Alexander Mai b30d9ffe98 #6838 cppcheck hangs on some strange input code. Token::astOperand1/2 throw internal error on garbage code instead of creating endless recursion in AST 2015-07-14 21:07:10 +02:00
Daniel Marjamäki 177fd9c79d MathLib: make isinf and isnan more portable 2015-07-14 20:48:08 +02:00