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