Daniel Marjamäki
6bb8dd605a
assign function parameters: only show warning when --enable=warning or --enable=style is used. Ticket: #2930
2013-02-02 15:08:43 +01:00
Daniel Marjamäki
cbbb582fc9
Fixed #2930 (new check: redundant assignment of pointer function parameter)
2013-02-01 19:16:17 +01:00
Daniel Marjamäki
a04f7b1a94
CheckNullPointer::isPointerDeRef: Refactoring - use tok->variable(). Ticket: #4535
2013-02-01 19:10:14 +01:00
Robert Reif
1a58ae4994
Symbol database: handle when forward declaration doesn't match declaration. Ticket: #4531
2013-02-01 06:31:02 +01:00
Robert Reif
94c953931d
Simplify checks by caching symbol database Variable pointer in Token
2013-01-31 20:08:48 +01:00
Daniel Marjamäki
e2faed355b
Fixed #4485 (False positive: Same expression of '-' when checking if float is inf)
2013-01-31 17:29:31 +01:00
Daniel Marjamäki
bd7e3cbac5
Fixed #4540 (memory leak not detected ('.' or '->' is used before Function))
2013-01-31 17:00:50 +01:00
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Daniel Marjamäki
fc42aa3a30
Fixed #4523 (false positive: (error) Possible null pointer dereference)
2013-01-30 16:52:12 +01:00
Daniel Marjamäki
bc6d31c7c7
unsigned division: don't warn about 'unsigned char' because it is promoted to int.
2013-01-30 16:50:12 +01:00
Daniel Marjamäki
509dd9a989
Fixed #4523 (false positive: (error) Possible null pointer dereference)
2013-01-29 17:12:14 +01:00
Daniel Marjamäki
3679a809dd
Uninitialized variables: fixed false positive
2013-01-28 18:08:20 +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
Daniel Marjamäki
42dd956dff
Preprocessor: Better fix for hangs. And added proper unit test.
2013-01-27 02:53:29 +01:00
Robert Reif
a0d8fd26fe
SymbolDatabase: improved handling of const in function parameters
2013-01-27 02:46:00 +01:00
Daniel Marjamäki
6238db3a78
Preprocessor: Fix hang
2013-01-26 19:11:58 +01:00
Daniel Marjamäki
9313f7aa79
Preprocessor: Fix. Ticket: #4516
2013-01-26 18:45:18 +01:00
Daniel Marjamäki
f69b1f426e
Preprocessor: Improved handling of expressions in simplifyVarMap. Ticket: #4516
2013-01-26 16:21:33 +01:00
Daniel Marjamäki
641e7cba28
Fixed #4516 (Preprocessor: wrong #if evaluation)
2013-01-26 12:37:46 +01:00
Daniel Marjamäki
8738223e82
Fixed #4512 (Improve check: Uninitialized variable not detected)
2013-01-26 08:16:53 +01:00
Daniel Marjamäki
04ceae7ea7
Uninitialized variables: minor refactorings
2013-01-26 07:28:11 +01:00
Daniel Marjamäki
ae43b12bf1
Fixed #4511 (False positive: uninitialized struct member)
2013-01-25 18:20:57 +01:00
Robert Reif
3b08b410a2
Symbol database: Improved function lookup (a.b.f()). Ticket: #4494
2013-01-25 06:49:04 +01:00
Daniel Marjamäki
c235737b6c
Uninitialized variables: improved checking of loops
2013-01-24 19:41:15 +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
Erik Lax
569b2ae9cd
Fixed #4505 (test/testtokenize.cpp: Assertion failed in 'make check')
2013-01-23 18:27:28 +01:00
Robert Reif
cecd726b11
Symbol database: Improved function lookup for foo.f(). Ticket #4494
2013-01-23 16:53:55 +01:00
Daniel Marjamäki
683c8adb74
TokenList: Handle #line better. Ticket: #4505
2013-01-23 07:04:45 +01:00
XhmikosR
645126fb8e
remove double trailing semicolons
2013-01-23 06:48:21 +01:00
Daniel Marjamäki
f86e83d813
Memory leaks: Improved handling of allocation functions that contains ::. Ticket: #4494
2013-01-22 21:33:39 +01:00
Erik Lax
444f80c4bb
Fixed #4505
2013-01-22 13:49:54 +01:00
Thomas Jarosch
f97015e244
Don't use Token::Match() for simple string comparison
2013-01-22 13:16:23 +01:00
Robert Reif
ddb604d1a5
Symbol database: function lookup when :: is used. Ticket #4494
2013-01-22 06:55:25 +01:00
Edoardo Prezioso
f68d6f7c95
Standards: remove useless semicolon after function
2013-01-22 00:13:36 +01:00
Frank Zingsheim
096cb1bd88
Fixed #3686 : false positive: Possible null pointer dereference (inconclusive)
2013-01-21 19:38:59 +01:00
Daniel Marjamäki
bfafd51ca1
Fixed #4470 (New check: redundant bitand 'x&=1; x&=2;' can be simplified to 'x=0;')
2013-01-21 19:59:34 +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
76534ccd1b
Uninitialized struct member: Fixed false negatives for return statements
2013-01-20 17:54:32 +01:00
Daniel Marjamäki
d33341a21a
Fixed #4502 (Preprocessor: Treat SystemInclude and UserInclude the same)
2013-01-20 14:42:04 +01:00
Daniel Marjamäki
e63f2c3b5b
Uninitialized struct member: Avoid false positive when struct member is passed by address
2013-01-20 13:12:40 +01:00
Daniel Marjamäki
67c9720299
Tokenizer: fixed simplification of static constants
2013-01-19 21:14:15 +01:00
Daniel Marjamäki
6d5532980e
Tokenizer: Set proper variable ID when simplifying return statement. Ticket: #3500
2013-01-19 13:42:54 +01:00
Daniel Marjamäki
bff6ed7af0
Fixed #3500 (false negative: (error) Returning pointer to local array variable)
2013-01-19 13:39:23 +01:00
Daniel Marjamäki
f1c195e652
Fixed #3506 (false negative: not initialized variables ( struct timeval))
2013-01-19 12:48:56 +01:00
Thomas Jarosch
7c4f0e594b
astyle formatting
2013-01-19 11:49:35 +01:00
Daniel Marjamäki
3cf0e88fbe
Uninitialized struct members: Improved checking when struct member is used in expression
2013-01-19 10:09:58 +01:00
Zachary Blair
8647e4c0d0
Fixed a false positive in #4109 (if (c == 1) c == 0; Isn't picked up)
2013-01-18 16:34:15 -08:00
Daniel Marjamäki
7c615f0f12
Fixed #4497 (False positive: uninitialized struct (writing/reading member))
2013-01-18 21:26:28 +01:00
Zachary Blair
a1cbed3df8
Fixed #4109 (if (c == 1) c == 0; Isn't picked up)
2013-01-17 23:03:04 -08:00
Daniel Marjamäki
c59dab2738
uninitialized struct member: changed severity from warning to error since it is UB
2013-01-17 23:18:37 +01:00
Daniel Marjamäki
2c6b383822
Uninitialized member variables: Improvements
2013-01-17 21:04:22 +01:00
Daniel Marjamäki
e32ab4bf65
uninitialized struct members: improved fix
2013-01-17 17:21:21 +01:00
Daniel Marjamäki
93fb6b0c6a
Fixed #4493 (FP: uninit struct member (struct is assigned))
2013-01-17 17:01:04 +01:00
Thomas Jarosch
b1eec7c6b7
Small refactoring to compile more matches
...
*** Timing of the test suite ***
Four runs were used to calculate the average run time.
Before: ~1,103s
After: ~1,066s
Speed up: 3,35%
*** Timing of internal projects using STL ***
Before: ~8,301s
After: ~8,207s
Speed up: 1,13%
So the real world speed up is roughly 1%.
2013-01-17 10:26:03 +01:00
Thomas Jarosch
c8b619ef86
Let the match compiler catch some more patterns
2013-01-16 22:05:28 +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
Daniel Marjamäki
5773e69ab1
Uninitialized variables: Add experimental checking of struct members
2013-01-16 20:28:29 +01:00
Daniel Marjamäki
4cd8c7c608
Merge pull request #128 from acmyo/master
...
Fix compiler warnings and comment/string typos
2013-01-16 08:00:59 -08:00
Daniel Marjamäki
0fb2d309a6
Fixed #4490 (False positive: unused function (function pointer is taken in global scope))
2013-01-16 16:52:57 +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
Daniel Marjamäki
78f3c5f772
Unused functions: Fixed invalid pattern match
2013-01-16 06:43:19 +01:00
Daniel Marjamäki
27eedcd0a3
Merge pull request #127 from rofl0r/master
...
sanitize the descriptive text displayed for "varFuncNullUB"
2013-01-15 21:34:03 -08: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
Thomas Jarosch
5c8b05ce94
Use Token::simpleMatch() for simple pattern
...
"internal" check reported:
[lib/symboldatabase.cpp:945]: (warning) Found simple pattern inside Token::Match() call: "> ("
2013-01-15 20:34:11 +01:00
Daniel Marjamäki
2fa35a6f8d
Fixed #4429 (unused functions: handle function declarations better)
2013-01-15 17:00:28 +01:00
rofl0r
de72ae9f45
sanitize the descriptive text displayed for "varFuncNullUB"
2013-01-14 18:11:16 +01:00
Daniel Marjamäki
d46789ee4a
varFuncNullUB: fixed false positive when non-variadic argument is NULL ( #4482 )
2013-01-14 06:44:52 +01:00
Erik Lax
723d95597b
Fixed #4481 (Simplify %str% [ %num% ])
2013-01-13 20:52:38 +01:00
Daniel Marjamäki
f0ce26a2aa
Preprocessor: Let the Tokenizer handle NULL
2013-01-13 15:01:31 +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
Erik Lax
b538c50856
Fixed #4484 (1.58: new crash for linux kernel code)
2013-01-13 07:57:46 +01:00
PKEuS
c62233643a
Set version to 1.59 dev
2013-01-12 17:49:09 +01:00
Daniel Marjamäki
3057078571
1.58: Set versions
2013-01-12 14:49:58 +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
Zachary Blair
309edbbdc5
Fixed #4389 (False positive: Possible null pointer dereference if the default parameter value is used)
2013-01-09 23:22:54 -08:00
Edoardo Prezioso
6236e1dc38
Token::Match: removed harmless special code for initial '!!foo' patterns.
2013-01-09 20:13:33 +01:00
Thomas Jarosch
33619de072
Revert "Change location of %op% operator in multicompare"
...
It's no longer needed with the proper fix for Token::Match().
This reverts commit 8b2adf1391
.
2013-01-09 17:06:04 +01:00
Thomas Jarosch
7dd07d8e77
Properly implement %op% for Token::multiCompare
...
Use tok->isOp() instead of doing it "manually".
This fixes false positives for the C++ template case since
the brackets in "template < something >" are not comparison operators.
Profiling showed using tok->isOp() is actually faster than before (-O2).
2013-01-09 17:05:53 +01:00
Thomas Jarosch
8b2adf1391
Change location of %op% operator in multicompare
...
When the %op% operator is the first element
of a multicompare, it properly executes Token::isOp().
Otherwise it uses it's "internal implementation".
Workaround inspired by Edoardo Prezioso.
2013-01-08 20:26:48 +01:00
Frank Zingsheim
498d03458f
Fixed #4385 : lock_guard RAII throws unreadVariable
2013-01-07 20:28:43 +01:00
XhmikosR
049c995c99
version.h: update copyright year
2013-01-07 19:53:32 +01:00
Daniel Marjamäki
eebfea2b23
Fixed #4381 (Inline type declaration on statics causes warning)
2013-01-07 19:20:15 +01:00
Zachary Blair
f3c3b7c910
Fixed #4405 (False positive: Memory in freed twice (throw))
2013-01-05 19:02:19 -08:00
PKEuS
f5ebbff0a3
Fixed #4460 : Ensure that memset/memcpy is called on a pointer to a class instance.
2013-01-05 12:27:55 -08: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
Robert Reif
d37906041b
Fixed #4458 (False positive: noCopyConstructor in template class)
2013-01-04 10:35:24 +01:00
Thomas Jarosch
7f0bc73e8e
Simple constification (needed by the match compiler)
2013-01-04 03:17:52 +01:00
Edoardo Prezioso
c9fb7f529d
Use more Effective C++ code style in SymbolDatabase class:
...
1)The SymbolDatabase::findScope code is moved to the const-version. The non-const version is reimplemented as the combination with const_cast and static_cast.
2)Unrelated: change style of the declaration of some functions (the '*' is moved near the function name).
2013-01-04 01:19:17 +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
Daniel Marjamäki
70059c06de
Fixed #4456 (std::string::compare(char const*) crash)
2013-01-03 08:44:32 +01:00
Daniel Marjamäki
6e58ed3040
Fixed #4454 (False positive: class member (POD) not initialized (when initialized to 0 in initializer list))
2013-01-02 13:59:57 +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
Robert Reif
d2e8ab9c86
Fixed #4302 (Member variable not initialized in public delegate constructor)
2013-01-01 09:53:40 +01:00
Edoardo Prezioso
6612952dd4
Use 'simple' matching with normal patterns.
2012-12-31 13:30:06 +01:00
Daniel Marjamäki
bf169e0c59
Replaced %name% with %type%
2012-12-31 10:45:37 +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
dde4cc39e5
astyle formatting
2012-12-29 17:13:54 +01:00
Daniel Marjamäki
4d085dd3fd
Fixed #4316 (False positive: (constStatement) Redundant code)
2012-12-29 17:13:06 +01:00
Daniel Marjamäki
e7aa1ec396
Fixed #4411 (Variable is assigned a value that is never used.)
2012-12-29 12:45:37 +01:00
Daniel Marjamäki
8491df31ca
Merge pull request #126 from SimonKagstrom/for-upstream
...
Misc fixes for the --include= option
2012-12-28 23:58:14 -08: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
38d1b064e8
Symbol database: Add support for unnamed array arguments to functions ( #4444 )
2012-12-29 08:32:43 +01:00
Robert Reif
07d118dee5
Fixed #4449 (segfault in CheckClass::initializeVarList())
2012-12-29 08:30:14 +01:00
Thomas Jarosch
1f87c6d669
Fix crash on empty brackets
...
Relevant parts from the backtrace:
2012-12-28 20:16:51 +01:00
Daniel Marjamäki
1769240e15
Fixed #4022 (false positive: (style) Variable 'sort_entry' is assigned a value that is never used)
2012-12-28 18:18:36 +01:00
Robert Reif
5ba2a300af
Symbol database: Improved handling of array arguments ( #4444 )
2012-12-28 16:28:29 +01:00
Simon Kagstrom
95b51d02c9
path: Add getPathFromFilename (returns the path part of a filename)
...
E.g.,
/tmp/a.h -> /tmp/
a.h ->
etc.
2012-12-28 12:44:26 +01:00
Simon Kagstrom
350f86fb6a
preprocessor: Kill commented out code
2012-12-28 12:43:43 +01:00
Simon Kagstrom
1e4288fe2e
preprocessor: Don't access empty lists
...
libc aborts with:
/usr/include/c++/4.4/debug/list:256:error: attempt to access an element in
an empty container.
Objects involved in the operation:
sequence "this" @ 0x0xbfffe5f0 {
type = NSt7__debug4listISsSaISsEEE;
}
otherwise.
2012-12-28 12:43:43 +01:00
Daniel Marjamäki
de2c133f6a
Fixed #4426 (False positive: Unitialized variable warning when comparing addresses)
2012-12-28 12:32:15 +01:00
Daniel Marjamäki
6770cc80be
Uninitialized variables: Added debug warning for bailout
2012-12-28 11:42:50 +01:00
Thomas Jarosch
78316f02b6
Fix comment about wrong magic number
2012-12-28 11:31:50 +01:00
Thomas Jarosch
4708be09f5
Fixed #4444 (segmentation fault)
2012-12-28 11:15:18 +01:00
Robert Reif
bd2f59bdf0
Fixed #4442 (crash of cppcheck while scanning gcc-testsuite (invalid code))
2012-12-28 08:36:20 +01:00
Daniel Marjamäki
b914466285
Uninitialized variables: fixed false positives by bailing out when variable is conditionally initialized and then there is a conditional return.
2012-12-27 18:45:00 +01:00
Daniel Marjamäki
bf9b900c30
Tokenizer::setVarId: Fixed problem with initializer lists ( #4436 )
2012-12-27 18:15:00 +01:00
Robert Reif
a43ae677d7
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-27 17:21:30 +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
Daniel Marjamäki
7368079949
Fixed Cppcheck self-check message
2012-12-27 17:11:22 +01:00
Daniel Marjamäki
57488db9da
Preprocessor: Reduce variable scope
2012-12-27 17:00:59 +01:00
Daniel Marjamäki
0585588fc7
astyle formatting
2012-12-27 16:59:30 +01:00
Simon Kagstrom
ef28bde3e4
Fixed #4408 (Force inclusion of files (a la -include /.../ in GCC))
2012-12-27 16:52:31 +01:00
Daniel Marjamäki
2e0a9c4b33
Fixed #4434 (false positive: (style) Mismatching assignment and comparison, comparison 'pen!=-1' is always true.)
2012-12-27 15:40:00 +01:00
acm4me
7da155c8ba
Support for Sun Studio C++ compiler
2012-12-27 11:51:12 +01:00
Daniel Marjamäki
bfb82fe3e1
Cppcheck: Show single 'too many configurations' message if --enable=information hasn't been used and there are too many configurations.
2012-12-26 18:35:49 +01:00
Daniel Marjamäki
b3301a9ef9
Fixed #4433 (Wrong array size for string with \0)
2012-12-26 12:10:09 +01:00
Robert Reif
ce380301fd
Fixed #4432 (Crash on parsing PHP interpreter)
2012-12-26 08:29:10 +01:00
Daniel Marjamäki
f127d56719
Null pointer: Fixed FP when there are 'return p?p->x:0;'
2012-12-25 14:23:50 +01:00
Daniel Marjamäki
f16c30248a
Uninitialized variables: fixed FP when there are function calls where type* is converted to unknown_type
2012-12-25 14:05:29 +01:00
Daniel Marjamäki
f381058293
Uninitialized variables: fixed FP when there are suspicious function calls where type** is converted to type*
2012-12-25 13:58:15 +01:00
Daniel Marjamäki
bcc5a82b1d
Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement
2012-12-25 13:31:54 +01:00
Daniel Marjamäki
db123c2c9b
Fixed #4431 (FP: Erroneous 'Ineffective call of function empty()' in ?: test)
2012-12-25 12:50:38 +01:00
Daniel Marjamäki
299c1bb208
Uninitialized variables: handle unsimplified labels better
2012-12-25 10:37:21 +01:00
Daniel Marjamäki
db2a129557
Tokenizer: Improved handling of '\0' in strings
2012-12-25 08:56:12 +01:00
Daniel Marjamäki
83da4125e3
Uninitialized variables: Better value flow analysis. Fixed false positives.
2012-12-24 19:11:13 +01:00
Daniel Marjamäki
31297cf7d3
Opposite inner conditions: Clean up copy/pasted code
2012-12-24 12:21:48 +01:00
Daniel Marjamäki
b39afb2cf9
Revert "Fixed #4419 (False positive: Class does not have a constructor)"
...
This reverts commit 9a79961b6c
.
There is a segmentation fault when checking lib/preprocessor.cpp
2012-12-24 07:46:55 +01:00
Robert Reif
9a79961b6c
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-24 06:46:30 +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
Daniel Marjamäki
0b4da3d5cd
Uninitialized variables: Fixed false positives when variable x is given a nonzero value when variable y is uninitialized.
2012-12-23 16:27:04 +01:00
Daniel Marjamäki
9e58714bb1
Cppcheck: Only show 'Too many configurations' and 'Interrupted checking' information messages when information severity is enabled
2012-12-23 08:23:52 +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
7f6a10599b
Fixed #4262 (Small Request/Suggestion for checks on array size of args (bounty offer))
2012-12-22 09:23:34 +01:00
Daniel Marjamäki
365a260ddc
Fixed #4398 (False negative: out of bounds (for loop))
2012-12-22 08:00:05 +01:00
Robert Reif
80848c6e0e
Fixed #4383 (Improve check: uninitialized member variable not detected when initialization is not proper)
2012-12-21 19:36:45 +01:00
Daniel Marjamäki
2050cd71db
Uninitialized variables: Better testing of function handling
2012-12-21 19:32:56 +01:00
Daniel Marjamäki
dc6aa92f3b
Uninitialized variables: warn about structs in C code
2012-12-21 18:50:38 +01:00
Daniel Marjamäki
cf84c211ed
Uninitialized variables: Improved handling of function calls
2012-12-21 17:04:15 +01:00
Daniel Marjamäki
415ee977d8
Uninitialized variables : fixed false positives when passing address of pointer to function.
2012-12-21 16:57:49 +01:00
Daniel Marjamäki
7e8019e474
Fixed #4403 (False positive 'Conversion of string literal <string> to bool always evaluates to true.' with BOOST_ASSERT)
2012-12-20 20:48:48 +01:00
Daniel Marjamäki
ccdea4dc2b
Uninitialized variables: Improved checking of functions
2012-12-20 19:45:30 +01:00
PKEuS
d82048f5f5
Fixed compiler error in VS10
2012-12-20 04:03:36 -08:00
Robert Reif
bb2a15c140
Symbol database: Better handling of 'using namespace N;'. Ticket: #4412
2012-12-20 06:53:04 +01:00
Daniel Marjamäki
3913fd8398
Fixed #4320 (False positives 'unassignedVariable' and 'uninitvar')
2012-12-18 19:02:30 +01:00
Daniel Marjamäki
1e2fb4f1a4
Unused var: Limit bailout for foreach loops. Only bailout if name contains 'foreach' or 'for_each'. Only bailout variables that are used more than once in the body. Ticket: #4155
2012-12-17 18:19:05 +01:00
Daniel Marjamäki
72ea94bf75
Fixed #4155 (false positive: Variable is assigned a value that is never used (inside BOOST_FOREACH loop))
2012-12-17 17:07:56 +01:00
Daniel Marjamäki
a84d21f271
CheckMemoryLeaksInFunction: Fixed problems with catch and function calls. Ticket: #4405
2012-12-16 18:06:40 +01:00
Daniel Marjamäki
bca7927913
AST: generate tree from bottom and upwards
2012-12-16 11:48:19 +01:00
Daniel Marjamäki
aad3a041ad
AST: Handle function calls
2012-12-16 10:06:55 +01:00
Daniel Marjamäki
1ad9c933ec
AST: Improved handling of unary operators
2012-12-16 08:41:04 +01:00
Robert Reif
6732f05b95
Fixed #4404 (Forward declared class cause false style warning about missing constructor)
2012-12-16 07:18:03 +01:00
Daniel Marjamäki
fa8e5cd7d8
AST: Simple AST. Not used in the clients. Only part of the testing for now.
2012-12-15 20:21:09 +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
Robert Reif
5a7ede2563
Fixed #4391 (False positive: ctor not detected after variable declaration)
2012-12-10 06:01:29 +01:00
Frank Zingsheim
327db15284
Fix #4045 : memory leak not reported after usage of " + p[]"
2012-12-09 08:59:21 +01:00
Daniel Marjamäki
927a6e4794
Obsolete functions: removed 'ctime' warning. The function is obsolete but the message don't point out a good replacement nor where it's documented that this function is obsolete
2012-12-09 09:35:57 +01:00
PKEuS
410c0f98d9
Refactorized CheckObsoleteFunctions:
...
- Speedup checkobsoletefunctions by using symboldatabase and by not calling SymbolDatabase::findFunctionByToken() for each function call.
-> Benchmark (SQlite amalgamation):
CheckObsoleteFunctions::runSimplifiedChecks(): 9s -> 0,016s (562%, 4% on entire runtime)
- Fixed false negative when passing function result as parameter
2012-12-08 02:46:30 -08:00
PKEuS
578e582987
Fixed regression #4368 .
2012-12-08 00:26:10 -08:00
PKEuS
068c695bd1
Fixed false positive when ternary operator is used: case A&&B?B:A:
2012-12-07 12:44:30 -08:00
PKEuS
0ac4c3baf4
New check: Find suspicious case labels like 'case A||B:'
2012-12-07 12:27:32 -08:00
PKEuS
65db8b8b9f
Fixed #4229
2012-12-07 11:45:20 -08:00
Edoardo Prezioso
0273c183a7
Run astyle and update the translation files.
...
I believe we need a hook script because else everytime we change a file we have to make a new commit to fix the discrepancies problems.
2012-12-07 01:49:51 +01:00
Robert Reif
63b585424d
Fixed #4386 (False positive: ctor not detected)
2012-12-05 20:31:17 +01:00
Frank Zingsheim
b99d3f0767
Style change: Fixed #4369 (false positive: Variable 'i' is assigned a value that is never used)
...
based on aebdb3769f
due to comment in aebdb3769f
2012-12-05 20:18:14 +01:00
Frank Zingsheim
aebdb3769f
Fixed #4369 (false positive: Variable 'i' is assigned a value that is never used)
2012-12-04 21:39:51 +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
Daniel Marjamäki
b08ba5b575
Preprocessor: Refactoring previous fix
2012-12-02 20:17:25 +01:00
Daniel Marjamäki
cb06d07ae7
Fixed #4351 (Escaped whitespace gives wrong error)
2012-12-02 18:04:19 +01:00
Daniel Marjamäki
15ef6bb32f
Fixed #4382 (Use of alloca causes VLA recommendation in C++)
2012-12-02 11:39:26 +01:00
Daniel Marjamäki
bf91454136
Fixed #4224 (False positive: Comparison of a boolean with an integer (neglecting a cast))
2012-12-02 08:34:30 +01:00
Daniel Marjamäki
dba51c906e
cleanup: removed redundant insideLoop assignment in checkunusedvar. Thank you zingsheim for the suggestion
2012-12-02 07:28:05 +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
45a16baaa0
Token: try to improve speed of multicompare macro.
2012-12-01 23:58:01 +01:00
Edoardo Prezioso
f6c23fa1e7
runastyle and fix checkInternal messages.
2012-12-01 03:17:55 +01:00
Edoardo Prezioso
9ce6630b28
Add some unused private copy ctors and operator=.
...
In Token and in Check classes, GCC -Weffc++ reports that it's better to override the copy constructors and the assignment operator to avoid problems with copied objects which could have the same pointers, hence with double frees, when we delete one of these pointers in the copied and in the original object.
2012-12-01 02:17:46 +01:00
Edoardo Prezioso
f42ab9871d
Fix build breakage in recent commits.
2012-12-01 02:02:45 +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
aeb4531a58
Token::Match: add a new pattern: '%comp%'.
...
Token::Match returns true if the token is a comparison operator. It's equivalent to matching '<|<=|==|!=|>=|>' and the tests show that the new pattern speeds up the program execution. Added the new pattern in CheckInternal (and also reordered the %cmd% lists) and in TestToken.
2012-12-01 00:55:24 +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
45b77554ea
Fixed #4308 (C++11 raw string literals not parsed correctly)
2012-11-30 13:46:46 +01:00
PKEuS
bcb4410dae
Fixed invalid function in symboldatabase causing endless recursion (VS10 warning) by const_cast
2012-11-30 02:25:40 -08:00