Commit Graph

7325 Commits

Author SHA1 Message Date
Alexander Mai f91ad9bbf6 5402 false positive: (error) Division by zero -- with boost::format 2015-08-01 17:28:54 +02:00
Martin Ettl b7ea311123 Running astyle. No functional changes. 2015-08-01 12:31:16 +02:00
amai2012 b182edddda #6909 segmentation fault (invalid code) in Tokenizer::simplifyEnum 2015-08-01 12:24:22 +02:00
Alexander Mai acf050793e #6907 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1 2015-08-01 07:39:56 +02:00
Alexander Mai 4400f2ac85 #6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks. 2015-07-31 20:24:06 +02:00
Matthias Krüger 8bfbb5d09c CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes 2015-07-31 15:29:07 +02:00
Matthias Krüger 83ee640977 Tokenizer::syntaxError: put the character that we have an invalid number of into singlequotes instead of parentheses. 2015-07-31 15:28:59 +02:00
Matthias Krüger 87891b4128 CheckCondition::checkIncorrectLogicOperator put conditions in single quotes 2015-07-31 15:28:48 +02:00
Matthias Krüger 21ed807f8d CheckCondition::alwaysTrueFalseError: put condition in single quotes. 2015-07-31 15:28:37 +02:00
Daniel Marjamäki 251f6d2a15 Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented) 2015-07-31 07:03:52 +02:00
amai2012 249a05126b #6895 segmentation fault (invalid code) in CheckCondition::isOppositeCond 2015-07-30 17:19:19 +02:00
Daniel Marjamäki 503fb485cf Removed hardcoding of functions from checkZeroDivision 2015-07-30 13:48:51 +02:00
Daniel Marjamäki 1752c4f4f0 Avoid 'Condition always true/false' FP when part of the condition is an expanded macro 2015-07-30 13:30:16 +02:00
amai2012 c5673612e2 #6069 False positive incorrectLogicOperator due to dynamic_cast. Run CheckCondition::checkIncorrectLogicOperator on non-simplified tokenlist. 2015-07-30 10:30:30 +02:00
Daniel Marjamäki 9085fdc156 Fixed #6887 (False positive eraseDereference - container is member of member variable) 2015-07-30 10:13:49 +02:00
Daniel Marjamäki 594d30f7ae Fix Cppcheck warning about unused variable 2015-07-29 20:26:00 +02:00
Daniel Marjamäki 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +02:00
PKEuS 738057229c Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
Handle sizeof in isSameExpression() (#6851)
2015-07-29 14:28:24 +02:00
Daniel Marjamäki 120f3072eb alwaysTrueFalse: Dont write warning when comparison is made in macro 2015-07-29 12:51:00 +02:00
Daniel Marjamäki fc25ed8c86 Fixed #6879 (valueflow in do-while(++i)) 2015-07-29 11:55:07 +02:00
Daniel Marjamäki bf75ee9aed Fixed #6885 (valueflow ignores assignment of variable via function call) 2015-07-29 10:49:17 +02:00
amai2012 1f43550688 #6880, 6881 Crashes on invalid code. Fix null pointer access 2015-07-28 18:41:50 +02:00
Dmitry-Me 544932734f VS: Disable 4482 warning 2015-07-28 18:33:45 +02:00
Daniel Marjamäki 0e82730ee4 addons/naming.py: fixed error report for function name 2015-07-28 14:34:37 +02:00
Daniel Marjamäki 5a57e4030a dump: Add Function name attribute 2015-07-28 14:18:58 +02:00
Daniel Marjamäki a1dfd6cf73 astyle formatting 2015-07-28 12:47:08 +02:00
Daniel Marjamäki a17f4d0a2d CLI: Added --debug-normal option that will show --debug output after 1st simplifications. This output is relevant for the 'normal' checkers. 2015-07-28 12:46:32 +02:00
Daniel Marjamäki e759710198 Fixed #6743 (valueFlowAfterCondition: wrong value when variable is changed in conditional code) 2015-07-28 08:58:05 +02:00
Daniel Marjamäki c5bbea2994 Fixed #6816 (FP: buffer overflow, checkminsizes of array with string value) 2015-07-27 16:39:41 +02:00
Daniel Marjamäki f449e91d43 made valueFlowSwitchVariable faster when there are many 'case %num%:' 2015-07-27 14:57:02 +02:00
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
Antti Tuppurainen a75872a15e Fix uniform init in out-of-class ctor-initer 2015-07-14 18:09:07 +02:00
Daniel Marjamäki 405a1fba11 ValueFlow: set values for false/true 2015-07-14 18:02:26 +02:00
Daniel Marjamäki 1a872a2c9f Fixed #6019 (false negative: Expression is always true/false '!(v!=10) && !(v!=20)') 2015-07-13 20:53:49 +02:00
Daniel Marjamäki 7ccd30362c Fixed #6826 (False positive: ValueFlow conditional value used in condition) 2015-07-12 19:35:47 +02:00
Daniel Marjamäki a4a866ab07 Fix Cppcheck warning about non-explicit constructor for MathLib::value 2015-07-10 21:17:17 +02:00
Daniel Marjamäki ac04541d56 MathLib: Add value class. this will allow more type-independant value handling. 2015-07-10 20:36:38 +02:00
Daniel Marjamäki f36f1e8952 MathLib: Minor tweaks. Use toDoubleNumber instead of std::atof. Only use clang workaround with clang. 2015-07-10 18:34:28 +02:00
Daniel Marjamäki 81d9c90890 Fixed Cppcheck warning caused by a redundant null pointer test. 2015-07-08 21:04:38 +02:00
Daniel Marjamäki 0dd008e068 Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 16:06:35 +02:00
Daniel Marjamäki 5a9328f26a Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 13:41:27 +02:00
Simon Martin 7bfb1fb545 Simplify the code handling C++0x typed enumerations. 2015-07-06 23:37:16 +02:00
Boris Egorov f7c6140e1a checkautovariables: Simplify some conditions 2015-07-05 17:15:13 +02:00
Daniel Marjamäki f3b4c1d0db Remove some useless casts, probably added to avoid false positives. 2015-07-04 13:19:21 +02:00
Daniel Marjamäki b8e77c8005 valueflow: fix for ?:. the condition result is not a result of the ?. 2015-07-04 11:17:38 +02:00
Daniel Marjamäki fef251ac76 negative array size: fixed noise when array is not vla 2015-07-04 09:42:42 +02:00
Daniel Marjamäki 7e1ddea653 One more fix for #6811 (ValueFlow: result of ?:) 2015-07-02 20:52:04 +02:00
Daniel Marjamäki c751039612 Fixed #6811 (ValueFlow: result of ?:) 2015-07-02 20:11:27 +02:00
amai2012 4a1695c879 #6807 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #6808 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw InternalError on garbage code 2015-07-01 16:31:49 +02:00
Alexander Mai 6e03e7dca2 Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle 2015-07-01 07:50:13 +02:00
amai2012 480a5672b0 #6298 stack overflow in Scope::findFunctionInBase (endless recursion). Fix handling of circular class hierarchy 2015-07-01 00:04:01 +02:00
amai2012 1604e751e5 Fix some compiler warnings which got introduced recently 2015-06-30 20:11:51 +02:00
amai2012 99dfd55d0c #6804 segmentation fault (invalid code) in Token::getValueTokenDeadPointer. Fix null pointer access
TestGarbage: Increase coverage by running all code snippets as C as well as C++ code. (inspired by #6800)
2015-06-30 19:40:22 +02:00
amai2012 c0b91662ba #6803 segmentation fault (invalid code) in Token::findClosingBracket. 2015-06-30 12:16:55 +02:00
amai2012 0849deed01 #6801 C: FN variable scope, FP unused value?. Fix typo from d7aa65c1fc 2015-06-30 08:46:30 +02:00
amai2012 11538c84f6 Refactoring: Distinguish between C and C++ code
Refactoring: Replace CheckNonReentrantFunctions::initNonReentrantFunctions by static initialization
2015-06-29 21:17:15 +02:00
Alexander Mai d7aa65c1fc #6800 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix null pointer access for invalid C code 2015-06-29 19:56:02 +02:00
Martin Ettl b8e08ca5d8 Code cleanup. 2015-06-28 19:27:23 +02:00
Martin Ettl 7ff4d10c43 Astyle formatting, no functional changes. 2015-06-28 19:25:13 +02:00
amai2012 5814c3b84c Fix some compiler warnings with VS
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai 0b225fa02f 2nd attempt to fix crash in CheckUnusedFunctions::check. CheckBufferOverrun::checkBufferAllocatedWithStrlen: Don't check for 'new' in C code. 2015-06-28 18:34:09 +02:00
Alexander Mai 02a3a01eca Fix compiler warnings 2015-06-28 18:07:31 +02:00
Alexander Mai 2c73518e29 Fix platform-dependent test result, formatting and crash in whole program analysis 2015-06-28 17:54:48 +02:00
amai2012 4a47b8b3ae Refactoring: Better distinguish between C and C++ in a few checks. 2015-06-28 16:49:16 +02:00
Alexander Mai 56e90f95d9 Corrections for non-Microsoft compilers 2015-06-28 12:34:08 +02:00
amai2012 649a89d308 Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
Alexander Mai e75662aaf1 #6792 segmentation fault (invalid code) in TemplateSimplifier::templateParameters. Avoid null pointer access 2015-06-25 20:48:05 +02:00
amai2012 ac1f0301c0 #6791 segmentation fault (invalid code) in TokenList::createAst. Fix null pointer access 2015-06-25 08:57:09 +02:00
Alexander Mai c047fae53b #6790 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix null pointer access 2015-06-25 07:47:40 +02:00
Alexander Mai 8946fcd960 #6772 segmentation fault (invalid code) in Tokenizer::setVarId. Add another validate() call to Tokenizer::simplifyTokenList1. Small refactoring to Tokenizer: mark many methods as private. 2015-06-24 20:47:04 +02:00
Alexander Mai 6ba9c21fb9 #6786 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses. Small refactoring for Tokenizer::simplifyTokenList2() including additional calls to validate() - which prevents heap corruption on invalid code 2015-06-24 20:22:28 +02:00
amai2012 9fedc9bd74 #6788 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl. Fix null pointer access 2015-06-24 16:54:23 +02:00
Alexander Mai f806d945a1 Refactoring: Allow TemplateSimplifier to throw InternalErrors by itself. 2015-06-23 20:53:57 +02:00
amai2012 69f91ac187 #6785 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access 2015-06-23 17:59:01 +02:00
Alexander Mai 07bcc7157b #6784 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access 2015-06-22 20:43:26 +02:00
amai2012 99524b1f59 #6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther 2015-06-22 11:12:46 +02:00
Alexander Mai b6858622eb #6779 internal error: division overflow. Previous error handling (see #4520) was too restrictive. 2015-06-20 23:15:35 +02:00
Alexander Mai 4172011e78 Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring 2015-06-20 22:49:28 +02:00
Alexander Mai b3c7a3f798 Fix more (potential) multi-threading issues 2015-06-20 22:26:51 +02:00
Simon Martin 7481fbb028 Fixed #6506 (Properly detect calls to the deallocating free() function) 2015-06-20 21:00:54 +02:00
Daniel Marjamäki 1d49334398 Fixed #6662 (False positive assignIfError (assignment in while condition)) 2015-06-20 16:23:16 +02:00
Martin Ettl 272cf27ec3 Improved constness of local variable, no functional changes. 2015-06-20 11:33:27 +02:00
Daniel Marjamäki 63f39ea48f Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour. 2015-06-20 11:22:15 +02:00
Simon Martin cba0583045 Ticket #6536: Properly handle variables whose name is that of an allocation function. 2015-06-19 23:48:40 +02:00
Daniel Marjamäki af4a4663e2 Fixed #6764 (False positive redundantCondition - !(i>1) is not i<1) 2015-06-19 19:49:05 +02:00
Daniel Marjamäki 02df692b0b Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2015-06-19 18:21:46 +02:00
Alexander Mai 712919a691 #6431 Invalid XML created - Invalid encoding of string literal. Partial fix: ensure the short message string is also processed to avoid problems with non-terminated string. 2015-06-18 21:16:25 +02:00
Alexander Mai 60f5bd97df Refactoring: missing include added, (potential) multi-threading issue fixed, expose static method to allow unit testing 2015-06-18 19:07:51 +02:00
PKEuS 189a652c2e Fixed garbage code in checkinternal.cpp 2015-06-18 17:13:46 +02:00
Matthias Krüger baaf3213e4 checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given. 2015-06-18 13:23:48 +02:00
Alexander Mai 13c1c2c035 Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code. 2015-06-17 22:28:15 +02:00
Alexander Mai eebb5b8c77 Fix some compiler warnings in checkio.cpp. Fix some (potential) multi-threading issues in checkinternal.cpp 2015-06-17 21:25:15 +02:00
Daniel Marjamäki a884362817 Fixed #6752 (wrong AST when there is lambda function) 2015-06-17 19:32:44 +02:00
orbitcowboy 06e818f89d Running astyle, no functional change. 2015-06-17 09:09:23 +02:00
amai2012 33d7631ee3 Fix another Borlad-specific test by setting Windows platform type
Refactoring: make CheckIO::ArgumentInfo aware of language (C vs. C++) to perform some optimizations
2015-06-16 23:11:34 +02:00
amai2012 a8db00b4bf Repair test which had to be adjusted after previous changeset.
Refactoring: Add some const
2015-06-16 22:45:33 +02:00
amai2012 919fcb38f5 Refactoring Tokenizer
Create Tokenizer::simplifyAsm2(), skip simplifyExternC() in C code and
simplifyBorland() on non-Microsoft or C code
2015-06-16 20:53:11 +02:00
Martin Ettl 9b14ab15eb MathLib::intsuffix: Added support for LLU and LU suffixes. 2015-06-16 19:12:18 +02:00
amai2012 227b48212e Skip some C++-specific simplifications in Tokenizer 2015-06-15 19:42:20 +02:00
Daniel Marjamäki 2cc23b4bb3 MathLib: Try to keep type suffix in constant calculations 2015-06-15 19:01:56 +02:00
XhmikosR 8fc4456fb4 Fix compilation error with MSVC 2013 after a7b82b5. 2015-06-15 16:06:18 +03:00
Alexander Mai a5a835b1e0 #6771 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase 2015-06-14 22:18:28 +02:00
Daniel Marjamäki d571d5db6f Fixed compiler warning -Wfloat-equal in template when type is double and there is equality comparison 2015-06-14 20:25:52 +02:00
Daniel Marjamäki 1e1ba6b4a9 Fixed #6574 (False positive oppositeInnerCondition - unknown variable) 2015-06-14 20:06:05 +02:00
Alexander Mai 70ba6c4340 #6767 False positive: memory leak when variable name is 'new'. Fix handling of new in C code. Move some tests for TokenList to new testtokenlist.cpp 2015-06-14 15:49:49 +02:00
Alexander Mai a7b82b5c28 Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed 2015-06-13 18:08:13 +02:00
Alexander Mai 40d7baa6bb Fix more (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-13 16:22:43 +02:00
Alexander Mai d704e97203 Fix (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-10 21:14:17 +02:00
Daniel Marjamäki 3986c0dc64 fixed cppcheck warnings 2015-06-10 19:07:04 +02:00
Dmitry-Me cae605b1ec New warning: warn about redundant code in condition. 2015-06-10 18:53:55 +02:00
Frank Zingsheim 0e354a03bd Fixed #6716 (Performance: Alternative String Representation in Match Compiler) 2015-06-07 16:21:06 +02:00
Daniel Marjamäki 0ca410a4d7 Fixed #6668 (False positive bufferAccessOutOfBounds on sprintf() - regression) 2015-06-07 14:01:20 +02:00
Alexander Mai c18461b173 #6761 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash. 2015-06-07 13:35:51 +02:00
Daniel Marjamäki 75b0430ba5 Token::strValue: fixed handling of backslash 2015-06-07 11:25:33 +02:00
Alexander Mai b6264e4a00 #6759 segmentation fault (invalid code) in Tokenizer::simplifyTokenList2. #6760 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crashes 2015-06-06 13:11:32 +02:00
Daniel Marjamäki d208e763df astyle formatting 2015-06-05 14:34:53 +02:00
Daniel Marjamäki e36cc9f6d9 stringLiteralWrite: Updated error message 2015-06-05 14:34:13 +02:00
amai 5fd9dd04fa #6757 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash 2015-06-04 19:00:35 +02:00
Alexander Mai 5f4902c613 6755 segmentation fault (invalid code) in Token::isAssignmentOp. #6756 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix two crashes. 2015-06-04 17:46:52 +02:00
amai2012 f2d397882f #6753 segmentation fault (invalid code) in CheckMemoryLeakStructMember::checkStructVariable. #6754 segmentation fault (invalid code) in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes. Trivial fixes to avoid null pointer access 2015-06-03 17:17:53 +02:00
amai2012 87bf09c0ae #6751 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-03 11:39:30 +02:00
amai2012 ed5a4127e8 #6749 segmentation fault (invalid code) in Tokenizer::copyTokens. #6750 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-03 10:39:19 +02:00
amai2012 d36c84553f #6748 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw error from now (member-function) Tokenizer::processFunc 2015-06-03 08:59:38 +02:00
Alexander Mai d86ac9e3ed #6747 segmentation fault (invalid code) in Token::isAttributeConstructor 2015-06-02 22:26:17 +02:00
Alexander Mai 09f2cff519 #6746 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-06-02 21:52:08 +02:00
Alexander Mai 6e1b5a0a53 #6744 segmentation fault (invalid code) in Tokenizer::simplifyPointerToStandardType. #6745 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-06-02 21:20:41 +02:00
Alexander Mai 454d4573b4 #6742 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix in Type::initBaseInfo() 2015-06-02 20:15:21 +02:00
Alexander Mai f348c8eebe #6741 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-02 20:09:12 +02:00
Alexander Mai 7fc9930b38 #6740 segmentation fault (invalid code) in Tokenizer::simplifyFunctionPointers. Throw syntaxError instead 2015-06-02 19:48:20 +02:00
Alexander Mai a3bdd90df5 #6739 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix segfault in the specified method 2015-06-02 19:40:20 +02:00
Alexander Mai be3690920a #6738 Avoid segfault on garbage code in Tokenizer::simplifyTypedef() 2015-06-02 19:07:26 +02:00
amai2012 7895f1c2bb #6737 Avoid segfault on garbage code inside Type::initBaseInfo. Disable test TestGarbage::garbageCode58() for #6732 since it triggers memory corruption still 2015-06-02 18:28:43 +02:00
Martin Ettl 0a148a9433 Running astyle, no functional changes. 2015-06-01 22:09:56 +02:00
amai2012 4b2fb4b76c #6735, #6735 Fix segfault on garbage code
Throw syntax error instead
2015-06-01 21:47:06 +02:00
Daniel Marjamäki 4bde4d5a4a updated style messages 2015-06-01 21:22:47 +02:00
Alexander Mai fb2bd978ad #6732 segmentation fault (invalid code) in Tokenizer::simplifyEmptyNamespaces. Add testcase, segfault seems to have been fixed by previous commit. Run astyle 2015-06-01 13:46:13 +02:00
amai2012 b81e82d462 #6733 segmentation fault (invalid code) in Tokenizer::simplifyAddBracesPair
Avoid access to NULL-token by throwing an InternalError
2015-06-01 13:27:32 +02:00
Frank Zingsheim 6857dbe864 #6729 Simplification reference to constants. 2015-06-01 10:00:03 +02:00
Simon Martin 519bd7007a Ticket #6588: Properly detect whether the condition in a ternary operator is constant on C input. 2015-05-31 22:40:13 +02:00
Simon Martin 85b47636dc Simplify known variableswhen they are at the end of a statement. 2015-05-30 23:34:50 +02:00
orbitcowboy 9c6ce2b06b Merge pull request #605 from simartin/no_space_in_decl
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers
2015-05-30 21:22:14 +02:00
Simon Martin c73876b3a8 Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers. 2015-05-30 21:00:41 +02:00
Simon Martin 98e6dca4f2 Ticket #6713: Properly detect ternary operator in valueFlowForward. 2015-05-30 20:55:36 +02:00
Alexander Mai ddc80246c2 #6724 segmentation fault (invalid code) Token::isAttributeConstructor. Local fix to avoid access to NULL-token 2015-05-30 19:15:53 +02:00
Alexander Mai 4050d56169 #6722 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-05-29 21:44:00 +02:00
Martin Ettl d5d6d7fbb8 Running astyle, no functional changes. 2015-05-29 20:20:05 +02:00
amai2012 5b347c537b Fix #6720 and #6721 (Crashes on garbage code)
Local fixes to avoid access to NULL-token
2015-05-29 19:30:55 +02:00
Martin Ettl 9236ea4a20 Running astyle, no functional changes. 2015-05-29 19:15:41 +02:00
amai2012 e41beb4f8d Fix #6718 and #6719 (crashes on garbage code).
Local fixes avoiding access to NULL-token.  Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai 098391ee32 #6715 segmentation fault (invalid code) in TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates. Harden TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates() 2015-05-28 21:38:20 +02:00
Alexander Mai 8adff0a31b #6712 segmentation fault (invalid code) in CheckExceptionSafety::checkRethrowCopy. Local fix to avoid accessing NULL-token 2015-05-28 21:12:02 +02:00