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
b892d2e14c
Fixed #4300 (segmentation fault of cppcheck (invalid code))
2013-02-16 18:31:43 +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
Daniel Marjamäki
48e194dc56
Fixed #4572 (Analysis failed: sizeof final)
2013-02-10 23:54:15 +01:00
Stefan Naewe
46fb31f9e5
lib/tokenize: fix two compiler warnings about emtpy while loop
...
Fixes these warnings:
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenize(std::istream&, const char*, const std::string&)’:
lib/tokenize.cpp:1962: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenizeCondition(const std::string&)’:
lib/tokenize.cpp:2174: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
2013-02-08 12:15:42 +01: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
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +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
Thomas Jarosch
f867d05d81
Use Token::simpleMatch() for simple pattern
...
Found by "internal" check
2013-01-21 10:14:39 +01:00
Daniel Marjamäki
67c9720299
Tokenizer: fixed simplification of static constants
2013-01-19 21:14:15 +01:00
Daniel Marjamki
6d5532980e
Tokenizer: Set proper variable ID when simplifying return statement. Ticket: #3500
2013-01-19 13:42:54 +01:00
Daniel Marjamki
bff6ed7af0
Fixed #3500 (false negative: (error) Returning pointer to local array variable)
2013-01-19 13:39:23 +01:00
Thomas Jarosch
e22b1f7740
Adapt Tokenizer::simplifyCallingConvention() and Tokenizer::simplifyKeyword() for the match compiler
...
This little change gives another 6% speed improvement on my box.
(tested with the testsuite and checking the 'rpm' codebase)
The profiler showed we were spending quite some time in
Tokenizer::simplifyCallingConvention(). The multi match
pattern in there is "complex", at least for the on-the-fly parser.
2013-01-16 20:33:01 +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
Thomas Jarosch
f4227967ce
Simplify token string access
...
"internal" check reported:
[lib/tokenize.cpp:6671]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2013-01-15 20:37:02 +01:00
Erik Lax
723d95597b
Fixed #4481 (Simplify %str% [ %num% ])
2013-01-13 20:52:38 +01: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
97b928b2bc
Fixed #4476 (Tokenizer: wrong simplification of static anonymous-type struct array declaration)
2013-01-10 18:24:01 +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
c465cf4ab4
Related to the previous commit:
...
Use bit operator '&' instead of modulo operator '%'.
2013-01-04 14:20:15 +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
Thomas Jarosch
7f0bc73e8e
Simple constification (needed by the match compiler)
2013-01-04 03:17:52 +01:00
Edoardo Prezioso
1affb0c96b
Use more Effective C++ code style in Token class:
...
1)The non-const version of Token::tokAt and Token::linkAt now will use a combination of const_cast and static_cast to remove duplicate code.
2)The non-const versions of Token::find(simple)match are added, in order to avoid the usage of const_cast outside the Token code.
3)As a consequence of 2), an useless const_cast applied to a call of Token::findsimplematch in Tokenizer code is removed.
2013-01-03 22:35:34 +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
Daniel Marjamäki
ded0d50591
Tokenizer: add reportProgress to Tokenizer::simplifyKnownVariables. Ticket: #4409
2013-01-03 15:22:06 +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
Edoardo Prezioso
6612952dd4
Use 'simple' matching with normal patterns.
2012-12-31 13:30:06 +01: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
acm4me
7da155c8ba
Support for Sun Studio C++ compiler
2012-12-27 11:51:12 +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
db2a129557
Tokenizer: Improved handling of '\0' in strings
2012-12-25 08:56:12 +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
47e1a571f7
Tokenizer: Fixed goto problems
2012-12-22 19:28:53 +01:00
Daniel Marjamäki
d3f5fd4e59
Tokenizer: Fixed Token::Match pattern
2012-12-10 20:38:07 +01:00
Daniel Marjamäki
df03e3a8d2
Fixed #4395 (Wrong simplification of known variables in nested assignment)
2012-12-10 06:08:33 +01: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
Robert Reif
b216639069
Fixed #4378 (simplifyEnum doesn't simplify enum type within open and close parenthisis)
2012-12-02 07:22:55 +01:00
Edoardo Prezioso
5101f3c029
Use the new pattern: '%comp%' where possible.
...
Change also the description comment of the Token::Match by adding the new pattern and the forgotten '%op%'.
2012-12-01 01:31:35 +01:00
Edoardo Prezioso
f3782935c2
Tokenizer: improve code and change name of +- concatenation function.
2012-12-01 00:43:23 +01:00
Edoardo Prezioso
3d1d983251
Tokenizer: simplify also __FILE__ together with __LINE__.
2012-12-01 00:37:10 +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
Edoardo Prezioso
a219ed313b
Fixed again #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded).
...
It is caused by a regression introduced with commit 75fbe310ff
. Add also a TODO in the non working detection inside TestSimplifyTokens::simplifyTypedef98.
2012-11-30 00:00:44 +01:00
Edoardo Prezioso
e214d94589
Tokenizer: use list.back() when we start the loop backwards.
2012-11-29 17:42:31 +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
Edoardo Prezioso
6b40d93f6f
Try to fix Visual Studio compiler warning.
...
Related to commit 119ab519a4
.
2012-11-28 12:06:27 +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
76639578ad
Improve Tokenizer::simplifyFuncInWhile.
...
Differentiate between the new cppcheck:r variables by appending a number to the name, like 'cppcheck:r1', 'cppcheck:r2' and more.
2012-11-26 02:19:35 +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
Edoardo Prezioso
c5e5ee9ed2
Adapt %var%|%num% changes with Tokenizer, final.
2012-11-17 22:44:31 +01:00
Edoardo Prezioso
1bf003389e
Adapt %var%|%num% changes with Tokenizer, part 4.
2012-11-17 22:43:42 +01:00
Edoardo Prezioso
f8e4af9ce2
Adapt %var%|%num% changes with Tokenizer, part 3.
2012-11-17 22:42:24 +01:00
Edoardo Prezioso
bd63db62af
Adapt %var%|%num% changes with Tokenizer, part 2.
2012-11-17 22:40:44 +01:00
Edoardo Prezioso
2b4215ea7a
Adapt %var%|%num% changes with Tokenizer, part 1.
2012-11-17 22:39:02 +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
4ea2df8671
Changed handling of type wchar_t:
...
- Don't simplify wchar_t to unsigned short on Win32 platforms to ensure that checking of strings and nullpointer dereferences works.
- Added it as standard type
2012-11-11 14:47:16 +01:00
PKEuS
58fe7105f4
Remove C++11 keywords "override", "final" and "constexpr"
2012-11-09 19:53:10 +01:00
Edoardo Prezioso
119ab519a4
Support GNU extension of '?:' operator:
...
"x ? : y" is equivalent to "x ? x : y". I found a lot of code with this extension, probably we should warn a user to not use this.
2012-11-08 17:49:43 +01:00
Edoardo Prezioso
9556634ee7
Revert 1c0617c504
.
2012-11-07 18:34:25 +01:00
Edoardo Prezioso
061a5e1ad7
Run astyle.
2012-11-07 02:24:46 +01:00
Edoardo Prezioso
1c0617c504
change some Token::Match patterns used in code:
...
replace '||' with '%oror%', where possible.
2012-11-07 02:23:09 +01:00
Edoardo Prezioso
63307c5db2
Remove the now useless fix for #4245 .
...
The fix for #4276 made completely useless that branch, so remove it until someone shows a testcase which breaks this commit.
2012-11-05 00:13:04 +01:00
Edoardo Prezioso
7293fcfa9b
Remove redundant code in simplifyVarDecl:
...
TokenList::insertTokens adds the missing braces links when needed. The function does not add links to '<>', though, hence the TODO.
2012-11-05 00:12:22 +01:00
Edoardo Prezioso
4e25ffa948
Remove unexecuted branch in duplicateTypedef:
...
If the code is intended to be used, please revert + provide a valid testcase.
2012-11-04 23:03:14 +01:00
Edoardo Prezioso
333711ae4f
Remove dead branch in simplifySizeof:
...
the code in that branch won't ever be executed because simplifySizeOf is called after arraySize, which adds the string length inside the '[]' parenthesis.
2012-11-04 22:41:38 +01:00
Edoardo Prezioso
24bf6f99e1
More simplifyRedundantParenthesis changes:
...
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
Edoardo Prezioso
b6b359d1c6
Tokenizer::simplifyRedundantParenthesis refactor:
...
Change useless 'while' to 'if' where possible; unify duplicate 'delete [| ]| var' handling code.
2012-11-04 20:51:40 +01:00
Edoardo Prezioso
93f1fed205
Tokenizer '?:' handling code refactorization:
...
move '=|,|(|[|{|}|;|case|return (%bool%) ?' code handling from simplifyConditionOperator in simplifyConstTernaryOp in order to use a more efficient code, thus to remove code duplication.
2012-11-04 19:18:11 +01:00
Edoardo Prezioso
18e1eb7c70
Add missing hunks in the previous commit.
2012-11-04 19:08:54 +01:00
Edoardo Prezioso
c54eafdf69
Use '%char%' matching in the tokenizer file.
2012-11-04 17:22:38 +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
c9e0089546
Change Tokenizer member function name.
...
From 'simplifyQuestionMark' to 'simplifyConstTernaryOp' (the older name was not clear). Adjusted the doxy comment.
2012-11-02 14:57:12 +01:00
Edoardo Prezioso
8271d63744
Forgot to fix another clang analyzer message.
...
I don't understand why here there is a loop 'break' after a token stepping forward and a bool assignment.
2012-10-24 15:30:40 +02:00
Edoardo Prezioso
11b0047063
Fix some clang analyzer messages.
...
CheckMemoryLeak: two redundant assignments, should be clarified;
TemplateSimplifier: same;
Tokenizer: same.
2012-10-24 03:17:56 +02: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
1e4b080737
Fixed #4278 (syntax error).
2012-10-11 13:35:20 +02:00
Edoardo Prezioso
e62e03ab31
Fixed #4267 (segmentation fault of cppcheck (invalid code)).
2012-10-09 20:44:30 +02:00
Edoardo Prezioso
3703e71f82
Related to previous commit: if the '{}' parenthesis are found after 'case', don't skip them after continuing to the main loop or it will cause indentlevel mismatching.
2012-10-09 18:24:21 +02:00
Edoardo Prezioso
9668508b32
Tokenizer::simplifyLabelsCaseDefault:
...
use more efficient check for 'const' token;
remove redundant NULL checks thanks to commit e3bbcf501f
.
2012-10-09 17:52:20 +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
c2b61030a8
Fixed #4254 (Tokenizer::simplifyIfAssign: varids not preserved)
2012-10-06 12:49:24 +02:00
Daniel Marjamäki
2f069f550f
Removed Java/C# handling
2012-10-02 18:44:36 +02:00
Daniel Marjamäki
9a462d8a0a
Fixed #4225 (False positive: uninitialized variable (assignemnt in ternary expression with cast))
2012-09-30 18:49:25 +02:00
PKEuS
c4b881f844
Refactorizations in tokenize.cpp and testsimplifytokens.cpp:
...
- Avoid const_cast in testsimplifytokens.cpp
- Removed redundant null-check (VS11 code analysis)
- Fixed MSVC compiler warning
- Replaced some indentation counters
2012-09-29 14:10:41 +02:00
Daniel Marjamäki
ff4f8b58f3
Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617
2012-09-28 18:51:10 +02:00
Alexander Mai
074b7781b2
Fixed #4239 (segmentation fault of cppcheck (invalid code))
2012-09-27 06:35:36 +02:00
Mohit Mate
9e297c95f2
Fixed #2617 (improve check: comparing boolean with '<')
2012-09-26 18:18: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
Daniel Marjamäki
6c25f3662e
Tokenizer::simplifyEnum: Don't simplify enums in function heads. Ticket #3953
2012-09-21 16:17:20 +02:00
Edoardo Prezioso
8e1e8525a3
Partial rewrite of Tokenizer::simplifyComma:
...
skip '= { .. }' where possible;
hence remove '%num% after comma' check because it's redundant now;
replace round braces counter method with faster 'link skip';
if 'endAt' is 'NULL' after finding the ';' token, exit the function;
hence remove redundant 'tok != NULL' check after simplifying 'return' code.
2012-09-20 21:45:16 +02:00
Edoardo Prezioso
eb5a61edfe
Tokenizer: some changes to the code:
...
be sure '?:' ternary operation has whitespaces around the operators;
remove useless loop to get the 6 next tokens, use tokAt(6);
add '?1:0' to bool values when doing a sum with them.
remove useless 'enum' pattern checking in code executed after simplifyEnum;
after being sure the 'tok' is a standard type, begin the loop with the token next to it;
it's possible to remove two tokens before the current one without moving this.
2012-09-20 01:07:50 +02:00
Daniel Marjamäki
aa3cdc6b6f
Fixed #3565 (Variable hides enumerator (attached code example))
2012-09-19 19:19: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
07d2935e81
Fixed #4164 (False positive: (error) Uninitialized variable: min)
2012-09-18 20:55:37 +02:00
Daniel Marjamäki
1f7d9ca22c
Fixed #4211 (Tokenizer::simplifyVarDecl: Improved handling of >> in templates)
2012-09-17 19:45:42 +02:00
Daniel Marjamäki
a99515ca91
Fixed #3933 (Negative array index issue (because sizeof struct is assumed to be 100))
2012-09-16 08:20:43 +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
22a8e3f4e6
Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better.
2012-09-11 18:03:47 +02:00
Daniel Marjamäki
64faa780fe
Fixed #4087 (div by zero check is invalid for floats)
2012-09-11 16:50:42 +02:00
PKEuS
50f9dd52ab
Used enum instead of string in implementation for '--language='.
2012-09-11 08:53:27 +02:00
PKEuS
5940d77a62
Disabled C++ specific checks and simplifications when checking a C or non-C++ file.
2012-09-10 19:02:32 +02:00
PKEuS
87131f6105
Added new cmdline option --language= (alias of GCC-like -x) to enforce a specific language. Valid values: c, c++, java, c#. ( #3994 )
2012-09-10 18:51:32 +02:00
PKEuS
88f9e9991d
Fixed compiler warning ( #4136 )
2012-09-10 17:43:19 +02:00
PKEuS
ce9f6bdb56
Fixed segfault #4182
2012-09-10 17:33:52 +02:00
Daniel Marjamäki
cf8ac78069
Fixed test assertion failure caused by me
2012-09-09 18:33:41 +02:00
PKEuS
d44f10fc01
Fixed createLinks2() on this code: nvwa<(x > y)>
2012-09-09 15:31:23 +02:00
Daniel Marjamäki
511c5a62e7
Fixed #4141 (Crash when parsing divide by zero.)
2012-09-09 12:38:15 +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
0c55d5cfa7
Fixed #4002 (syntax error for 'X( typedef, Y)')
2012-09-09 09:14:46 +02:00
Daniel Marjamäki
69a0062177
Tokenizer: don't crash for 'int'. Ralated with tickets #2978 and #3304
2012-09-08 20:59:25 +02:00
Daniel Marjamäki
853c6522dc
Tokenizer::simplifyEnum: Readded refactorings. Tickets 3949,3950,4025,4053 has been solved as far as I see.
2012-09-08 12:42:24 +02:00
PKEuS
78d49ea4b8
Fixed #3732 - properly simplify struct declarations:
...
- Don't replace "{ {" if they are part of an initialization
- Properly split struct definition, variable declaration and variable initialization.
Used std::stack instead of std::list
2012-09-08 10:51:31 +02:00
Daniel Marjamäki
a39b58046f
Tokenizer: Improved simplification of 'a?(1):b'
2012-09-08 10:45:00 +02:00
Daniel Marjamäki
2722f53edd
Fixed #4142 (false positive (error) Uninitialized variable: b)
2012-09-08 10:15:37 +02:00
Daniel Marjamäki
2ce5cb3075
Tokenizer: Simplified parentheses better in such pattern: 'git merge --squash 4142 operator git merge --squash 4142 (%var%|)) ( %num%|%bool% ) %op%|;|,|)'
2012-09-08 07:01:35 +02:00
PKEuS
a4b5824dec
New internal check: checkRedundantNextPrevious().
...
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS
e4a693eaab
Refactorizations:
...
- Fixed several findings of CheckInternal.
- Removed some debug code from CheckOther::checkRedundantAssignment().
2012-09-07 11:59:20 +02:00