PKEuS
a9a5dc0354
Updated to AStyle 2.03, require this version
2013-08-07 16:27:37 +02:00
Daniel Marjamäki
2a78db4c06
Refactoring Token::findClosingBracket.
2013-07-31 10:30:20 +02:00
Daniel Marjamäki
807204e580
Fixed #4237 (False positive: (error) Memory Leak: data (references and pointer aliases))
2013-07-30 11:30:14 +02:00
Lucas Manuel Rodriguez
09f4d3732a
Fixed #4911 (segfault, assignment in do ... while, 1.61dev)
2013-07-28 11:58:14 +02:00
Daniel Marjamäki
44333f316a
Added terminate() handling to get quicker response when the user wants to terminate
2013-07-24 13:06:59 +02:00
Daniel Marjamäki
37716fb8bb
Tokenizer: Set variable() pointer for array members
2013-07-20 17:46:39 +02:00
Daniel Marjamäki
dfed6bbea0
Fixed #4445 (Token::Match called with varid 0)
2013-07-19 21:18:54 +02:00
Daniel Marjamäki
6fe1b92a47
Improved --check-library messages
2013-07-16 18:50:25 +02:00
Daniel Marjamäki
b2f6e9e3eb
library: improved handling of noreturn. The Tokenizer::isScopeNoReturn will now try to use the library to determine if scope is noreturn.
2013-07-14 10:10:11 +02:00
Lucas Manuel Rodriguez
cfd697d6d4
Fixed #4042 (False Positive : Same expression on both sides of '&')
2013-07-11 07:13:47 +02:00
Simon Martin
e2deb59f8a
Improved handling of syntax errors in Tokenizer::simplifyAddBracesPair.
2013-06-29 14:05:49 +02:00
Daniel Marjamäki
c389e08353
Fixed #4728 (simplify known variables better (%var% & %num%, bitwise and))
2013-06-26 18:13:28 +02:00
Daniel Marjamäki
7dd07472c1
Fixed #4530 (Tokenizer: improved simplification of strlen in calculation)
2013-06-25 20:10:40 +02:00
Lucas Manuel Rodriguez
d6be4559cd
Fixed #4840 (false negative: buffer access out of bounds)
2013-06-25 06:37:51 +02:00
Alexander Mai
5a9975bbdd
Fixed #4869 (segmentation fault in Tokenizer::simplifyStructDecl (invalid code))
2013-06-22 14:05:49 +02:00
Daniel Marjamäki
d3d7808a06
Fixed #4834 (FreeType: incorrect array boundary analysis)
2013-06-16 15:41:13 +02:00
Daniel Marjamäki
210f2ab352
Tokenizer: refactoring; use Token::link() instead of loop
2013-06-16 15:27:59 +02:00
Daniel Marjamäki
59478c15cf
Tokenizer: small speedup
2013-06-16 09:00:02 +02:00
Daniel Marjamäki
a9bd6cf3df
Fixed #4857 (False Positive: function argument hides enumerator of same type)
2013-06-16 08:13:41 +02:00
Daniel Marjamki
03f28e9c65
Fixed #4668 (Tokenizer: improve handling of 'if (x) MACRO() { ..')
2013-06-15 14:40:05 +02:00
Daniel Marjamäki
c4763b9010
Fixed #4463 (false positive: (style) Variable 'CHDERR_NOT_OPEN' hides enumerator with same name)
2013-06-12 06:45:26 +02:00
Daniel Marjamäki
616a693f1f
Merge pull request #139 from JustRamires/master
...
Ticket #4694
2013-06-08 07:46:08 -07:00
Roman Zaytsev Borisovich
4610b135dc
Fixed #4694
2013-06-07 10:37:33 +04:00
Daniel Marjamäki
dec520c507
Tokenizer::simplifyEnum: Fixed false positives
2013-06-04 21:18:20 +02:00
Daniel Marjamäki
8b5792a0f8
Tokenizer::simplifyEnum: Fixed internalErrors when building with compiled patterns.
2013-06-04 18:57:46 +02:00
Daniel Marjamäki
fa1fd31667
Tokenizer::simplifyEnum: Improved handling of shadow variables
2013-06-04 06:51:01 +02:00
Daniel Marjamäki
8954cc0984
Fixed #4280 (Tokenizer::simplifyEnum: don't simplify shadow variables)
2013-06-03 19:18:51 +02:00
Daniel Marjamäki
ca632bd771
Fixed Cppcheck warning. Made method const
2013-06-01 14:35:21 +02:00
Frank Zingsheim
614a78084f
Fixed #4799 : Improved quickfix from 0943fecf03
...
(Segmentation fault in K&R simplification inside lambda expression)
2013-05-21 19:43:07 +02:00
Frank Zingsheim
0943fecf03
Fixed #4799 (Segmentation fault in K&R simplification inside lambda expression)
2013-05-14 20:56:31 +02:00
PKEuS
1903585ea3
Fixed bug in handling rvalue references: Scope has to be set everywhere. ( #4732 )
2013-05-14 01:43:32 -07:00
Frank Zingsheim
0076ebe08d
More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)
...
Travis: Problems with matchcompiler.py
2013-05-12 11:19:10 +02:00
Frank Zingsheim
511f8a4c1f
More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)
2013-05-12 10:19:43 +02:00
Daniel Marjamäki
cbe0a0825c
Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm())
2013-05-09 14:47:18 +02:00
Daniel Marjamäki
4659745106
Fixed #4786 (segfault with one LibreOffice file)
2013-05-06 16:56:34 +02:00
Zachary Blair
de8ee5b042
Fixed #4554 (false negative: buffer access out of bounds)
2013-05-02 21:50:48 -07:00
Daniel Marjamäki
9f8ce6f77f
Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name)
2013-04-19 18:36:16 +02:00
PKEuS
cf5d8fa3df
Use Token::link() instead of Token::findClosingBracket() whereever possible
2013-04-15 13:48:28 -07:00
Daniel Marjamäki
a49fc57e00
Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697
2013-04-11 07:19:32 +02:00
XhmikosR
8ac9b8e7a9
remove duplicate ";" and fours dots
2013-04-09 17:49:09 +02:00
PKEuS
fd7c90f68d
Forgot to commit a file in eb2962792f
.
2013-04-04 10:57:35 -07:00
PKEuS
188096665c
Implemented support for rvalue references (C++11):
...
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.
Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Daniel Marjamäki
2d70af2c82
Reverted fix. It might be possible to make a better fix
2013-03-25 19:55:35 +01:00
Daniel Marjamäki
2b02013fa7
Fixed #4668 (False positive: uninitialized Variable after unknown macro)
2013-03-25 19:52:33 +01:00
Daniel Marjamäki
cc3139cf39
Tokenizer: Fixed 'variableScope' message.
2013-03-18 19:32:40 +01:00
Daniel Marjamäki
1b18bfc93c
Fixed #3585 (errors not recognized when class has extra specification)
2013-03-18 19:09:04 +01:00
Robert Reif
c600479c20
Symbol database: Tweaked debug printing of unknown types
2013-03-15 06:48:57 +01:00
PKEuS
796c3e101f
Implemented better fix for #4644
2013-03-12 08:05:03 -07:00
PKEuS
b3a9ac5c3b
Fixed #4644 : Don't assign varid to template parameter when 'typename' is used
2013-03-10 06:11:25 -07:00
Daniel Marjamäki
1f40af2ae2
Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining))
2013-03-09 17:55:49 +01:00
PKEuS
99a73fe1d3
Don't assign a varid to a variadic function
2013-03-05 08:32:52 -08:00
PKEuS
d49f4a611a
Reduced code duplication in tokenizer
2013-03-02 09:19:53 -08:00
PKEuS
bf9aa102f2
Fixed possible nullptr dereference warning
2013-03-01 03:53:47 -08:00
PKEuS
0105f8223c
Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
...
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS
f899e6ca30
Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op%
2013-03-01 02:43:59 -08:00
PKEuS
670c4de8a9
Changed behaviour of Token::is*Op() functions:
...
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
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