Commit Graph

995 Commits

Author SHA1 Message Date
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