Commit Graph

1314 Commits

Author SHA1 Message Date
Daniel Marjamäki aac9e66147 AST: fixed ast for 'new (char *)[10]' 2014-10-12 12:57:01 +02:00
Daniel Marjamäki f72a8d3f15 AST: fixed ast for 'a(new A(1)), b(new B(2))' 2014-10-12 12:13:01 +02:00
Daniel Marjamäki 649e2dfa97 AST: fixed ast for 'a = new (b) ::X;' 2014-10-12 11:12:25 +02:00
Daniel Marjamäki f96ea94048 AST: fixed ast for 'a(new (X), 5);' 2014-10-12 10:20:03 +02:00
Daniel Marjamäki c537c98751 AST: fixed ast for 'a(new (X));' 2014-10-12 09:24:43 +02:00
Simon Martin 70561682eb Tokenizer::simplifyConstTernaryOp: Properly detect the end of the 'false' part of ternary operators when it contains '>'. 2014-10-11 17:01:55 +02:00
Daniel Marjamäki 489fc6cce7 AST: more fixes of new statements in clang test suite. some of it is not handled very well. 2014-10-11 13:20:48 +02:00
Daniel Marjamäki 4783a67042 AST: fixes for more new statements from clang test suite 2014-10-11 11:27:13 +02:00
Daniel Marjamäki dd6ae3033f Tokenizer::simplifyRedundantParentheses: dont remove parentheses in 'void * operator new(SIZE_TYPE, int);' 2014-10-11 09:18:43 +02:00
Daniel Marjamäki e6708c1ae2 AST: fixed hang for 'new (int S::*[3][4][5])()' (clang test suite) 2014-10-11 08:32:49 +02:00
Daniel Marjamäki 66d4614a87 AST: don't hang when using auto in new statement 2014-10-10 12:47:01 +02:00
Daniel Marjamäki b5faf3a0cc AST: improved handling of new 2014-10-10 10:37:54 +02:00
Daniel Marjamäki cca003490b Fixed #6203 (AST: fix problem with '; static_cast<...') 2014-10-10 08:18:24 +02:00
Daniel Marjamäki 8233edcbf2 astyle formatting
[ci skip]
2014-10-10 08:15:46 +02:00
Simon Martin 9ddf857dc7 Ticket #5625: Simplify constant ternary operator in template parameters. 2014-10-04 20:49:57 +02:00
PKEuS a02712cb66 Some small refactorizations:
- Removed redundant calls to std::string constructor
- Use default parameters in some places
2014-10-03 10:02:46 +02:00
PKEuS 14f15d65e7 Support more patterns when replacing stuff like 'or' (#6201) 2014-10-01 08:41:55 +02:00
PKEuS 58fe668fc4 Fixed AST for operator:: after template (#6195) 2014-09-29 11:01:37 +02:00
PKEuS 55b14853d0 Fixed AST: Compile expression inside [] brackets of operator new. (#6193) 2014-09-29 10:26:15 +02:00
PKEuS 20966c5c37 Added test file for garbage code:
- cppcheck should be run entirely on garbage code to ensure that no check crashs/hangs on it (TODO).
- All garbage code tests should be moved here (TODO, so far only those from testtokenize.cpp were moved)
2014-09-24 13:45:56 +02:00
PKEuS affd0ffdfd Splitted large groups of tests out of testsimplifytokens.cpp and testtokenize.cpp 2014-09-24 13:23:44 +02:00
Lauri Nurmi 1cc872f5b2 Change "obsolete" in all filenames into "obsolescent", and also update all references to such files.
Neither the C standard, the C++ standard, or POSIX talks about "obsolete". All of them use the word "obsolescent", which is a different word with a different meaning.
2014-09-23 16:18:04 +02:00
Simon Martin 4b750997cb Ticket #6121: Report a syntax error for invalid enum initializers. 2014-09-13 20:46:53 +02:00
Daniel Marjamäki 0ab7abded1 AST: fixed cast for 'return (long long)c << 40;' 2014-09-12 06:43:52 +02:00
Frank Zingsheim 8c5013adda Fixed #6073 2014-09-07 21:53:32 +02:00
Simon Martin eeeb816db9 Ticket #6103: Simplify "new (type)" constructs into "new type" to avoid confusion upon certain input. 2014-09-05 08:02:18 +02:00
PKEuS 8c24553229 Support inherited member variables in setVarId (#4101) 2014-09-04 22:22:09 +02:00
Alexander Mai 5a96413220 #6127 crash on patch(?)-".c" file. Avoid segfault. 2014-09-04 21:28:18 +02:00
PKEuS 3ccdae78ba Support __declspec(property) (#4700) 2014-08-31 20:17:18 +02:00
PKEuS 6a4319f050 Improved simplifications:
- Rearranged their order to solve problems with typedefs. If we simplify chained declarations before typedef parsing, we have less complex expressions to deal with (#4777).
- Fixed detection of variables hiding enums
2014-08-26 15:21:19 +02:00
amai2012 b14ebb791b #5780 - Correct unit test which was calling wrong ASSERT 2014-08-26 12:19:58 +02:00
PKEuS 2326e78381 Fixed #6058: Don't detect class with unknown macro as variable.
Commented out crashing unit test tokenize33() in VS12
2014-08-26 10:40:00 +02:00
amai2012 e02741c82c #5780 Crash on template code below Tokenizer::setVarId(). Fix several crashes with same location. 2014-08-26 09:12:10 +02:00
Daniel Marjamäki cd75b2d83d AST: fix hang for code 'MACRO({.x=1,.y=2})' 2014-08-25 19:10:16 +02:00
Daniel Marjamäki 1060b30e52 AST: better AST for placement new expression 'new (a) MyClass;' 2014-08-23 13:21:36 +02:00
PKEuS c678937538 Fixed more false positives of #6056:
- Implemented nextArgument() for usages before < and > are linked
- slightly optimized nextArgument()
2014-08-20 15:02:52 +02:00
PKEuS 5d50e7e9ae Changed heuristics to detect variable constructor initialization syntax (#6071) 2014-08-19 11:06:52 +02:00
PKEuS eac2d58c9e Fixed fix for #6056 2014-08-18 20:40:43 +02:00
PKEuS e7754be316 Fixed #6056 - properly detect member functions in setVarId() 2014-08-18 11:07:56 +02:00
PKEuS 5c54f8d0d8 Support namespaces and static member variables in setVarId (only one depth) (#6061) 2014-08-18 10:25:30 +02:00
Daniel Marjamäki a52c122229 Tokenizer::createLinks2: set no template-links in 'if (a < b || c > d)' 2014-08-17 19:03:06 +02:00
Daniel Marjamäki 5cdbe0f42d ValueFlow: Improved value flow after for loop 2014-08-17 10:40:22 +02:00
Daniel Marjamäki 75ec97ad23 Tokenizer::simplifyKnownVariables: Fixed bad simplification in for loop header 2014-08-17 07:39:42 +02:00
PKEuS fd5ff1bb8b Fixed false positive #6030: inheriting classes is not a variable declaration. 2014-08-06 09:04:03 +02:00
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
Daniel Marjamäki ec034c1d59 Fixed #5386 (ast: hang when code is 'for (T a : b)') 2014-01-23 06:13:24 +01:00
Daniel Marjamäki 6a3a9ee8e7 ast: fixed tree for 'sizeof(struct S)' 2014-01-18 13:18:11 +01:00
Daniel Marjamäki 30cae358d8 Removed the --value-flow flag. ValueFlow analysis will always be enabled from now on. 2014-01-17 18:07:05 +01:00
Daniel Marjamäki 4eb746d7cc Tokenizer: Removed simplifyComparisonOrder 2014-01-17 17:25:56 +01:00
Daniel Marjamäki 85b73f7c24 ast: fixed hang for weird loop: 'for (each_window(list,p))' 2014-01-16 16:58:50 +01:00
Daniel Marjamäki e72ec830ef ast: fixed hang in for-loop handling 2014-01-16 06:45:35 +01:00
Daniel Marjamäki 141e089329 ast: different handling of for loops. create a syntax tree for whole 'f(a;b;c)'. 2014-01-15 17:32:14 +01:00
Daniel Marjamäki 752e9d0fb7 Tokenizer::varId: Fixed wrong varid for shadow types with same names as class members 2014-01-09 21:44:29 +01:00
Daniel Marjamäki 1be30bf022 ast: fixed handling of templates 2014-01-09 17:14:16 +01:00
Daniel Marjamäki 04cb56e070 ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast 2014-01-08 21:49:42 +01:00
Daniel Marjamäki 4f11086505 Tokenizer: Don't remove parentheses in 'a?b:(c>0?d:e)' 2014-01-08 20:53:33 +01:00
Martin Ettl 5a5277f2fa Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code. 2014-01-01 19:15:32 +01:00
Martin Ettl 0dccd3a632 Tokenizer:simplifyFlowControl(): Fixed crash on garbage code. 2014-01-01 19:04:02 +01:00
Simon Martin d2cf9fd77c Ticket #5266: Properly tokenize "complex" static variable declarations. 2014-01-04 10:49:27 +01:00
Daniel Marjamäki 7125682d1a Fixed #5274 (TokenList: macro handling) 2014-01-03 18:53:37 +01:00
Daniel Marjamäki 32be4094e7 Symbol database: only put variables in variable list 2013-12-31 17:51:56 +01:00
PKEuS 621cf6e777 Support arrays as template parameters in TemplateSimplifier::templateParameters 2013-12-31 13:59:32 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki e0eb000ac3 AST: Fixed problem with decrement 2013-12-27 14:40:59 +01:00
Daniel Marjamäki 5d5e347418 AST: better handling of 'sizeof(void*)' 2013-12-25 22:08:53 +01:00
Daniel Marjamäki 915cb6c757 Fixed #5261 (AST: cast not handled well (a::b&)x) 2013-12-25 21:19:28 +01:00
Daniel Marjamäki 596b4bd405 astyle formatting 2013-12-23 12:26:12 +01:00
Simon Martin 02dc49624d Ticket #5214: Don't read out of bounds upon invalid ternary operator. 2013-12-22 18:13:52 +01:00
Daniel Marjamäki e2bc99aa24 Fixed #5154 (Tokenizer: wrong handling of msvc 'for each') 2013-12-17 06:34:27 +01:00
Daniel Marjamäki f686cd6516 astyle formatting 2013-12-04 20:54:37 +01:00
Daniel Marjamäki 0c5282b1af Fixed #5081 (False positive: (error) Uninitialized variable: f (handling of C-cast not correct)) 2013-11-28 16:04:47 +01:00
Daniel Marjamäki 771dc2e1ad AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)' 2013-11-27 06:17:00 +01:00
Daniel Marjamäki 3b11ee9e0e AST: Improved handling of brackets 2013-11-25 20:58:40 +01:00
Daniel Marjamäki 94e2bf7a11 AST: Handle ({..}) 2013-11-25 04:07:44 +01:00
Simon Martin 9817da00ec Ticket #5168: Don't crash when simplifying bit-fields for invalid code. 2013-11-23 20:33:03 +01:00
orbitcowboy b74db1b791 Tokenize:simplifyFloatCast(): added corresponding suffix, incase of type 'float'. 2013-11-20 23:58:43 -08:00
orbitcowboy 1798fc3645 testtokenize:simplifyFloatCasts(): Added testcases for double and long double. 2013-11-17 08:44:05 -08:00
Daniel Marjamäki 6869d0de30 AST: Handle L'x' 2013-11-20 05:57:56 +01:00
Daniel Marjamäki 47b98470eb Tokenizer: Simplify float casts of integer constants 2013-11-19 18:07:12 +01:00
Daniel Marjamäki 2a640a59c2 Tokenizer: Improved handling of pointer aliases. This fixes some false negatives. 2013-11-16 17:30:04 +01:00
Daniel Marjamäki 30720affd6 Tokenizer::setVarId: Fixed hang when checking libgc 2013-11-15 16:16:22 +01:00
Daniel Marjamäki 673400920d AST: Fixed 'a[1][2]' 2013-11-13 17:52:56 +01:00
Daniel Marjamäki 7fe51eb58b Fixed #4989 (False positive: Wrong processing of __asm block) 2013-11-13 06:04:00 +01:00
Daniel Marjamäki 58d7caded1 AST: improved handling of casts 2013-11-11 16:39:34 +01:00
Daniel Marjamäki bb746261d3 AST: Fixed crash 2013-11-10 15:51:33 +01:00
Daniel Marjamäki 6ad2491817 AST: uninstantiated template 2013-11-04 22:58:47 +01:00
Daniel Marjamäki de29991c11 AST: Rewrite using standard approach 2013-11-04 11:26:16 +01:00
Daniel Marjamki 9959c2866c AST: fixed hang for ',&x..' 2013-11-03 15:05:58 +01:00
Daniel Marjamäki 5f0cfa0ee4 Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0]) 2013-11-02 23:56:10 +01:00
Daniel Marjamäki c505f5ea23 Fixed AST problem for 'if ((a.b&c)==d){}' 2013-11-02 19:18:58 +01:00
Daniel Marjamäki bbdfd8b5c7 Make it possible to create AST, by using the --ast flag 2013-11-02 18:37:35 +01:00
Daniel Marjamäki d3bd373798 Fixed #5131 (False Positive: %u in format string requires 'unsigned int' but the argument type is 'int'.) 2013-10-31 17:20:00 +01:00
Simon Martin d67722ebdf Ticket #5121: Handle comma separated static variable declarations depending on one another 2013-10-30 15:48:00 +01:00
orbitcowboy 097510c4ef Tokenizer:simplifyMathFunctions_fma: added a todo testcase. 2013-10-29 09:26:26 -07:00
orbitcowboy e8fdf4cdd2 Tokenizer:simplifyMathExpressions: added more testcases. 2013-10-24 21:33:00 -07:00
Robert Reif b41ab8a4d5 Fixed #5088 (Token::Match called with varid 0. in libreoffice sd/source/ui/table/TableDesignPane.cxx) 2013-10-14 21:05:54 +02:00
orbitcowboy 9debeab47c Tokenizer:simplifyMathExpressions: fixed false negative patterns for simplification. 2013-10-11 11:58:37 -07:00
Daniel Marjamäki bb0385321f Fixed #5074 (False positive: Duplicate expression (macro)) 2013-10-13 17:42:06 +02:00
Martin Ettl a674ed1aa9 Tokenizer:simplifyMathFunction: added simplifcation for fma[f|l]() functions. 2013-10-13 16:28:02 +02:00
Martin Ettl e18ebf313f Tokenizer:simplifyMathFunctions: added support for more math functions. 2013-10-13 15:41:47 +02:00
Martin Ettl cdb47813d5 Tokenizer:simplifyMathFunctions: added support for cosh[f|l], cos[f|l] and erfc[f|l] functions. 2013-10-13 14:23:10 +02:00
orbitcowboy 6eaa2f2444 Tokenizer:simplifyMathFunctions: added support for acos[f|l] functions. 2013-10-09 07:59:32 -07:00
Martin Ettl f08325284c Tokenizer:simplifyMathFunctions: added support for acosh[f|l]() functions. 2013-10-07 22:10:58 +02:00
orbitcowboy 90b2c5ddce testtokenize: split up large testcases for simplifying math functions. 2013-10-08 07:05:05 -07:00
Robert Reif 6c06cdd24d CheckIO fixes. Ticket: #5051 2013-10-04 17:30:55 +02:00
Martin Ettl a8cf8f0984 Tokenizer:simplifyMathFunctions: fixed false positives when simplifying special pow() cases. 2013-10-03 22:54:45 +02:00
Martin Ettl f8bd33f2bc Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made. 2013-10-03 20:52:07 +02:00
Martin Ettl 548e2f3fbf Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities. 2013-10-03 15:41:12 +02:00
Martin Ettl fa5ee8fd13 Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions. 2013-10-01 20:30:59 +02:00
Martin Ettl f0cbeb5233 simplifyMathFunctions: added support for exp(),sqrt(),cbrt() functions. 2013-09-29 18:11:17 +02:00
Martin Ettl 0527aefb11 Improved simplifyMathFunctions when simplifying special cases of pow(x,y)-function. 2013-09-29 15:11:09 +02:00
Martin Ettl 805d082cd1 Tokenizer:simplifyMathFunction: added support for [ll]div() functions and corresponding unittests. The simplifcation is only performed, if a division by 1 is detected. 2013-09-26 07:01:08 +02:00
Martin Ettl ea5bcfaa35 Fixed #5040 - simplify more math functions. 2013-09-26 00:44:16 +02:00
Martin Ettl d5f514c820 Fixed #5031: simplify labs|fabs|abs(-1) to 1. 2013-09-21 16:59:06 +02:00
Robert Reif 489a3a6e53 Fixed #5015 (strings not being concatinated properly) 2013-09-06 05:36:33 +02:00
Daniel Marjamäki 9000c233fa Fixed #5012 (Hang when there is syntax error 'else }') 2013-09-05 06:38:07 +02:00
Daniel Marjamäki 5d7518aa57 simplifyCalculations: Improved handling of casts (#4899) 2013-09-03 06:27:11 +02:00
Daniel Marjamäki 6819f5ed18 Fixed #4860 (Segfault with another Clucene file) 2013-09-02 05:58:55 +02:00
Robert Reif 05f2f0e419 CheckIO: improved type info - keep track of original typename. 2013-08-31 06:26:39 +02:00
Daniel Marjamäki 3bd1d53c75 Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId) 2013-08-28 19:52:41 +02:00
Daniel Marjamäki acdbbeee44 Fixed #4913 (Tokenizer::simplifyKnownVariables: wrong handling of *--p=0;) 2013-08-25 08:54:33 +02:00
Robert Reif 3c6ca35e09 Fixed #4977 (improve platform type tokenize performance) 2013-08-25 08:29:24 +02:00
Simon Martin b713a69b30 Ticket #4450: Handle comma separated static variable declarations with initializers in brackets. 2013-08-24 22:27:54 +02:00
Simon Martin 5743416d3e Ticket #4959: Simplify {in,de}crements of known variables. 2013-08-16 23:51:00 +02:00
Daniel Marjamäki 538e4bd798 astyle formatting 2013-08-16 18:27:54 +02:00
Simon Martin bf09191b78 Fixed #4708: prefix {in,de}crement too eagerly computed. 2013-08-15 15:53:08 +02:00
Daniel Marjamäki f95b29db06 Improved handling of the __FILE__ macro 2013-08-14 06:36:03 +02:00
Robert Reif d6ce072dc9 Fixed #4950 (Tokenizer: order of int modifiers) 2013-08-12 06:23:01 +02:00
Robert Reif b940d0adc6 Fixed #4947 (Doesn't allow any ordering of int modifiers) 2013-08-09 23:13:04 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki 807204e580 Fixed #4237 (False positive: (error) Memory Leak: data (references and pointer aliases)) 2013-07-30 11:30:14 +02:00
Lucas Manuel Rodriguez cfd697d6d4 Fixed #4042 (False Positive : Same expression on both sides of '&') 2013-07-11 07:13:47 +02:00
Simon Martin e2deb59f8a Improved handling of syntax errors in Tokenizer::simplifyAddBracesPair. 2013-06-29 14:05:49 +02:00
Daniel Marjamäki da9e3b4f01 TestTokenizer: Added test cases for simplifyKnownVariables 2013-06-26 21:47:03 +02:00
Daniel Marjamäki c389e08353 Fixed #4728 (simplify known variables better (%var% & %num%, bitwise and)) 2013-06-26 18:13:28 +02:00
Lucas Manuel Rodriguez d6be4559cd Fixed #4840 (false negative: buffer access out of bounds) 2013-06-25 06:37:51 +02:00
Alexander Mai 5a9975bbdd Fixed #4869 (segmentation fault in Tokenizer::simplifyStructDecl (invalid code)) 2013-06-22 14:05:49 +02:00
Daniel Marjamäki d3d7808a06 Fixed #4834 (FreeType: incorrect array boundary analysis) 2013-06-16 15:41:13 +02:00
Daniel Marjamki 03f28e9c65 Fixed #4668 (Tokenizer: improve handling of 'if (x) MACRO() { ..') 2013-06-15 14:40:05 +02:00
Frank Zingsheim 0943fecf03 Fixed #4799 (Segmentation fault in K&R simplification inside lambda expression) 2013-05-14 20:56:31 +02:00
Frank Zingsheim 511f8a4c1f More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized) 2013-05-12 10:19:43 +02:00
Daniel Marjamäki cbe0a0825c Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm()) 2013-05-09 14:47:18 +02:00
Zachary Blair de8ee5b042 Fixed #4554 (false negative: buffer access out of bounds) 2013-05-02 21:50:48 -07:00
Alexander Mai 957e0790c6 Tokenizer::setVarId: assert that strange code with same type names and variable names work. Ticket: #3990 2013-05-01 18:50:35 +02:00
Daniel Marjamäki 9f8ce6f77f Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name) 2013-04-19 18:36:16 +02:00
Daniel Marjamäki 8d9ad2ae0d TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer (simplifyRoundCurlyParentheses) 2013-04-19 06:42:09 +02:00
Daniel Marjamäki e3be600479 TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer 2013-04-18 16:13:58 +02:00
Daniel Marjamäki a49fc57e00 Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697 2013-04-11 07:19:32 +02:00
XhmikosR 8ac9b8e7a9 remove duplicate ";" and fours dots 2013-04-09 17:49:09 +02:00
PKEuS 188096665c Implemented support for rvalue references (C++11):
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.

Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Daniel Marjamäki 2d70af2c82 Reverted fix. It might be possible to make a better fix 2013-03-25 19:55:35 +01:00
Daniel Marjamäki 2b02013fa7 Fixed #4668 (False positive: uninitialized Variable after unknown macro) 2013-03-25 19:52:33 +01:00
Daniel Marjamäki 1b18bfc93c Fixed #3585 (errors not recognized when class has extra specification) 2013-03-18 19:09:04 +01:00
Daniel Marjamäki 369e80b021 Fixed #4465 (syntax error on valid C++ source file) 2013-03-14 18:52:22 +01:00
Frank Zingsheim e91e7148de Test case for #4644 (Tokenizer: Wrong varId after typename):
Added equivalent test with "class"
2013-03-12 19:50:24 +01:00
PKEuS 796c3e101f Implemented better fix for #4644 2013-03-12 08:05:03 -07:00
PKEuS 14feaa8d39 Refactorizations:
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -07:00
PKEuS b3a9ac5c3b Fixed #4644: Don't assign varid to template parameter when 'typename' is used 2013-03-10 06:11:25 -07:00
Daniel Marjamäki 1f40af2ae2 Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining)) 2013-03-09 17:55:49 +01:00
PKEuS 99a73fe1d3 Don't assign a varid to a variadic function 2013-03-05 08:32:52 -08:00
PKEuS 75799446aa Added unit test for #4619 2013-03-01 04:06:51 -08:00
Daniel Marjamäki 94da3bd57f Fixed #4617 (False positive (style): noexcept for constructors) 2013-02-28 06:38:57 +01:00
Daniel Marjamäki 71b66209b7 Fixed #4300 (segmentation fault of cppcheck (invalid code)) 2013-02-20 06:58:27 +01:00
Alexander Mai 34c3697750 Added unit test for #4525 2013-02-19 21:56:13 +01:00
Daniel Marjamki 2a660fa3b4 Tokenizer: Fixed removeCast bug. Don't simplify (A)&b to A&b if A might be a type. Related with ticket: #4439 2013-02-16 16:58:36 +01:00
Daniel Marjamki 635b7d5a0e Fixed #4423 (Variable is assigned a value that is never used.) 2013-02-16 16:07:05 +01:00
Robert Reif c5ee083c82 Fixed #4388 (false positive 'noConstructor' in 1.57) 2013-02-15 06:44:07 +01:00
Daniel Marjamäki 1e550f9fdf Reverted fix for #4547: It causes fp. See #4573 2013-02-12 16:13:08 +01:00
Ettl Martin c192e4d669 spellfixes 2013-02-12 15:21:27 +01:00
Andrew C. Martin bd0d9b9639 fix misspellings & gcc v3.4.6 warnings
1.  fix typos / misspellings
 - Fix misspelling within comments, variable/function names, stdout messages
 - changes the name of an error code: ```stlBoundries``` changed to ```stlBoundaries```.  Alias old name (```stlBoundries```) to the new one.

