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
Alexander Mai
b22071cb54
#7185 : Add Assertion to detect memory corruption.
2016-01-02 23:56:40 +01:00
Daniel Marjamäki
66e047ee7d
Refactoring SymbolDatabase. Reuse Tokenizer::isFunctionHead().
2016-01-02 23:49:06 +01:00
Daniel Marjamäki
0a1d10bf2f
Tokenizer: Add &|&&| to Tokenizer::isFunctionHead()
2016-01-02 23:09:44 +01:00
Alexander Mai
ce12e1cea6
Remove unnecessaryForwardDeclaration check. It had false positives (e.g. #3663 ), was implemented in the Tokenizer and of little value.
2016-01-02 19:14:03 +01:00
Alexander Mai
ee5a5e8bb5
Minor modification of previous changeset (compare token with literal using str())
2016-01-01 23:37:38 +01:00
Alexander Mai
37c3d5da7b
#6731 Tokenizer::eraseDeadCode causes heap corruption on invalid code. Better detection of invalid code inside Tokenizer::simplifyFlowControl()
2016-01-01 23:32:10 +01:00
Daniel Marjamäki
95009a4630
Merge pull request #745 from lanurmi/2016_ad
...
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki
b457ceef0e
Settings: Added defaultSign
2016-01-01 17:33:59 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
Daniel Marjamäki
8171154e12
Fixed #7230 (Confusing code snippet in error message)
2015-12-31 01:15:49 +01:00
Daniel Marjamäki
b38559774d
Removed the CPPCHECK2 ifdefs. I have no plan to remove simplifications anymore.
2015-12-28 16:26:51 +01:00
Daniel Marjamäki
15ecb26a6c
Tokenizer: Moved simplifyAssignmentInFunctionCall from simplifyTokenList1 to simplifyTokenList2
2015-12-28 13:58:41 +01:00
Alexander Mai
e9635fd393
#7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration
2015-12-26 23:51:10 +01:00
amai2012
36a6599386
#7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-12-26 20:16:01 +01:00
Alexander Mai
87767fb666
#7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead
2015-12-26 00:21:56 +01:00
Dmitry-Me
05cb4e16fe
Fix misspelled word
2015-12-25 11:51:08 +03:00
PKEuS
a6b719eb10
Refactorization: Fixed true positive when self-checking cppcheck
2015-12-18 18:13:13 +01:00
Dmitry-Me
0d2edc532c
Remove redundant check
2015-12-16 16:36:06 +03:00
Dmitry-Me
bd4b47123a
Better variable name
2015-12-15 11:30:20 +03:00
PKEuS
18693a7fce
Refactorized token.cpp:
...
- Removed redundant overload of Token::insertToken()
- Fixed leak in Token::deleteThis()
- Moved condition out of loop in Token::tokAt()
2015-12-14 22:04:51 +01:00
Dmitry-Me
182877df88
Variable name consistent with other code
2015-12-14 17:35:32 +03:00
Albert ARIBAUD (3ADEV)
58031147b2
Optimize tokenizing
...
Reorganize cppcheck.cpp to separate actual checking from
tokenizing and XML dumping. This implies splitting checkFile()
in three parts, checkRawTokens, checkNormalTokens() and
checkSimplifiedTokens().
2015-12-13 09:29:47 +01:00
Alexander Mai
96531d6ffe
TokenList::createAst() doesn't validate itself anymore. Remove some duplicated code and fix glitch in TestGarbage::garbageCode162
2015-12-12 20:01:03 +01:00
PKEuS
51bb76c5b5
Optimization: Skip over expression in brackets in Tokenizer::isFunctionParameterPassedByValue()
2015-12-10 15:53:14 +01:00
Akhilesh Nema
932f6ea81b
Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode)
2015-12-09 14:00:40 +01:00
Dmitry-Me
28bf944d81
Remove redundant checks
2015-12-09 11:10:56 +03:00