IOBYTE
48c960f56c
template simplifier: better detection of template functions ( #1539 )
...
* template simplifier: better detection of template functions
* fix comment
2018-12-22 10:05:10 +01:00
IOBYTE
c31331d085
template simplifier: fix explicit instantiation with types starting with const and ending in * and &. ( #1530 )
2018-12-19 21:59:59 +01:00
PKEuS
34874dd94f
Optimization: Removed unnecessary calls to simplifyPath(). The Caller should do this, and our callers (mainly the test suite) more or less do so, as they all supply just dummy paths ("test.cpp")
2018-12-18 20:33:45 +01:00
IOBYTE
1cba78090c
Fix const anonymous struct. ( #1527 )
2018-12-18 08:15:12 +01:00
Daniel Marjamäki
f26549e5ab
Fixed #8896 (Tokenizer: Anonymous struct)
2018-12-15 08:42:35 +01:00
IOBYTE
0f83aff3b8
Improve trailing return type support. ( #1520 )
...
* Improve trailing return type support.
* Partial fix for #8889 (varid on function when using trailing return type)
* Handle operators in templates.
2018-12-13 06:34:10 +01:00
Daniel Marjamäki
bd0a935d8a
Tokenizer: Improved handling of compiler extensions that use @ (see https://sourceforge.net/p/cppcheck/discussion/general/thread/8f618cb0a3 )
2018-12-04 19:33:39 +01:00
Daniel Marjamäki
49413b7d4c
Tokenizer: Add simplifyAt to handle some nonstandard code with @
2018-12-04 16:52:41 +01:00
Daniel Marjamäki
8087cfed5d
Fixed #8627 (Tokenizer::setVarIdPass2: constructor parameter)
2018-12-02 09:28:05 +01:00
Daniel Marjamäki
96929c53c0
Fixed #8873 (Add syntaxError when there is no RHS for +-)
2018-12-01 17:29:41 +01:00
Colomban Wendling
cad4e4ab20
Fix handling of `sizeof &var` ( #1498 )
...
Fixes https://trac.cppcheck.net/ticket/8870
2018-11-30 13:53:58 +01:00
Daniel Marjamäki
9ef3c79bc6
Fixed #8851 (Crash in valueFlowContainerForward (daca@home: pbbam))
2018-11-18 20:18:55 +01:00
Daniel Marjamäki
69f2e0938a
VarId: Improved varids for struct members ( #8844 )
2018-11-14 19:11:35 +01:00
Daniel Marjamäki
152be6df63
Report 'unknown macro' as information message with id unknownMacro
2018-11-13 20:14:56 +01:00
Daniel Marjamäki
a50eb56d8d
Extend 'Unknown macro' check
2018-11-13 18:30:40 +01:00
Daniel Marjamäki
e6a5e0f752
Warn when there is a unknown macro
2018-11-13 16:49:15 +01:00
Daniel Marjamäki
93cde415a7
Fixed #7988 (variable in condition gets wrong varid)
2018-11-11 07:50:25 +01:00
Daniel Marjamäki
148f257c6b
Fixed #8838 (False positive on overridden virtual function that is marked both const and final)
2018-11-10 21:57:50 +01:00
Daniel Marjamäki
f8b0584f6a
replace 'constexpr' with 'const'
2018-11-03 19:22:51 +01:00
Daniel Marjamäki
6138294e3d
Fixed #8818 (AST broken: restrict)
2018-11-03 11:05:38 +01:00
Daniel Marjamäki
9741239b2f
Fixed #8824 (False positive: uninitialized variable (regression))
2018-11-03 10:31:55 +01:00
Daniel Marjamäki
a4afcb5995
Revert "Fixed #8818 (AST broken: restrict)"
...
This reverts commit e7d61f399a
.
2018-11-02 21:07:37 +01:00
Daniel Marjamäki
0cc4555337
Revert "Tokenizer: Do not remove 'constexpr'"
...
This reverts commit 2f400b40ba
.
2018-11-02 21:07:24 +01:00
Daniel Marjamäki
2f400b40ba
Tokenizer: Do not remove 'constexpr'
2018-11-02 20:32:12 +01:00
Daniel Marjamäki
e7d61f399a
Fixed #8818 (AST broken: restrict)
2018-11-02 20:28:49 +01:00
Paul Fultz II
2b6cc33dc6
Fix issue 8757: Throw syntax error on invalid code ( #1378 )
...
* Fix issue 8757: Throw syntax error on invalid code
* Fix FP with lambda returns
* Remove double percent
* Check more keywords
* Skip preprocessor directives
* Check for valid PP directive
* Fix preprocessor check
* Dont check for preprocessor directives
2018-10-28 17:17:53 +01:00
Daniel Marjamäki
c483bcb12b
Fixed testrunner
2018-10-22 00:28:09 +02:00
Daniel Marjamäki
f9b132e831
Tokenizer::simplifyTypedef: Fix bug with arrays
2018-10-21 21:15:34 +02:00
Daniel Marjamäki
14afc3fd3a
Fixed #8796 (Tokenizer::simplifyCompoundAssignment: Wrong simplification of return)
2018-10-20 21:33:43 +02:00
Daniel Marjamäki
29feaa5a51
Tokenizer: Avoid constant folding
2018-10-20 10:51:50 +02:00
Paul Fultz II
9cf092657c
Skip some ast errors to avoid regressions ( #1422 )
...
* Skip some ast errors to avoid regressions
* Use simpleMatch
* Skip operator functions
* Add a test for issue 8788
2018-10-13 18:38:44 +02:00
Daniel Marjamäki
7eb5ebe17e
Fixed #7887 (User function 'search' is wrongly mixed with std function)
2018-10-10 17:35:53 +02:00
Daniel Marjamäki
25cbfe27cf
Partial fix for #7887 , Improved tokenizer simplification of 'using namespace std;' - do not simplify user functions
2018-10-10 14:28:53 +02:00
Daniel Marjamäki
c3e6e7c338
Fixed #8664 (setVarId: Wrongly set varid for lambda argument)
2018-10-07 20:40:59 +02:00
orbitcowboy
d08b39c915
Improved const correctness of local variables. There are no functional changes intended. ( #1392 )
2018-09-23 20:24:51 +02:00
Simon Martin
6bde2445a6
Ticket #8632 : Parenthesize ternary operator operands containing < to avoid wrongly thinking a template instantiation is met. ( #1389 )
2018-09-23 10:27:38 +02:00
Daniel Marjamäki
523a9c1c4a
Fixed #8746 (Syntax error, AST broken (using a::operator=))
2018-09-09 21:11:45 +02:00
Daniel Marjamäki
1bb1c4cc8e
Use early continue
2018-09-09 20:58:30 +02:00
Daniel Marjamäki
404eb6c746
Fixed #8745 (Syntax error: AST broken (or))
2018-09-09 16:41:06 +02:00
Simon Martin
1d85a78874
Ticket #8654 : Properly setup links for variadic template bases. ( #1357 )
2018-09-05 14:10:56 +02:00
Daniel Marjamäki
5afb755a3c
SymbolDatabase: Fix variable matching
2018-09-04 06:39:02 +02:00
IOBYTE
508e8c234b
Fixed #8683 (Using deleted token with multiple template instantiations.) ( #1353 )
...
* Fixed #8683 (Using deleted token with multiple template instantiations.)
* Fixed #8321 (heap use after free: templatesimplifier)
* Add a flag to Token indicating that it has a pointer to it.
* Run dmake
* Fix one source of list pointers to deleted tokens.
Refactor TemplateSimplifier class to get access to template lists.
Remove many function parameters now that they are class variables.
Fix one source of list pointers to deleted tokens.
Add tests with no output to catch crashes.
* Run dmake again.
* Make 2 more functions private.
* Make requested changes.
* Missed one change request.
* Use TokenList rather than Tokenizer.
* Move TokenAndName constructor to cpp file so token.h is not needed in header file.
2018-09-01 11:26:10 +02:00
Simon Martin
acb0b9f07e
Ticket #8679 : Add support for C++11 thread_local and GCC's (among others) __thread extension. ( #1351 )
2018-08-26 19:46:36 +02:00
Daniel Marjamäki
e442bc47b1
astyle formatting
...
[ci skip]
2018-08-17 19:55:21 +02:00
tam do thanh
f33c09f1a7
Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" ( #1334 )
...
* Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" for some old libraries
https://trac.cppcheck.net/ticket/7792
* Unnecessary check of "tokOffset", match-function already checks if it is null
* add testcase ticket #7792 : simplifyTypedef124
2018-08-16 14:30:28 +02:00
Daniel Marjamäki
ddbe4b89b5
Renamed --debug to --debug-simplified
2018-08-05 11:19:20 +02:00
Daniel Marjamäki
60485df762
Refactoring; Use range for loops
2018-07-14 22:49:31 +02:00
Daniel Marjamäki
13cf93a322
Rename private variable maxtime
2018-06-18 09:49:00 +02:00
Daniel Marjamäki
66785c238a
Renamed _timerResults
2018-06-16 22:14:59 +02:00
Daniel Marjamäki
63e6d35cb6
Renamed _unnamedCount to mUnnamedCount
2018-06-16 22:09:18 +02:00
Daniel Marjamäki
ef534c2d0d
Renamed _codeWithTemplates
2018-06-16 22:03:04 +02:00
Daniel Marjamäki
5dc29a9a16
Renamed _configuration to mConfiguration
2018-06-16 21:57:48 +02:00
Daniel Marjamäki
598a984071
Renamed _typeSize to mTypeSize
2018-06-16 21:56:05 +02:00
Daniel Marjamäki
5e43366126
Rename members
2018-06-16 21:52:29 +02:00
Daniel Marjamäki
78974e9267
Rename _type to mType
2018-06-16 20:25:54 +02:00
Daniel Marjamäki
8e2b18a75a
Rename _varId to mVarId
2018-06-16 16:38:50 +02:00
Daniel Marjamäki
d81fe83ca6
renamed _symbolDatabase to mSymbolDatabase
2018-06-16 16:25:27 +02:00
Daniel Marjamäki
79ffe1d4fc
Rename _tokenizer, _settings, _errorLogger
2018-06-16 16:10:28 +02:00
Daniel Marjamäki
7163210f72
Fixed #8605 (Segmentation fault below TemplateSimplifier::simplifyCalculations)
2018-06-01 23:03:53 +02:00
IOBYTE
3982c81394
Add support for C++ attribute nodiscard for functions. ( #1269 )
2018-05-29 21:43:56 +02:00
Daniel Marjamäki
14e60210c9
Optimize Tokenizer::setVarIdPass1
2018-05-29 18:41:05 +02:00
Daniel Marjamäki
02c8a1d61c
Tokenizer::setVarIdPass1 optimization
2018-05-28 11:32:47 +02:00
rebnridgway
42a65c5160
Fix crash bug #8579 ( #1238 )
...
* Added declaration for deletePrevious function
* Added definition for deletePrevious function
* Fixed crash from deleteThis invalidating pointers
The crash was caused by deleteThis() invalidating the pointer to a constant variable usage. This happened when a usage followed an assignment. This fixes bug #8579 .
* Added tokensFront to match tokensBack
This means deletePrevious can set the list's front if necessary.
* Initialised tokensFront in appropriate places
* Switched to using default Token constructor
* Switched to using Token default constructor
* Switched to using default constructor for Token
* Added missing argument to Token constructor
* Changed to use default constructor for Tokens
* Switched to using default constructor for Tokens
* Switched to using default constructor for Token
* Added new test for deleting front Token
Also made sure to use the correct constructor for Token in other tests.
* Syntax error
* Replaced tokensFront and tokensBack with a struct
This decreases the size of the Token class for performance purposes.
* Replaced tokensFront and tokensBack with a struct
* Added tokensFrontBack to destructor
* Reworked to use TokensBackFront struct
Also ran astyle.
* Reworked to use TokenList's TokensFrontBack member
* Reworked to use TokensFrontBack struct
* Reworked to use TokensFrontBack struct
* Reworked to work with TokensFrontBack struct
* Removed unnecessary scope operator
* Added missing parentheses
* Fixed syntax error
* Removed unnecessary constructor
* Default constructor now 0-initialises everything
This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.
* Fixed unsafe null check
* Added missing explicit keyword
* Fixing stylistic nits
Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.
* Fixing stylistic nits
Removed default constructor and replaced it with a single-argument constructor with a default value.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
IOBYTE
fc1d62fd45
Fixed #7406 (Tokenizer::simplifyTypedef: array typedef used as template parameter) ( #1257 )
2018-05-22 17:31:58 +02:00
PKEuS
e8bc955023
Optimized Tokenizer::simplifyFunctionReturn(): Replaced nested loops by two consecutive loops; execute second one only if necessary.
2018-05-14 20:51:09 +02:00
PKEuS
513cdc144c
Optimization: Save up to 2 of 3 token list iterations in Tokenizer::simplifyKeyword()
2018-05-13 10:12:50 +02:00
IOBYTE
9ee6068e20
Remove duplicate namespace aliases so they don't produce syntax errors. ( #1222 )
...
* Remove duplicate namespace aliases so they don't produce syntax errors.
DACA2 results showed new SymbolDatabase syntax errors when duplicate
namespace aliases were simplified improperly. The solution is to remove
them in the tokenizer when found.
* Add tests for deleting namespace aliases at end of token list.
* Use eraseTokens to delete multiple tokens at once.
2018-05-13 08:29:40 +02:00
PKEuS
723bacbf09
Fixed hang introduced in previous commit and further optimized Tokenizer::simplifyStaticConst(): Avoid redundant Token swapping
2018-05-12 21:35:54 +02:00
PKEuS
a16e99c710
Optimization: Save 2 of 3 token list iterations in Tokenizer::simplifyStaticConst()
2018-05-12 19:19:48 +02:00
Simon Martin
16e1e1d8f9
Ticket #8550 : Properly simplify "typedef class A B;". ( #1224 )
2018-05-12 10:20:33 +02:00
Daniel Marjamäki
a3f1d28fa5
astyle formatting
...
[ci skip]
2018-05-11 21:25:41 +02:00
rebnridgway
cf6e72b150
Optimised simplifyKnownVariables ( #1205 )
...
* Optimised simplifyKnownVariables
Changed the check for references to constant variables so instead of iterating through all tokens looking for references (which is very slow for large files), usages of each known variable are recorded so each usage can be checked for whether or not it is a reference. Just checking known usages is a lot quicker than checking through all tokens.
* Fixed test error caused by incorrect code
* Fixes to constant variable simplification optimisation
Indexing variables by varId is easier than by Token pointer, but means we also have to store a reference to the constant variable Token in another collection.
Switched to using unordered_map over map as it has slightly better find performance.
* Fixed incorrect simplification behaviour
This should remove constant variables correctly and efficiently. Requires additional functions, Token::deleteThisInPlace() and TokenList::front(Token*).
* Added setter for TokenList::first
This allows code that adds and removes Tokens from the list to do so without copying nodes into other nodes, which sometimes create difficulties.
* Added deleteThisInPlace function
This allows a token to delete itself without invalidating pointers to the node after it. If this token is the first or last in a list the calling code will have to remember to change the list's front or back.
* Added declaration for deleteThisInPlace()
* Removed premature MatchCompiler optimisation
* Added and removed some functions
Added declaration for deleteToken(Token*) which deletes a single token from the list
Removed public front(Token*) because it broke encapsulation
* Implemented deleteToken(Token*) function
* Removed 'delete this' from deleteThisInPlace
* Switched to using safer function
TokenList::deleteToken is better than calling straight into Token::deleteThisInPlace because it doesn't call delete this and doesn't break the TokenList's encapsulation.
* Replace constant variables in reverse order
This fixes the problem where you have two constant value assignment statements in a row. Replacing and deleting them in reverse order means we avoid the problem of deleteThis() potentially invalidating the pointer to the start of the next assignment statement
* Removed unneeded and unsafe deleteThisInPlace
* Removed unneeded and unsafe deleteThisInPlace
* Removed unneeded deleteToken
* Removed unneeded deleteToken
* Removed extra whitespace
2018-05-11 21:14:04 +02:00
IOBYTE
184537884f
Don't remove the volatile keyword so we can properly overload functions. ( #1218 )
...
* Don't remove the volatile keyword so we can properly overload functions.
I fixed all the checks that had tests that use volatile. There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.
* Fix unused private function warning.
2018-05-10 07:40:01 +02:00
Daniel Marjamäki
ecccce0608
Tokenizer::setVarId: Made it ~5% faster
2018-05-09 10:25:29 +02:00
IOBYTE
8b0b659965
Add support for namespace aliases and C++17 nested namespaces. ( #1210 )
...
* Add support for namespace aliases and C++17 nested namespaces.
These are implemented as tokenizer simplifications so changes are not
needed to the tokenizer and symbol database.
* Fix codacy warning.
2018-05-08 06:35:51 +02:00
Daniel Marjamäki
59cc479855
Save bitfield bit counts
2018-05-02 20:55:11 +02:00
Daniel Marjamäki
45c4456c24
Tokenizer: Code cleanup
2018-04-29 15:05:13 +02:00
Daniel Marjamäki
ca8e19c96d
SymbolDatabase: Refactor SymbolDatabase: variable list
2018-04-28 09:38:33 +02:00
Daniel Marjamäki
f336c2efe7
Refactoring; Renamed Scope::classStart and Scope::classEnd
2018-04-27 22:36:30 +02:00
Daniel Marjamäki
e6a37ec0b7
Fixed #8531 (false positive: (style) The function 'foo' overrides a function in a base class but is not marked with a 'override' specifier.)
2018-04-27 21:49:18 +02:00
Daniel Marjamäki
25599a76a7
Handle 'final' specifier better.
2018-04-27 14:57:43 +02:00
Daniel Marjamäki
8304290f06
astyle formatting
...
[ci skip]
2018-04-27 10:29:27 +02:00
Simon Martin
9fade65dbb
Ticket #8281 , #8417 : Properly detect the end of "switch" statements to accept all legitimate uses of "case". ( #1112 )
2018-04-26 22:26:26 +02:00
Daniel Marjamäki
6d86ad78ba
Refactoring, use early continue
2018-04-23 16:23:22 +02:00
rikardfalkeborn
57019c0128
Fix comment in Tokenizer::simplifyMathFunctions ( #1179 )
...
In 9cea2d6df
, simplifications were removed for a number of functions
which should instead be handled with configurations. The commit did
however not update the description of the function, do this now.
Also sin() and sinh() and their float and long double versions were
missing from the comment so add these as well.
2018-04-19 06:14:16 +02:00
Daniel Marjamäki
e95ff8c7b6
Avoiding emplace
2018-04-14 19:24:35 +02:00
Sebastian
c39a3e3f1c
windows string macros: Handle _T, _TEXT and TEXT internally, add tests ( #1163 )
...
Remove TEXT() macro from windows.cfg and handle it internally where it
can be correctly simplified (Ansi vs. Unicode).
Also add handling of _TEXT() macro which is just a synonym for _T().
Add tests to verify correct function and macro simplification.
2018-04-12 08:52:31 +02:00
PKEuS
d2146844dd
Refactorizations:
...
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
PKEuS
17b4721bd2
C++17: Support "if constexpr" (by simplifying it to plain if() statement)
...
This might lead to complaints about constant expressions as if() statement, but should fix syntax errors.
2018-04-09 11:42:59 +02:00
PKEuS
e2002db78d
Replaced make_container by C++11 initializer lists
2018-04-08 23:03:44 +02:00
IOBYTE
90983303f0
Fix #8477 (False positive caused by anonymous enum in method body) ( #1154 )
2018-04-08 08:00:12 +02:00
jrp2014
214322d501
Refactor lib/tokenize
2018-04-05 08:02:59 +02:00
jrp2014
b6504c70ca
Improve constness
2018-04-04 21:51:31 +02:00
Daniel Marjamäki
c0272fc2ef
Fixed #8259 (Don't combine &= for anonymous reference parameters)
2018-04-01 10:27:16 +02:00
Daniel Marjamäki
5a444f764b
Fixed one more syntax error FP related to #8390
2018-03-22 15:20:37 +01:00
Daniel Marjamäki
3d4b773fd1
Fixed #8390 (Syntax error from an MSVC internal header)
2018-03-22 09:07:58 +01:00
Daniel Marjamäki
2c3cd402ba
Thread safety: changed local static variable 'count' to member variable
2018-03-14 09:41:27 +01:00
Daniel Marjamäki
5c44580528
Refactoring, use early continue and make code a bit more specific.
2018-02-16 22:59:38 +01:00
IOBYTE
fcde1d80e9
Fix #8382 (Syntax error when scanning code with template and attribute) ( #1089 )
...
* Fix #8382 (Syntax error when scanning code with template and attribute)
This commit only addresses #8382 . There are issues concerning which
versions of C++ should be supported and also generic C++ 14 attribute
support which can be revisited later.
* Remove all C++ style attributes.
Remove all C++ style attributes when C++ version is 11 or greater.
Rename simplify function to simplifyCPPAttributes.
Handle more cases of roreturn function attribute.
2018-02-16 22:25:51 +01:00
Lauri Nurmi
e0e664f996
Fix permissions of certain non-executable files ( #1083 )
...
mode 0755 => 0644
2018-02-09 19:46:38 +01:00
Daniel Marjamäki
13daaac264
astyle formatting
...
[ci skip]
2018-02-06 08:10:28 +01:00
Alexander Mai
68eb6c4e6f
Refactoring: Add Tokenizer::findGarbageCode to time report. The method now calls syntaxError instead of returning an invalid token
2018-02-05 21:47:33 +01:00
Matthias Krüger
f009cfc845
fix some typos found by codespell.
2018-02-04 20:53:43 +01:00
Jørgen Kvalsvik
a61f21d1b6
Accept nested templates in tokenizer-simplify ( #1070 )
...
The following snippet triggerd the error:
template<typename DerivedT>
template<typename T>
auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
return Parser() | static_cast<DerivedT const &>( *this ) | other;
}
Whenever simplifyFunctionParameters was called on a templated class'
templated member function (and probably any nested template), the
tokenizer would recognise it as a syntax error, assuming that return
type *must* come after a template<> token.
2018-02-04 09:48:37 +01:00
IOBYTE
d721c6aca5
Fixed #8386 (syntax error not found (segmentation fault)) ( #1081 )
2018-02-03 15:50:05 +01:00
Daniel Marjamäki
21a35de0d2
Tokenizer: Refactoring garbage check
2018-01-27 22:26:43 +01:00
David Hallas
4d18d3948f
Fixes issue with case inside switch that is not a compound statement ( #1031 )
...
* Fixes issue with case inside switch that is not a compound statement was treated as garbage
This fixes an issue with the check for case keywords outside of switch
detection that would treat a case statement inside a switch that is not
a compound statement as garbage, but this is perfectly valid C++. This
construct is used in several libraries, i.e. Google Test.
* Tweak check and handle missing semicolon
Tweaks the check with feedback from danmar.
Handle the case where there is no semicolon and document it with a unit
test.
2018-01-27 22:21:26 +01:00
Daniel Marjamäki
c110770481
Fixed #8325 (False negative: address of auto variable being returned when assigned to another variable first)
2018-01-27 14:48:45 +01:00
Simon Martin
71ba513bdb
Ticket #8361 : Fix false positive in Tokenizer::findGarbageCode. ( #1061 )
2018-01-26 22:06:07 +01:00
Daniel Marjamäki
3ebedcd7f5
Fixed VS crash for torture test
2018-01-26 16:05:43 +01:00
Daniel Marjamäki
a5f202360a
Fixed crash for garbage code, found by fuzzing
2018-01-26 09:34:27 +01:00
Daniel Marjamäki
1b3248b0fc
Dont write syntax error for lambda functions
2018-01-25 17:47:27 +01:00
Daniel Marjamäki
c04557eb73
Fix crashes detected with fuzzing
2018-01-25 15:53:58 +01:00
IOBYTE
8ce496a127
Fix possible null pointer dereference cppcheck warning. ( #1056 )
2018-01-24 21:19:52 +01:00
Daniel Marjamäki
96e387a486
Fixed #8351 (segmentation fault on objective C code)
2018-01-24 18:06:11 +01:00
IOBYTE
558e0757c2
Fix simplifyTypedef crash on lambda. ( #1054 )
2018-01-24 15:04:33 +01:00
Daniel Marjamäki
0f561d0ed6
Fix crashes for garbage code, found by fuzzing
2018-01-24 13:53:03 +01:00
IOBYTE
4710d80a40
Fix #5766 (FP: typedef array throws off parser) ( #1052 )
...
* Fix #5766 (FP: typedef array throws off parser)
* Fix travis build.
2018-01-24 09:51:22 +01:00
IOBYTE
e6d285d3ca
Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) ( #1046 )
2018-01-22 08:06:56 +01:00
Martin Ettl
17a54681b8
tokenize: simplify empty string creation string("")->string().
2018-01-21 16:36:57 +01:00
Alexey Eryomenko
913fdf44b6
member access operators are allowed inside the embedded SQL block when ( #1043 )
...
passing arguments for a query
2018-01-21 15:58:12 +01:00
Daniel Marjamäki
af26f00e04
gui: update copyright message in about dialog
2018-01-14 15:46:20 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
IOBYTE
cefb2131c7
Add support for simple c++ 11 type ailases like: using INT = int; ( #1024 )
...
* Add support for simple c++ 11 type ailases like: using INT = int;
Only types supported by ValueType are supported. Complex types like
function pointers are not supported. Template type aliases are not
supported.
* Fix crash when type in using type alias is simplified away.
This fixes a crash when size_t is replaced with unsigned long in: using
size_t = unsigned long; by the tokenizer.
This does not fix the problem where Tokenizer::simplifyPlatformTypes()
simplifies away size_t in other cases. This is only a problem when the
new type is different from the platform type.
2018-01-10 22:16:18 +01:00
Daniel Marjamäki
8c33a95b49
Refactoring: moved method from Tokenizer to TokenList
2018-01-07 14:07:34 +01:00
Daniel Marjamäki
1af69bd0d4
Tokenizer::createLinks2: fix link for >>
2018-01-01 15:20:21 +01:00
Daniel Marjamäki
fa42a08a71
Make code less strict that looks for garbage template code. Before a template there might be unknown macros.
2017-12-31 16:25:41 +01:00
Daniel Marjamäki
005bb7c747
Replace Token::Match with Token::simpleMatch
2017-12-29 23:05:54 +01:00
Daniel Marjamäki
fc1ac180e6
Fixed #6218 (Template type aliasing misdetection)
2017-12-29 22:47:07 +01:00
Dmitry-Me
6ae32ed98c
Unify check with surrounding code
2017-12-20 01:37:19 +03:00
Daniel Marjamäki
9c17bddbd4
Tweak fix for ticket #8297
2017-12-17 22:27:05 +01:00
Daniel Marjamäki
1428759479
Fixed #8297 (Tokenizer:createLinks: 'X<sizeof(int)==1 || sizeof(int)==4>()')
2017-12-17 15:53:05 +01:00
IOBYTE
026d8f6859
fix #8284 : False positive: "Label 'class' is not used." for anonymous… ( #1011 )
...
* fix #8284 : False positive: "Label 'class' is not used." for anonymous C++ class
Add support for annonymous derived structures and classes.
* Fix travis build (use findsimplematch).
* Fix bug in simplifyLabelsCaseDefault which was inserting ; in wrong place.
2017-12-05 16:50:04 +01:00
Simon Martin
cbf0b13b3e
Ticket #8255 : Don't crash upon invalid code while checking conditions.
2017-11-25 08:22:39 +01:00
Daniel Marjamäki
5cfa13c31c
Reuse Token::isControlFlowKeyword()
2017-11-17 22:18:19 +01:00
Daniel Marjamäki
b57dd4359b
Fixed #8263 (check-library incorrectly reports missing configuration for case when value is in parentheses)
2017-11-17 22:10:39 +01:00
Daniel Marjamäki
31a1cebc5f
Fixed #8272 (setVarIdPass2: Broken parsing of class header)
2017-11-11 12:04:25 +01:00
Daniel Marjamäki
4740bf116f
Remove unused variable
2017-11-11 11:31:27 +01:00
Daniel Marjamäki
b01772e4d1
Fix testcase
2017-11-10 21:28:13 +01:00
Daniel Marjamäki
6b1a2dcc5d
Fixed #7788 (Varid missing for member variable in ctor of template class)
2017-11-10 21:03:15 +01:00
Daniel Marjamäki
7ec0e41196
Fix Cppcheck performance warnings
2017-11-09 23:18:00 +01:00
Daniel Marjamäki
799f953c00
Fixed #8269 (Tokenizer: wrong varid (using namespace A::B))
2017-11-09 23:15:16 +01:00
Daniel Marjamäki
2408f01cc0
Fixed #8270 (Tokenizer: wrong varid (using namespace std))
2017-11-09 22:08:58 +01:00
Daniel Marjamäki
b67cf0a475
Improved handling of varid in complex scopes
2017-11-09 15:58:08 +01:00
Daniel Marjamäki
cc08d51505
Fix Cppcheck warning (use prefix increment for iterator)
2017-11-09 08:40:13 +01:00
Daniel Marjamäki
26b9e1528c
Fixed #7000 (Invalid varid - matching class with same name from other namespace)
2017-11-08 22:52:27 +01:00
Daniel Marjamäki
8b384f8ee5
Fixed #4988 (Tokenizer::setVarId: Wrong varid for inline function parameter)
2017-11-05 22:25:46 +01:00
Daniel Marjamäki
511d14a051
astyle
...
[ci skip]
2017-11-05 17:56:24 +01:00
Daniel Marjamäki
4d8f069907
Renamed pro c sql to embedded sql
2017-11-03 21:04:12 +01:00
Daniel Marjamäki
4f6f1e20dd
Hide Pro*C SQL simplification. Use pro_c_sql.cfg library file if this is wanted.
2017-11-03 13:02:29 +01:00
Daniel Marjamäki
9b2936a66f
Code refactoring
2017-11-03 11:41:32 +01:00
Alexey Eryomenko
02461753f3
Fix for embedded PL/SQL blocks (Oracle Pro*C) ( #985 )
...
* fix for correct parsing of embedded PL/SQL blocks (Oracle Pro*C)
* enforce SQL block end at the end of nearest outer C block, when
appropriate terminator is not found
* added check for ; at the end of END-EXEC and made SQL block detection
more readable
2017-11-03 11:31:33 +01:00
Oleksandr Redko
a8700f5622
Remove redundant parts of conditional expressions ( #988 )
...
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Dmitry-Me
eb6bf1bcae
Cache and reuse value
2017-10-23 00:42:56 +03:00
Dmitry-Me
1de8f771e9
Cache and reuse value
2017-10-23 00:41:29 +03:00
Dmitry-Me
46f726c049
Cache and reuse value
2017-10-23 00:36:05 +03:00
Daniel Marjamäki
0425f1d46d
Fixed #8241 (FP: Same expression on both sides of operator)
2017-10-16 17:39:50 +02:00
Ayaz Salikhov
be2c65eb58
Simplify int vs bool
2017-10-08 07:54:39 +02:00
Alexey Eryomenko
22483baf72
missed simplification in parsing of std function declaration resulted in ( #967 )
...
wrong type detection
2017-10-03 22:10:13 +02:00
Daniel Marjamäki
89b9f57759
Fix corrupt Token::Match pattern
2017-09-21 15:01:34 +02:00
Daniel Marjamäki
71d207c034
Fixed #8226 (Tokenizer: Wrong handling of string literal u"abc")
2017-09-21 13:33:14 +02:00
Daniel Marjamäki
2e6d78bd08
Fixed #8184 (Syntax error: case outside switch)
2017-09-15 22:37:31 +02:00
Ayaz Salikhov
f0b5327450
Fix codestyle ( #953 )
2017-09-07 13:00:46 +02:00
Dmitry-Me
35f5515931
Fix CID 1360383
2017-09-06 00:12:09 +03:00
Dmitry-Me
3127fcf429
Omit repeated computations
2017-09-05 17:56:57 +03:00
Daniel Marjamäki
82527422a8
Fixed #5614 (Incorrect syntax error with function pointer typedef and dependent template types)
2017-08-30 19:18:05 +02:00
Dmitry-Me
cc97834e88
Revert "Combine overlapping patterns"
...
This reverts commit 123f9b67e0
.
2017-08-26 08:18:24 +03:00
Dmitry-Me
123f9b67e0
Combine overlapping patterns
2017-08-26 07:32:02 +03:00
Dmitry-Me
b9c2a996bf
Break loop early
2017-08-26 07:26:28 +03:00
Dmitry-Me
eba9ea0ed0
Remove redundant check
2017-08-24 18:11:54 +03:00
Daniel Marjamäki
92e9744020
Fixed #8148 (Tokenizer: Braces are not added properly in do while)
2017-08-16 18:55:34 +02:00
Martin Güthle
1d491bd332
Treat noexcept correctly
...
Converts the noexcept to the already correctly handled noexcept(true)
2017-08-16 11:31:19 +02:00
Daniel Marjamäki
5c733c8f22
Fixed #8152 (Garbage code cause crash '0|\0|0>;')
2017-08-15 23:19:42 +02:00
Hinterwaeldlers
705e5e3468
Fix for http://trac.cppcheck.net/ticket/8151 ( #942 )
...
* Taking care of incorrect template syntax (missing close)
Forward the incorrectness via throw, as there is no direct access to the
syntaxError method, without converting the function to a member function
2017-08-15 22:40:55 +02:00
Ayaz Salikhov
b8cd7dbb5c
Use nullptr instead of 0 or NULL ( #936 )
2017-08-09 20:00:26 +02:00
Daniel Marjamäki
29265cdd49
Refactoring, use continue
2017-07-30 12:46:04 +02:00
Daniel Marjamäki
f76ff9e7bf
Tokenizer: Put struct in anonymous namespace
2017-07-29 19:46:18 +02:00
Daniel Marjamäki
a78fd23732
Refactoring, skipEnumBody
2017-07-29 12:13:32 +02:00
Simon Martin
aa35462add
Ticket #8091 : Don't replace std types within enum definitions. ( #922 )
2017-07-29 11:56:09 +02:00
orbitcowboy
0e575ce12c
Modernize: make use of 'nullptr' and added a rule-file for finding non-nullptr (zero) initializations.
2017-07-28 15:20:43 +02:00
Daniel Marjamäki
f85e43d21f
Fixed #8059 (Tokenizer::simplifyWhile0: for loop that modifies local variable)
2017-07-09 22:44:10 +02:00
Daniel Marjamäki
dff9d13758
Fixed #8115 (Tokenizer: links not properly set in r-value template 'Foo<int> && foo')
2017-07-09 13:26:59 +02:00
Daniel Marjamäki
6417be4a71
Fixed #8054 (Tokenizer::simplifyKnownVariables(): Wrong simplification for global variables)
2017-07-08 22:12:01 +02:00
Daniel Marjamäki
6c2002a150
minor constness fix
2017-07-08 21:41:57 +02:00
Alexander Mai
ce13b75967
Add missing types to Platform::platformString(). Add another pattern to Tokenizer::findGarbageCode() to avoid potential crash in Valueflow
2017-06-06 22:15:11 +02:00
Daniel Marjamäki
26bd863d0a
Fixed #7724 (hang: long expression => wrong AST)
2017-06-04 12:16:49 +02:00
Daniel Marjamäki
bbde3cc23a
Merge pull request #910 from mathbunnyru/asalikhov/improve_readability
...
improve readability
2017-06-03 14:33:21 +02:00
uburuntu
f4ce49d883
ENH: perfomance: using clear() and empty() more faster for stl containers
2017-06-02 22:38:00 +04:00
Daniel Marjamäki
b68c8d91ab
Fixed #8039 (Tokenizer: wrong simplification of string)
2017-06-01 22:21:02 +02:00
Ayaz Salikhov
3cd2f2d092
Don't cast bool to bool
2017-06-01 01:49:40 +03:00
Frank Zingsheim
aa937e426d
Fixed #7849 (Tokenizer: Wrong simplification of floating point equality comparison)
2017-05-28 10:53:50 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
93e0516291
Fixed #8009 (Tokenizer: fix handling of template rvalue references)
2017-05-23 18:55:17 +02:00
Daniel Marjamäki
040d2f0012
Use simplecpp lexer in test cases
2017-05-18 21:52:31 +02:00
Daniel Marjamäki
7bd0bc7534
Tokenizer: Simplify '->' to '.'
2017-05-17 22:50:54 +02:00
Daniel Marjamäki
59335f80d2
Try to fix windows build. Reduce header dependencies
2017-05-17 15:38:31 +02:00
Daniel Marjamäki
6230919976
Skip 'Stringification => Tokenize' step
2017-05-17 14:57:54 +02:00
Daniel Marjamäki
a8a54bbfa8
Fixed #6028 (Improvement: False positive caused by C keywords in assembly comments)
2017-05-05 08:57:24 +02:00
Alexander Mai
f54a6f085b
#7883 hang: CheckOther::checkFuncArgNamesDifferent() template code in .h. Activate language check for header files + Small refactoring
2017-05-03 20:36:26 +02:00
Daniel Marjamäki
1ec9b8c5b4
Fixed #8047 (false positive uninitialized variable - sizeof **A)
2017-05-03 19:27:55 +02:00
Alexander Mai
e88b4dcf06
Add another check to Tokenizer::validateC(): C++ casts
2017-05-03 16:57:42 +02:00
Alexander Mai
1bc7a89b3c
Improve search patterns within Tokenizer::validateC()
2017-05-02 17:57:06 +02:00
Matthias Krüger
cee0f724ff
Fixed #8018 : Tokenize::findGarbageCode: detect heads of for-loops with 1 or more than 2 semicolons as garbage code.
2017-05-01 18:28:26 +02:00
Daniel Marjamäki
8a08cc0796
Fixed #8029 (Tokenizer::simplifyCAlternativeTokens: dont simplify 'eb.and + 1')
2017-04-30 14:40:41 +02:00
Simon Martin
28960a8bba
Remove bailout and fix varid for template class member initialized in out-of-line constructor ( #8031 )
2017-04-30 08:59:47 +02:00
Daniel Marjamäki
bdf16b1157
Tokenizer::simplifyComma: dont simplify comma in '=(struct s){...}'
2017-04-26 20:48:08 +02:00
Daniel Marjamäki
1a95dc9bd6
Fixed #7979 (Tokenizer: Detect and reject c++ code in .c file)
2017-04-17 22:15:29 +02:00
Daniel Marjamäki
1045ece946
dump: refactor valueType dump
2017-04-16 09:11:20 +02:00
Daniel Marjamäki
f90d8c9987
dump: fix xml format
2017-04-15 14:03:49 +02:00
Daniel Marjamäki
e71b428740
dump: Add platform info and valueType info
2017-04-15 12:25:44 +02:00
PKEuS
b1f4bd7504
Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set ( #7995 )
2017-04-11 11:49:26 +02:00
Daniel Marjamäki
8ffed6862d
Tokenizer: Add --check-config warning for macro with semicolon in argument
2017-04-07 19:19:10 +02:00
Daniel Marjamäki
50da7d4919
Tokenizer: Write syntax error if there is C++ code in C file.
2017-04-06 08:50:35 +02:00
Daniel Marjamäki
9c5a136f04
Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>)
2017-04-03 21:48:22 +02:00
Daniel Marjamäki
1faca91c1d
Added 'endsWith' utility function. This will make compiling the democlient easier.
2017-04-01 18:14:18 +02:00
PKEuS
3c8f5b85ae
Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10%
2017-03-27 18:48:34 +02:00
Robert Reif
f099c6a110
Refactor symbol database value type support by making setValueTypeInTokenList and setValueType member functions of SymbolDatabase. Class variables are no longer passed around as parameters but accessed directly which simplifies the code. There should be no functional change.
2017-03-21 21:55:22 -04:00
Daniel Marjamäki
8c707876ed
Tokenizer: Don't simplify '({..})' wrongly
2017-03-08 11:41:18 +01:00
Daniel Marjamäki
2f2ac46243
Replaced hardcoding for char16_t and char32_t with configuration
2017-03-04 16:30:42 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Matthias Krüger
35e7697474
switch some functions from const to static, as cppcheck suggests.
2017-02-27 13:51:33 +01:00
Daniel Marjamäki
2e91858640
Fixed #7877 (Tokenizer: Does not clear ValueFlow after first pass)
2017-02-25 17:57:39 +01:00
Simon Martin
487f76cdd1
Ticket #7916 : Don't incorrectly simplify return statements involving template instantiations.
2017-02-18 21:14:50 +01:00
Matthias Krüger
6f1e7e897d
simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match).
2017-02-06 15:37:12 +01:00
Simon Martin
5262ed018e
Ticket #7440 : Function calls should not abort pointer alias analysis for local variables.
2017-01-27 22:56:28 +01:00
Daniel Marjamäki
b7321e8dde
Tokenizer: Rename struct
2017-01-09 22:40:30 +01:00
Robert Reif
4c25e798b1
Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template)
2016-12-31 22:05:29 +01:00
Daniel Marjamäki
1b21767954
Fixed #5666 (False positive when modifiying std::string by pointer)
2016-12-26 17:13:35 +01:00
Daniel Marjamäki
2ce4811998
astyle formatting
...
[ci skip]
2016-12-22 09:40:39 +01:00
Daniel Marjamäki
426d1b4196
Merge pull request #846 from simartin/ticket_7805
...
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Daniel Marjamäki
4558701c08
varid: don't generate varid and symboldatabase variable for function call parameter
2016-12-18 20:16:38 +01:00
Simon Martin
5119ae84b8
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-17 14:05:26 +01:00
Daniel Marjamäki
d4f2512421
Tokenizer::simplifyKnownVariables: Added bailout when pointer alias is simplified and loop is encountered
2016-12-11 19:12:23 +01:00
Daniel Marjamäki
2ca85a1c40
dump: add isUnsigned/isSigned
2016-12-09 22:31:47 +01:00
PKEuS
cfac3b457d
Several small refactorizations
2016-12-06 22:12:02 +01:00
PKEuS
2f6350a0d0
Refactorized Library
2016-12-06 14:09:28 +01:00
amai2012
f66e7fb379
#7833 UB: member call on null pointer when --dumping configuration with unknown value
2016-11-28 18:19:19 +01:00
Stefan Weil
57b57428c2
Fix some typos in comments (found by codespell)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki
21364b4401
Refactoring fix for #7816
2016-11-21 13:54:59 +01:00
amai2012
933815ee54
#7816 Segmentation fault at Tokenizer::simplifyAttribute() for stand-alone void. Throw syntax error on incomplete code
2016-11-21 12:19:47 +01:00
Daniel Marjamäki
74fa69fe5e
Fixed #7821 (syntax error, first token is &)
2016-11-20 17:59:50 +01:00
Daniel Marjamäki
5b377ea2e4
Fixed #7821 (segmentation fault, invalid last token)
2016-11-20 14:15:51 +01:00
Daniel Marjamäki
483fd8682a
cleanup redundant info in comment. ticket numbers can be looked up with git blame. if the code says there is a syntax error then a comment that says 'invalid code' isn't much clarification.
2016-11-06 16:49:25 +01:00
orbitcowboy
2f8a24764f
tokenize: Improved const correctness. There are no functional changes.
2016-10-31 17:18:27 +01:00
orbitcowboy
b3c60bf6b2
tokenize: Improved const correctness. There are no functional changes.
2016-10-31 16:11:11 +01:00
Daniel Marjamäki
e76710c906
Revert "Revert "Fix potential uninitialized variable in Tokenizer::simplifyTypedef""
...
It does not _fix_ any potential uninitialized variable. So I reverted this. However I think that as a refactoring it was ok.
This reverts commit 5b2e4891c4
.
2016-10-29 19:04:10 +02:00
Daniel Marjamäki
5b2e4891c4
Revert "Fix potential uninitialized variable in Tokenizer::simplifyTypedef"
...
This reverts commit bed2f66302
.
2016-10-29 18:29:05 +02:00
Frank Zingsheim
bed2f66302
Fix potential uninitialized variable in Tokenizer::simplifyTypedef
2016-10-29 17:05:51 +02:00
Daniel Marjamäki
efa3aba32a
Remove Tokenizer::simplifyNull()
2016-10-18 21:44:02 +02:00
Daniel Marjamäki
9cea2d6dfa
Tokenizer: Removed simplifications of standard functions that should be handled through configuration.
2016-10-18 19:25:58 +02:00
Daniel Marjamäki
d09a8dde57
Improved char literal handling. In the 'normal' tokenlist these should not be simplified to integer literals.
2016-10-12 10:20:24 +02:00
Harald Scheidl
58eb644003
Improved Check: Warn about number and char literals in boolean expressions ( #7750 )
2016-10-09 13:21:00 +02:00
Daniel Marjamäki
bcbc8ef017
Fixed #7747 (Syntax error when setting the bitcount of an enum defined inside a struct)
2016-10-04 15:57:43 +02:00
Daniel Marjamäki
02402eeea4
Make simplifyBitfields() a bit more strict
2016-10-04 15:33:50 +02:00
Harald Scheidl
ba6cda9c86
Fixed #7740 (Tokenizer::setVarId: Function declaration does not start with 'return')
2016-10-03 10:02:18 +02:00
Simon Martin
3f415673e4
Ticket #7541 : Properly keep track of namespace definition end markers when there are multiple of them.
2016-10-01 20:46:33 +02:00
Daniel Marjamäki
ac1a869d60
unused struct members: don't warn about packed structs ( #3088 )
2016-09-05 17:27:12 +02:00
Daniel Marjamäki
18cab009c1
Fix Token::Match pattern
2016-08-28 19:25:57 +02:00
Daniel Marjamäki
254e5675ff
Fixed #7573 (Tokenizer: FP caused by constant folding)
2016-08-28 19:11:05 +02:00
Frank Zingsheim
7c9a69357e
Fixed #7696 (cppcheck 1.75 runs very slowly with style and/or performance checks)
2016-08-21 16:07:05 +02:00
Robert Reif
62ac40fc5e
Fixed #7706 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 22:43:27 +02:00
Robert Reif
f1b5ac30a7
Fixed 7698 (FP syntaxError with enum (1.75 regression))
2016-08-19 19:09:52 +02:00
Daniel Marjamäki
7d6c587580
Fixed #6113 (Tokenizer::simplifyFunctionPointer: wrong simplification of usage 'return (*f)();')
2016-08-04 19:10:08 +02:00
PKEuS
084fcc936c
Rephrased syntaxError message for empty configurations to improve readability:
...
Old: Invalid number of character 'c' when these macros are defined: ''.
New: Invalid number of character 'c' when no macros are defined.
2016-08-04 16:28:11 +02:00
Daniel Marjamäki
908e1b991e
Tokenizer: Refactoring simplifyPlatformTypes()
2016-08-02 19:44:18 +02:00
Daniel Marjamäki
cc62259103
Tokenizer: don't set varid on c++11 'template using' type.
2016-08-02 15:04:07 +02:00
Daniel Marjamäki
99b23012aa
Refactoring, use Settings::platformString()
2016-08-02 10:53:51 +02:00
Daniel Marjamäki
31484133c0
Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };')
2016-08-01 22:26:11 +02:00
Daniel Marjamäki
09b6568ea2
Fixed #7646 (podtypes do not get proper valuetype)
2016-07-31 19:47:34 +02:00
Daniel Marjamäki
71f62950ed
Tokenizer::findGarbageCode: Make it less picky about 'UNKNOWN_MACRO if ..'
2016-07-26 14:35:11 +02:00
Daniel Marjamäki
7ff9545b10
Fixed #7637 (FP syntax error assignment in switch)
2016-07-26 12:15:55 +02:00
Daniel Marjamäki
fd19ab4ed1
fix garbage code handling
2016-07-26 08:50:00 +02:00
Daniel Marjamäki
383b815cca
Tokenizer: refactoring garbage code handling
2016-07-26 08:16:10 +02:00
Daniel Marjamäki
7ef02a7469
Cleanup Tokenizer
2016-07-25 12:12:11 +02:00
Daniel Marjamäki
adf16fae8b
Remove handling of ##, __FILE__, __LINE__ from tokenizer
2016-07-25 07:58:03 +02:00
Daniel Marjamäki
cd3818088f
Remove unused function Tokenizer::tokenizeCondition
2016-07-24 14:37:43 +02:00
Daniel Marjamäki
ed4a47de45
Tokenizer: Improve syntax checking of switch,if,while
2016-07-22 16:54:24 +02:00
Daniel Marjamäki
83b982064d
Fixed #7579 (varid not set properly in 'int b[] = { m * a[0] };')
2016-07-18 15:27:08 +02:00
PKEuS
801fd8f96a
Support trailing return types (C++11)
2016-07-17 15:47:50 +02:00
Daniel Marjamäki
b8ca9fc844
Tokenizer: alternative tokens for and,or,etc. context sensitive for both c and c++.
2016-07-16 21:29:56 +02:00
Daniel Marjamäki
6e3d5dc0d1
Fixed #7580 (False positive when using logical operator keywords 'and', 'or')
2016-07-16 20:21:31 +02:00
PKEuS
0afecd8fee
Do not simplify name "CALLBACK" away on non-windows platforms ( #7554 )
2016-07-16 10:43:28 +02:00
PKEuS
a808549af0
Support lambdas in simplifyCompoundAssignment ( #7571 )
2016-07-08 20:10:33 +02:00
Simon Martin
3c10b25b3e
Ticket #7117 : Properly detect if a const ternary operator is in a template parameter list.
2016-06-05 14:13:32 +02:00
PKEuS
c7b3836379
Small refactorizations:
...
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
PKEuS
e22c177003
Optimized Tokenizer::setVarIdPass1(): Avoid costly std::stack<std::map<...>>::push/pop() operations for struct initializers
2016-05-24 23:15:09 +02:00
PKEuS
686cc6640e
Refactorization: Improved performance of Tokenizer::simplifyMicrosoftMemoryFunctions() and Tokenizer::simplifyMicrosoftStringFunctions()
...
- Added pre-check before doing complex Token::Match() calls
- Use std::map instead of std::set
2016-05-24 21:19:20 +02:00
Daniel Marjamäki
06a594a9e0
Fixed #6207 ('not' misinterpreted as alternative C token)
2016-05-24 13:33:21 +02:00
Daniel Marjamäki
beabe110fd
setVarIdStructMembers: Fixed code so loop will terminate properly
2016-05-22 21:42:10 +02:00
Daniel Marjamäki
710e066a9a
Fixed #6406 (VarId: struct member initialization)
2016-05-22 21:18:52 +02:00
Daniel Marjamäki
06d5e73e88
Fixed #7471 (Tokenizer::prepareTernaryOpForAST: typedef with comma inside ?:)
2016-05-22 11:33:21 +02:00
Alexander Mai
303a85a930
#4195 segmentation fault of cppcheck (invalid code). Fix segfault which turned up after refactoring the enum handling code.
2016-05-17 22:19:23 +02:00
Alexander Mai
9d1302d523
#7490 sizeof('a') should be sizeof(int) in C mode. Previous fix was hardcoding 4 for C.
2016-05-14 22:52:43 +02:00
Daniel Marjamäki
2cb03b3fd0
Fixed #7409 (Tokenizer: Links not set properly 'Data<T&&>')
2016-05-14 20:40:30 +02:00
Daniel Marjamäki
7591a57587
Removed redundant valuetype debug output
2016-05-14 20:11:57 +02:00
Alexander Mai
251fc022fa
#7490 sizeof('a') should be 4 in C mode
2016-05-14 13:05:44 +02:00
Daniel Marjamäki
1d21cf5755
Tokenizer::setVarId: Refactoring, use continue in loops
2016-05-12 18:58:24 +02:00
Daniel Marjamäki
372763c85e
Tokenizer: Refactoring, split up the big Tokenizer::setVarId() function
2016-05-12 18:20:20 +02:00
Daniel Marjamäki
b04285514f
Tokenizer: Refactoring; use early return
2016-05-12 15:51:30 +02:00
Daniel Marjamäki
99d0dbf39c
Tokenizer::setVarId: Refactoring, changed type name
2016-05-11 21:12:29 +02:00
Daniel Marjamäki
b965cf5491
Fixed #7444 (Tokenizer::varId: Wrong varid when there is anonumous union in class)
2016-05-11 20:43:23 +02:00
Daniel Marjamäki
f0fcb859c7
Tokenizer: use static keyword instead of anonymous namespace for variables
2016-05-10 16:17:52 +02:00
Daniel Marjamäki
1caa79c45f
Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code ( #6900 ). This fixes #7485 .
2016-05-08 21:32:34 +02:00
Daniel Marjamäki
6f1af2cf0a
ValueType: Set ValueType info in simplified token list
2016-05-08 17:57:26 +02:00
Daniel Marjamäki
ad2d3394c8
Tokenizer: Create syntax tree before creating symboldatabase
2016-05-07 19:56:28 +02:00
amai2012
eba1b0881d
Minor refactoring: use nullptr (instead of 0/NULL), change signature of Tokenizer::createTokens
2016-05-07 16:30:54 +02:00
PKEuS
3366a74bb0
Refactorized CheckCondition::clarifyCondition():
...
- Reimplemented parts of the check based on ValueType
- Merged two loops
Fixed some type conversion messages
2016-05-06 15:22:45 +02:00
PKEuS
0bf85f9aa5
ValueType: Support integers defined in libraries ( #7394 )
2016-05-04 15:39:56 +02:00
PKEuS
f0fb7a8245
Simplify __attribute__ earlier ( #7462 )
2016-05-04 13:51:34 +02:00
PKEuS
b65cacf4b1
Tokenizer::simplifyStaticConst(): Support "struct" and operator:: ( #7403 )
2016-05-04 12:33:19 +02:00
prozak
6592638022
- fix for #5749 defect: internal error
...
typedef expansion in cast operator was not processed correctly
2016-04-22 21:39:03 +08:00
Daniel Marjamäki
2a719bd194
Use simpleMatch for simple pattern
2016-04-22 06:52:37 +02:00
Daniel Marjamäki
dc2a92263a
Fixed #7426 (RFC: time to replace simplifyEnum?)
2016-04-22 06:02:54 +02:00
Daniel Marjamäki
253bfe432c
Fixed #7410 (Tokenizer: function pointer with throw())
2016-02-29 08:02:02 +01:00
Robert Reif
0fc59d0228
#7069 False positive invalidPrintfArgType_uint - %lu with 0ul
2016-02-19 10:12:47 +01:00
Daniel Marjamäki
d964825c9f
ValueType: Add debug output that is shown when --verbose is used
2016-02-15 16:18:24 +01:00
Daniel Marjamäki
6c324013e7
Use MAXTIME in templatesimplifier
2016-02-12 12:05:32 +01:00
Daniel Marjamäki
cef6b35bb8
Improve MAXTIME handling
2016-02-11 16:10:52 +01:00
Daniel Marjamäki
5fef7cc050
Fixed #4973 (wrong enum simplification of shadow struct variable)
2016-02-07 15:15:20 +01:00
Daniel Marjamäki
6c1012a8d6
Fixed #4625 (wrong enum simplification in shadowed enum declaration)
2016-02-07 13:51:03 +01:00
Daniel Marjamäki
f781f13997
Fixed #6806 (wrong enum simplification in initialization list)
2016-02-07 13:34:03 +01:00
PKEuS
f8bf2b5776
Removed rest of variableHidingTypedef and variableHidingEnum checking
2016-02-06 20:55:41 +01:00
Daniel Marjamäki
42278dd133
Tokenizer: skip constant folding in normal token list for C code. In C++ code we should only fold constants in template arguments.
2016-02-06 17:25:51 +01:00
amai2012
d25258359a
#7251 Remove checks variableHidingTypedef and variableHidingEnum
2016-02-06 15:37:58 +01:00
Daniel Marjamäki
c7f5ca74bd
VarId: Set varid for template parameters ( #7046 )
2016-01-31 11:07:30 +01:00
Alexander Mai
1dac1664be
7357 segmentation fault in TokenList::insertTokens
2016-01-26 19:12:57 +01:00
Daniel Marjamäki
26612ab846
Fixed #5332 (Tokenizer: if braces not added properly 'if (x==123) label: {}')
2016-01-23 11:43:48 +01:00
Daniel Marjamäki
2627aada07
Fixed #7346 (Tokenizer::setVarId: No varId for member in initialization list)
2016-01-23 08:28:04 +01:00
Daniel Marjamäki
8568a80208
Fixed #6883 (Template parsing error)
2016-01-20 16:10:58 +01:00
Daniel Marjamäki
ab441f3fb1
Tokenizer:vardecl: split up reference variables declared in class better
2016-01-19 15:27:11 +01:00
Daniel Marjamäki
a434e0fb1a
Fixed #7272 (Tokenizer:setVarId: handle namespaces better)
2016-01-19 14:32:27 +01:00
Dmitry-Me
f14814e002
Reorganize duplicated patterns
2016-01-14 10:00:07 +03:00
Daniel Marjamäki
f8306383b1
Remove redundant variable
2016-01-10 22:30:24 +01:00
Daniel Marjamäki
414bdc30a9
Fixed #7276 (VarId: Missing varId in template class constructor initialization lists)
2016-01-10 22:10:49 +01:00
Daniel Marjamäki
b3208fb4b3
Fixed #7211 (False positive: Finding the same expression on both sides of an operator (enumconstant == 0))
2016-01-10 11:21:43 +01:00
Daniel Marjamäki
7191733981
Fixed #7192 (False positive: uninitMemberVar when base class is in another namespace)
2016-01-09 12:18:36 +01:00
Daniel Marjamäki
0b9d8ae0f1
astyle formatting
...
[ci skip]
2016-01-08 15:24:05 +01:00
amai2012
bd2892fde4
Ticket #7270 segmentation fault (invalid code) in Tokenizer::simplifyLabelsCaseDefault. include fix for cygwin
2016-01-08 11:59:02 +01:00
Daniel Marjamäki
a014920280
Fixed #7260 (ValueType: in C++ the result of 'sint >> unknowntype' has unknown type)
2016-01-07 10:46:19 +01:00
Daniel Marjamäki
88a525aca7
Fixed #7267 (Tokenizer::setVarId: wrongly sets varId in cast with unknown type)
2016-01-06 17:47:59 +01:00
Daniel Marjamäki
125d2f7a36
Some initial support for platforms that doesn't have 8-bit char
2016-01-05 13:16:00 +01:00
Daniel Marjamäki
a0971355b7
Tweaked Tokenizer::simplifyAsm2()
2016-01-04 19:18:10 +01:00
Daniel Marjamäki
b748453b30
Tokenizer: Improve handling of block declarations (C extension)
2016-01-04 09:59:53 +01:00
Daniel Marjamäki
036306d7c2
Refactoring Tokenizer::startOfExecutableScope(). Improve and reuse Tokenizer::isFunctionHead().
2016-01-03 22:52:24 +01:00
Daniel Marjamäki
7e585d37bc
Tokenizer: Remove startOfFunction() and use isFunctionHead() instead.
2016-01-03 19:06:11 +01:00
Daniel Marjamäki
79e663dd6f
Settings: Remove '_' prefix for public member variables
2016-01-03 16:18:17 +01:00
Daniel Marjamäki
cd89e68f60
Fixed #6931 (noexcept and override qualifiers plus less than operator results in a syntax error)
2016-01-03 12:22:07 +01:00
Daniel Marjamäki
4ff7fa3f3b
SymbolDatabase,Tokenizer: Refactor handling of noexcept
2016-01-03 08:36:00 +01:00
Daniel Marjamäki
9dabd17eae
Tokenizer::isFunctionHead(): Handling of C++ methods only in isCPP() condition.
2016-01-03 08:23:48 +01:00
Daniel Marjamäki
be8fc0f89f
SymbolDatabase: Better handling of default and delete when reusing Tokenizer::isFunctionHead()
2016-01-03 00:01:29 +01:00