2.  fix gcc v3.4.6 32bit & 64bit warnings

 - fixes gcc v3.4.6 warnings, except for those in tinyxml and "-Wmissing-declarations" makefile warnings
 - in Preprocessor::handleIncludes(), replace a ```vector <bool>``` with ```stack<bool>``` (see ```vector<bool>``` warning below).
   - this is the only ```vector<bool>``` in the codebase
 - ```vector <bool>``` is actually a case of template specialization, and is not recommended, according to the following links:

http://stackoverflow.com/q/6461487
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html
http://stackoverflow.com/q/670308

 - in the codebase before and after this change, testrunner SEGVs in a number of places on gcc v3.4.6, including ```Check::~Check()```, among others
   - fc42fc95 fixes this particular runtime issue for DJGPP & __sun
2013-02-09 23:43:09 -07:00
Daniel Marjamäki 463121be71 Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile) 2013-02-07 17:03:08 +01:00
Frank Zingsheim 5144307642 Raise syntax error for if-condition without parentheses according to #2518 #4171 2013-02-05 21:13:57 +01:00
Frank Zingsheim b531195e08 Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
Change tokenizer: "else if" -->> "else { if"
2013-02-04 21:12:12 +01:00
Frank Zingsheim 89560564ed Refactoring: Add braces to an if-block, for-block, etc. in tokenizer.
Fixed #4521 (Tokenizer: Wrong braces for triple if else)
2013-02-02 16:01:34 +01:00
Daniel Marjamäki 4391f0880f Tokenizer: Add special tokenize method for the Preprocessor with only basic simplifications 2013-01-27 17:58:54 +01:00
Erik Lax c2608108dd Fixed #3928 (Tokenizer: Wrong simplification of inner if-else 'if (a) while (b) if (c) x; else y;') 2013-01-24 16:53:20 +01:00
Erik Lax 444f80c4bb Fixed #4505 2013-01-22 13:49:54 +01:00
Daniel Marjamäki 67c9720299 Tokenizer: fixed simplification of static constants 2013-01-19 21:14:15 +01:00
Daniel Marjamki bff6ed7af0 Fixed #3500 (false negative: (error) Returning pointer to local array variable) 2013-01-19 13:39:23 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Daniel Marjamäki 2e56928834 Fixed #4482 (add test for UB due to usage of NULL in variadic functions) 2013-01-13 12:02:10 +01:00
Daniel Marjamäki eebfea2b23 Fixed #4381 (Inline type declaration on statics causes warning) 2013-01-07 19:20:15 +01:00
Edoardo Prezioso 4c73c29cdd Revert partially the previous commit:
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso 1c0c0471df Simplify some generalized math formulas:
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso 5485e6866f Fixed wrong tokenization of some math formulas:
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Daniel Marjamäki a3ee72a51d Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code)) 2013-01-03 19:14:44 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki 4378357d7e Fixed #4372 (Tokenizer misidentifying which function a variable belongs to) 2012-12-29 21:07:41 +01:00
Daniel Marjamäki 4d085dd3fd Fixed #4316 (False positive: (constStatement) Redundant code) 2012-12-29 17:13:06 +01:00
Daniel Marjamäki 9af51a75e6 Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444' 2012-12-29 08:54:39 +01:00
Daniel Marjamäki bf9b900c30 Tokenizer::setVarId: Fixed problem with initializer lists (#4436) 2012-12-27 18:15:00 +01:00
Robert Reif 3e6d601982 Fixed #4436 (FP: Member variable is not initialized in the constructor. (with two parameters)) 2012-12-27 17:15:38 +01:00
Simon Kagstrom ef28bde3e4 Fixed #4408 (Force inclusion of files (a la -include /.../ in GCC)) 2012-12-27 16:52:31 +01:00
Daniel Marjamäki b3301a9ef9 Fixed #4433 (Wrong array size for string with \0) 2012-12-26 12:10:09 +01:00
Daniel Marjamäki 56b7670468 Tokenizer::setVarId: Fixed problem in initializer list when parameter and class member has same name 2012-12-23 19:55:09 +01:00
Robert Reif dae232015e Fixed #4430 (FP: Member variable is not initialized in the constructor.) 2012-12-23 08:04:44 +01:00
Daniel Marjamäki 8e1e894dff AST: Added some tests to ensure operator precedence is handled properly 2012-12-16 11:56:23 +01:00
Daniel Marjamäki bca7927913 AST: generate tree from bottom and upwards 2012-12-16 11:48:19 +01:00
Daniel Marjamäki aad3a041ad AST: Handle function calls 2012-12-16 10:06:55 +01:00
Daniel Marjamäki 1ad9c933ec AST: Improved handling of unary operators 2012-12-16 08:41:04 +01:00
Daniel Marjamäki fa8e5cd7d8 AST: Simple AST. Not used in the clients. Only part of the testing for now. 2012-12-15 20:21:09 +01:00
Daniel Marjamäki df03e3a8d2 Fixed #4395 (Wrong simplification of known variables in nested assignment) 2012-12-10 06:08:33 +01:00
PKEuS 4737966caf Unit test cleanup: Removed some empty lines and whitespaces before \n. 2012-12-06 10:19:22 -08:00
Daniel Marjamäki c91250cd6e Fixed #4277 (duplicateExpression finds false positive for floats in a union as a member of a class) 2012-12-03 17:05:37 +01:00
Daniel Marjamäki 672831f41a Fixed #4187 (False positive: Variable inside a lambda is reported as uninitialized) 2012-11-30 10:30:26 +01:00
Daniel Marjamäki 3372657a07 Fixed #4227 (False positive: Comparison of a boolean with an integer (double dResult=false)) 2012-11-29 09:29:25 +01:00
Daniel Marjamäki 509721d6d0 Fixed #4304 (False positive during an array declaration) 2012-11-29 08:44:12 +01:00
Daniel Marjamäki 5d1b4e6dbb Tokenizer: Remove redundant '+' 2012-11-28 07:09:56 +01:00
Edoardo Prezioso f3029ce6bb Fixed a bug in Tokenizer::simplifyKnownVariables.
When we find constant variables, check if there's a usage of its reference in the code (for example: don't simplify 'f(&x)' to 'f(&100)').
2012-11-26 17:06:52 +01:00
Edoardo Prezioso 5fb2115e9d Fixed a bug in Tokenizer::concatenateNegativeNumber.
The first negative number inside a '{}' list was not simplified correctly.
2012-11-20 19:14:58 +01:00
PKEuS e5ebb49312 Added support for sizeof(wchar_t). Improved <Windows.h> type testing for Win64 platform. 2012-11-11 16:16:17 +01:00
PKEuS 5555e055f1 Refactorized <Windows.h> type support:
- Changed some more Win32 simplifications of wide-character/string types to use wchar_t
- Added support for LPWSTR
- Fixed test case to ensure that simplifications also work for Win32W
2012-11-11 15:40:06 +01:00
PKEuS b15ff0c0e3 Fixed unit test failures caused by previous commit 2012-11-11 15:16:08 +01:00
Edoardo Prezioso 1d4cacb3f1 Add more testcases for simplifyPlatformTypes:
these should cover up some unused branches.
2012-11-05 00:35:34 +01:00
Edoardo Prezioso 960dad0c21 Related to commit 71150e987ddf935237578aec3a4c6e02247882c2:
indent-separate test cases of the same kind.
2012-11-05 00:33:02 +01:00
Edoardo Prezioso 4d38dd4f2c Add testcase for Tokenizer::simplifyVarDecl.
A branch was not executed in coverity, but there was a testcase which needed it.
2012-11-04 23:49:23 +01:00
Edoardo Prezioso 24bf6f99e1 More simplifyRedundantParenthesis changes:
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
PKEuS e44ee280bc Fixed handling of pointers to functions in namespace as template parameters (#4172) 2012-11-04 11:15:03 +01:00
PKEuS 9cb9388e49 Fixed handling of pointers in templates (#4319) 2012-11-04 10:49:25 +01:00
PKEuS 1c399c86ca Improved fix for #4311; Added back support for "this." (fixes again #4291)
Added TODO unit test for missing varid.
2012-11-03 21:16:05 +01:00
Daniel Marjamäki 6c2563c467 Fixed #4311 (False positive: warning (selfAssignment): Redundant assignment of 'm_bar' to itself. 2012-11-03 13:18:43 +01:00
Edoardo Prezioso f0f216390e Fixed #4276 (segmentation fault of cppcheck (invalid code)) 2012-10-20 21:40:51 +02:00
Edoardo Prezioso 4ddcde1e6f CheckMemoryLeak: add '?1:0' to clarify the value of the argument to 'deleteNext'; Tokenize.cpp: in simplifyCompoundAssignment(), remove ':' odd code used to fix a weird test case ('case' code not inside a function body), remove useless 'tok->next() != NULL' check (already true by previous condition); in simplifyConditionOperator(), handle better the parenthesis skipping code and remove useless ')'check; in simplifyQuestionMark(), remove useless 'tok->tokAt(-2)' check (Token::Match returns false if the token is NULL), add more patterns to Token::Match to handle more test cases; in simplifyBitFields(), add 'const' to 'offset' bool. RedirectOutputError: style nitpick change to declaration of a pointer. 2012-10-19 14:19:52 +02:00
Baris Demiray d84d360afc Fixed #4291 (Variable ID is not set when variable is accessed through 'this') 2012-10-19 06:18:13 +02:00
Edoardo Prezioso 61365ea0e5 Fixed #4293 (FP: Variable is not simplified, causing a false positive). 2012-10-17 00:25:20 +02:00
Daniel Marjamäki 562291477d Fixed #4226 (False positive: Uninitialized variable (problem with namespace ::rtl)) 2012-10-15 06:53:38 +02:00
Edoardo Prezioso 64b4960acc Tokenizer: simplify GCC '({ %var%|%num% ; })' to '%var%|%num%'.
Remove useless brace around condition in simplifyFlowControl.
2012-10-13 13:24:41 +02:00
Edoardo Prezioso 1951d1cdc5 Tokenizer: improve the new 'skipTernaryOp' function by supporting GCC '{(var|num;)}' statement expression extension; improve 'Tokenizer::simplifyQuestionMark' by supporting simplification with 'case' before ternary operation, using skipTernaryOp to get colon and, most importantly, supporting indented '?:' operations. 2012-10-13 02:32:43 +02:00
Edoardo Prezioso d4a3c1617a Fixed: Tokenizer::simplifyLabelCaseDefault was careless with '?:' operator near 'case' adding the semicolon after the ternary colon. 2012-10-12 20:51:13 +02:00
Edoardo Prezioso c42facae1f Tokenizer::simplifyLabelsCaseDefault: jump '(' and '[' parenthesis.
TestTokenizer: add simple test cases with some correct and wrong syntax concerning 'case'.
2012-10-12 17:08:21 +02:00
Edoardo Prezioso e62e03ab31 Fixed #4267 (segmentation fault of cppcheck (invalid code)). 2012-10-09 20:44:30 +02:00
Ettl Martin 2cf75d5339 astyle run 2012-10-08 21:50:21 +02:00
Ettl Martin 0879bb5825 #4245: Segmentation fault (invalid code); Applied patch from amai. 2012-10-08 21:49:25 +02:00
Daniel Marjamäki 6a37942431 Fixed #3935 (False report for accessing array out of bounds after casting to short) 2012-10-07 18:38:05 +02:00
Daniel Marjamäki 4c1abde48e Reverted 107b3b44. Write syntax error for 'if MACRO()'. We can't know if MACRO() is supposed to be used in the condition or if it is some annotation that should be removed. Ticket #4171 2012-10-06 19:12:39 +02:00
Edoardo Prezioso e3bbcf501f Fixed #4234 (segmentation fault of cppcheck in Tokenizer::simplifyFlowControl() (invalid code)) 2012-10-06 13:37:44 +02:00
Daniel Marjamäki 2f069f550f Removed Java/C# handling 2012-10-02 18:44:36 +02:00
Alexander Mai 074b7781b2 Fixed #4239 (segmentation fault of cppcheck (invalid code)) 2012-09-27 06:35:36 +02:00
Daniel Marjamäki 2e3a7db4eb Fixed #4115 (Incorrect uninitialized variable error message with realloc macro) 2012-09-22 18:41:33 +02:00
Edoardo Prezioso 406483b618 Fixed valgrind error in #3953 , but there's still the bad enum problem. 2012-09-20 21:07:37 +02:00
Daniel Marjamäki c3cb6202ed Fixed #4172 (TemplateSimplifier: Handle 'A<&f> x' template instantiation) 2012-09-19 16:10:13 +02:00
Ettl Martin 3f89e38275 fixed #4195 segmentation fault of cppcheck (invalid code); Added a testcase 2012-09-19 10:37:30 +02:00
Daniel Marjamäki 1f7d9ca22c Fixed #4211 (Tokenizer::simplifyVarDecl: Improved handling of >> in templates) 2012-09-17 19:45:42 +02:00
XhmikosR 3c14e4b52a test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-17 13:51:40 +02:00
Daniel Marjamäki f1ebd99dc2 Fixed #3507 (false positive: comma-separated statements before return in methods) 2012-09-15 11:55:08 +02:00
Daniel Marjamäki 9f2e1ab98d Fixed #4048 (Tokenizer::simplifyVarDecl: Improve handling of 'a::b const * p = 0;') 2012-09-14 16:46:45 +02:00
Daniel Marjamäki 19fdbf0fd0 Fixed #4185 (Incorrect 'Found duplicate if expressions' for strings with high bit set) 2012-09-13 16:44:10 +02:00
PKEuS ce9f6bdb56 Fixed segfault #4182 2012-09-10 17:33:52 +02:00
PKEuS d44f10fc01 Fixed createLinks2() on this code: nvwa<(x > y)> 2012-09-09 15:31:23 +02:00
Daniel Marjamäki 107b3b4401 Fixed #4171 (don't choke when parentheses are missing from macros) 2012-09-09 09:48:07 +02:00
Daniel Marjamäki a39b58046f Tokenizer: Improved simplification of 'a?(1):b' 2012-09-08 10:45:00 +02:00