Commit Graph

1020 Commits

Author SHA1 Message Date
PKEuS 83a80cebeb Fixed order of simplifications (#6029) 2014-08-06 08:39:23 +02:00
PKEuS f3e0df7501 Support C++11 style initialization with {}:
-> Support in setVarId and SymbolDatabase (#4344)
-> Fixed false positives in unused variable checking (#5491, #5494)

Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
PKEuS 95afa51b24 Fixed crash #5991: Don't crash when lambda is incomplete
Fixed crash #6004: Support struct initializations in AST
2014-07-31 23:15:36 +02:00
Daniel Marjamäki 328cc7b8f5 Fixed #5996 (false positive: Clarify calculation precedence for '+' and '?'.) 2014-07-19 18:29:53 +02:00
Daniel Marjamäki 14def42c99 Fixed #5972 (FP: Buffer is accessed out of bounds) 2014-07-08 16:31:08 +02:00
Zachary D. Blair f6523e384b Fixed 4979 (Doesn't allow any ordering of int modifiers) 2014-07-01 23:59:04 -07:00
Simon Martin 7b942650c2 Ticket #5952: Simplify redundant parentheses in pointer variable declarations. 2014-06-28 09:36:51 +02:00
Daniel Marjamäki 72992c7973 AST: fixed ast for '++i;' 2014-06-26 17:31:57 +02:00
PKEuS e80104327a AST: Fixed detection of operator new/delete - don't hang when C code is checked as C++ (#5910) 2014-06-26 09:19:57 +02:00
orbitcowboy 76f3f67bcf Fixed fsanitize=undefined: left shift of negative value -10000 in lib/templatesimplifier.cpp. 2014-06-16 10:58:41 +02:00
Simon Martin efb12f0409 Ticket #5268: Properly detect function heads when in Tokenizer::simplifyEnum. 2014-06-15 15:52:58 +02:00
Simon Martin d588ed49b3 Ticket #5868: Ignore variables called like a typedef when substituing typedefs. 2014-06-14 00:50:14 +02:00
Simon Martin dc12a73987 Ticket #5907: Properly handle extern declarations in Tokenizer::simplifyVarDecl. 2014-06-08 14:59:58 +02:00
PKEuS 8fe515b929 Improved testing of AST, added unit test for #5787 2014-06-05 17:39:14 +02:00
PKEuS 2455b76abd Fixed lots of bugs in the AST:
- Support new and delete
- Properly handle "..."
- References and rValue references as function parameters
- Destructor definitions
2014-06-04 18:47:56 +02:00
PKEuS 39b64ea5fb Simplify rValue reference arguments without name (&& -> & &) 2014-06-04 18:45:56 +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 55c87248ba Fixed crash on complex cast. 2014-05-24 20:21:08 +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
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
orbitcowboy 031020ae4a #Fixed 5485: Wrong simplification of numbers like 1e+007 to 1e+007.0 2014-05-22 17:40:15 +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
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
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
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
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
Simon Martin e61e1cb13d Ticket #5786: Properly handle cv-qualified member pointers as template parameter. 2014-05-14 22:27:31 +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
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 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
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 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 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 6e25280c90 Reverted fix for #5605 since it cause this crash: #5759 2014-05-05 21:11:47 +02:00
Daniel Marjamäki 7d583e639c AST: Fixed handling of '(((typeof(x))*)0)' 2014-05-04 18:36:04 +02:00
Simon Martin b03f36cd71 Ticket #5709: Comma operator not properly tokenized. 2014-05-03 21:35:04 +02:00
Simon Martin ffe6a0be2b Ticket #5605: Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values. 2014-05-03 16:26:14 +02:00
Daniel Marjamäki 4b7aaba159 AST: assignment operators are executed from right to left 2014-05-03 12:08:42 +02:00
Daniel Marjamäki 648479d909 AST: Fixed tree for 'a.b[5]' 2014-04-29 06:09:26 +02:00
Daniel Marjamäki 9c74d914d7 Fixed #5667 (Tokenizer: simplify 'void (X::*f)()' to 'void *f') 2014-04-27 19:49:21 +02:00
Daniel Marjamäki d279f3fb41 Fixed #5736 (AST: proper handling of 'a=(b).c;') 2014-04-27 18:03:50 +02:00
Daniel Marjamäki 9f2e37da37 AST: fixed 'a.b++' and '*c[5]--' 2014-04-27 16:02:24 +02:00
Robert Reif ca9386859b Tokenizer: replace ') const| {' pattern to detect function start 2014-04-26 18:31:56 +02:00
Robert Reif cd6332d960 Tokenizer: replace ') const| {' pattern to detect function start 2014-04-26 18:30:09 +02:00
Daniel Marjamäki 11856b51aa AST: Fixed handling of 'a=b(c**)+1' 2014-04-26 13:32:08 +02:00
Daniel Marjamäki c34616a6ba AST: Fixed handling of 'a = b.c[++(d.e)];' 2014-04-26 13:16:34 +02:00
Frank Zingsheim ffa55bbaa0 Fixed #5725 (FP: multicondition Expression is always false because 'else if' in pngwrite.cxx (LibreOffice)) 2014-04-26 11:59:38 +02:00
Daniel Marjamäki 8602d13dc9 Fixed #5722 (AST: wrong handling of 'x = ((a[i])->getx)();' - the 'x' is an operand of the =) 2014-04-25 06:06:54 +02:00
Daniel Marjamäki 52e0e4453b Fixed #5646 (FP: pointer to array is not assigned a value.) 2014-04-21 16:14:49 +02:00
Daniel Marjamäki c98beafb6d Fixed #5675 (wrong AST generated for 'a>>=b') 2014-04-21 13:05:34 +02:00
Robert Reif 6ff5de2118 Fixed #5697 (Check for throw in __attribute__((nothrow)) function) 2014-04-20 20:40:55 +02:00
Daniel Marjamäki 5c116c622d AST: Fixed iscast detection in '*((DWORD*)&buf[0])' 2014-04-15 15:46:26 +02:00
Alexander Mai 547803f581 #5592 - crash: gcc: testsuit: gcc.c-torture/compile/limits-declparen.c (Limit stack depth below createAst() 2014-04-13 12:47:54 +02:00
Daniel Marjamäki 9d51bfd015 Fixed #5397 (False positive: Same expression on both sides of '&') 2014-04-12 16:06:31 +02:00
PKEuS 9c921ab657 Fixed handling of member function pointers in setVarId and SymbolDatabase (#4577) 2014-04-12 12:04:55 +02:00
PKEuS 83f4657e69 Fixed remaining issue in #3503: Member function taking a function pointer must not be "simplified" to a variable initialization 2014-04-12 12:04:55 +02:00
Alexander Mai e19129a409 Fix #4724 (Error in calculation shift operation: wrong sign: 1UL << 63) 2014-04-10 19:22:14 +02:00
Robert Reif 847d28d283 Fixed #5638 (is there any plan to check noexcept correctness?) 2014-04-10 16:17:10 +02:00
Daniel Marjamäki 049d68ae7d AST: Fixed bad syntax tree for 'if (x()[0]==1);' 2014-04-05 08:03:24 +02:00
PKEuS d4765bccc3 Refactorized inefficient usage of std::string and const char[] (part 2). 2014-04-03 14:56:14 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
Daniel Marjamäki 484483bd5d AST: fixed ast for 'for (*x=0;y;z)' 2014-03-31 17:16:13 +02:00
Daniel Marjamäki 225fb96554 Fixed #5627 (False positive assignBoolToPointer) 2014-03-31 15:55:54 +02:00
PKEuS 060f9035c9 Fixed crashs on garbage code (#5604) 2014-03-30 11:38:01 +02:00
PKEuS 1c58628223 Handle pointer/reference to array in setVarId (#2645) 2014-03-28 16:10:27 +01:00
PKEuS efe3f834be Refactorized handling of syntaxError: Print debug output, removed a few return values that are no longer required 2014-03-27 18:41:52 +01:00
PKEuS 9b307cf8e0 Improved readability of testsuite output when ASSERT_EQUALS_MSG fails.
Fixed another true positive in checkbufferoverrun.cpp
AStyle
2014-03-27 16:06:30 +01:00
PKEuS 7e4081f7f5 Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268) 2014-03-27 13:15:21 +01:00
PKEuS 560cf397d3 Fixed C++11 right angle bracket issue #5150 2014-03-22 13:34:15 +01:00
Daniel Marjamäki d939aa63a6 Tokenizer: Added test case for fixed crash to prevent regressions later 2014-03-19 16:47:11 +01:00
Robert Reif 806ef44509 Fixed #5328 (Does not handle __attribute((xxx)) in typedefs) 2014-03-19 05:38:23 +01:00
Daniel Marjamäki 177bf6fcb3 Fixed #5244 (FP: (error) Uninitialized variable: ptr - initialization within if-clause) 2014-03-18 06:37:19 +01:00
PKEuS 5f67bc1b0a Fixed varId problem #5293 (and its duplicate #5577): Classes inside functions are non-executable scopes. 2014-03-17 16:15:42 +01:00
PKEuS 521734faa2 Fixed setVarId-Bugs #5294 and #5295. 2014-03-17 14:19:46 +01:00
PKEuS 50f6bb5d36 Fixed crash #5511. 2014-03-17 11:50:45 +01:00
Lucas Manuel Rodriguez 9a08da17be Fixed #4928 (C++ operator aliases result in false 'assigned a value that is never used' warning) 2014-03-16 14:51:05 -03:00
Daniel Marjamäki 4d06bc086d astyle formatting 2014-03-09 08:49:32 +01:00
Simon Martin a3d1cac79c Ticket #5373: Keep track whether tokens come from a C or C++ file to properly handle %type% in Token::Match with "delete" 2014-03-08 21:26:06 +01:00
Simon Martin 4057242cb2 Ticket #5356: Added test case that works following the fix for #5506. 2014-03-02 10:10:58 +01:00
Simon Martin 3518e02d23 Ticket #5506: Skip template parameters when determining whether a template is a declaration or a definition. 2014-03-01 14:58:47 +01:00
Daniel Marjamäki 8550289722 Fixed #5452 (AST: wrong handling of unary ::) 2014-02-25 06:36:10 +01:00
Alexander Mai 0747b55485 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-24 18:52:31 +01:00
Daniel Marjamäki 34730f623a Fixed #5301 (False positive: (error) Division by zero - variables read from input stream) 2014-02-22 12:09:54 +01:00
Alexander Mai 82a2279425 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-20 16:56:49 +01:00
Daniel Marjamäki c050a92bae Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure) 2014-02-17 17:37:39 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki a1d9873558 Fixed #5465 (crash: AST doesnt produce good output for 'class C:public :🅰️:b<c>{..};') 2014-02-14 06:30:51 +01:00
Daniel Marjamäki 6ac9e180e0 ast: fixed hang when checking beid 2014-02-05 06:05:48 +01:00
Daniel Marjamäki 2ed3b40937 ast: fixed hang when checking bin-prot 2014-02-04 19:33:26 +01:00
Daniel Marjamäki d6e3b3d3f3 ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree 2014-01-30 17:31:06 +01:00
Daniel Marjamäki 312780b6fc TestTokenizer: refactored line2 test case 2014-01-28 17:18:28 +01:00
Kamil Dudka dee18d10a8 Fixed #5423 (fix parsing of #line NNNN "file.c") 2014-01-28 17:15:07 +01:00
Daniel Marjamäki 2108251851 Fixed #5417 (ast: avoid hang when '({})' is used) 2014-01-28 06:11:53 +01:00
Daniel Marjamäki c8a1424e10 Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git) 2014-01-27 06:18:42 +01:00