PKEuS
87e19d2552
Refactorized check for dead pointers after throw:
...
- Less bailouts for inconclusive checking
- Support for static variables
- Changed severity to warning (error is not certain)
2012-01-21 19:11:06 +01:00
Edoardo Prezioso
b0dac2fa2e
Tokenizer::copyTokens: add optional parameter which preserve the line number differences between tokens to be copied.
2012-01-21 17:18:16 +01:00
Ahti Legonkov
78461093f0
Fixed #3531 (When macro definition contains parenthesis, the #defined symbol does not get #defined.)
2012-01-21 12:51:54 +01:00
PKEuS
96ae010e48
- Correctly set Scope::function variable in symboldatabase
...
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
Zachary Blair
0415444e28
Merge branch 'master' of github.com:danmar/cppcheck
2012-01-19 23:02:33 -08:00
Zachary Blair
b89adff9fd
Fixed Ticket #3300 (false negative: doublefree of pointer)
2012-01-19 22:59:54 -08:00
seb777
9be2d1cc62
It is a good practice to clear container after deleted all the items
2012-01-19 12:41:14 +01:00
Daniel Marjamäki
525e7fba20
Fixed #3490 (False positive: sscanf with %c)
2012-01-18 23:57:08 +01:00
Stefan Weil
7607e4c68d
Fixed #3519 (Wrong line number in warning charBitOpError)
2012-01-18 13:09:46 +01:00
seb777
0be8af5214
Fix ticket #3530 (Add some windows data types to tokenizer)
2012-01-18 12:57:41 +01:00
Edoardo Prezioso
9019190a37
Tokenizer: various improvements to code.
2012-01-17 11:51:11 +01:00
Edoardo Prezioso
40739eb3fb
Reverted some changes in commits 4b05c3e19f
and 4b08b13845
.
2012-01-16 11:44:31 +01:00
Edoardo Prezioso
4b05c3e19f
Tokenizer::simplifyIfAddBraces: improve comments; handle independently 'a = { .. };'; reduce use of 'Token::(simple)Match' functions.
2012-01-15 19:53:11 +01:00
Edoardo Prezioso
4b08b13845
Tokenizer: reduce usage of Token::Match in some cases.
2012-01-15 15:00:52 +01:00
Edoardo Prezioso
963f6ce3ef
Tokenizer: report syntaxError if there's nothing after 'if|for|while ()' and if there's nothing inside round brackets;
...
TestTokenizer: change test cases accordingly;
TestSimplifyTokens: ditto.
2012-01-15 14:50:01 +01:00
Daniel Marjamäki
a6d96f5b72
Fixed #3496 (false positive: syntax error)
2012-01-15 14:33:53 +01:00
PKEuS
461565c50a
Fixed #3517 and #3513
2012-01-15 12:32:02 +01:00
PKEuS
c294b15360
Removed more indendation counters.
2012-01-15 12:31:49 +01:00
Daniel Marjamäki
d891d1ce5d
Fixed segfault in TestTokenizer::cpp0xtemplate3
2012-01-15 12:14:47 +01:00
Daniel Marjamäki
7e3735988d
TemplateSimplifier : Fixed bug in recent commit.
2012-01-15 11:58:07 +01:00
Edoardo Prezioso
4399fca769
Code style: Use 'linkAt' instead of 'tokAt(..)->link'.
2012-01-14 15:21:45 +01:00
Reijo Tomperi
dd18f595b1
Fix #3516 (inaccurate warning: "An unsigned variable will always be positive" (unsigned n; if (n >=0);))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3516
2012-01-14 12:50:09 +02:00
Edoardo Prezioso
6a248c35b5
Fixed ticket #3512 (segmentation fault of cppcheck ( 1 *p = const))
2012-01-14 00:43:58 +01:00
Edoardo Prezioso
37f3aa1528
Fixed ticket #3486 (segmentation fault of cppcheck)
2012-01-13 23:53:53 +01:00
Daniel Marjamäki
0648b3ed5e
Fixed #3504 (segmentation fault of cppcheck)
2012-01-13 07:57:12 +01:00
Daniel Marjamäki
47716ee4ca
Fixed #3497 (False positive: Uninitialized variable)
2012-01-13 07:26:56 +01:00
seb777
8754caa36d
Fix ticket #3483 (POSIX.1-2008 - obsolete functions)
...
From POSIX.1-2008 specification (see http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html#tag_22_01_01_04 ):
- remove obsolete functions ctime, asctime, rand, tmpnam (non reentrant functions check)
- add obsolete base functions (obsolete functions check):
- rand_r
- tmpnam, tmpnam_r
- utime
- asctime, asctime_r
- ctime, ctime_r
- update unit tests (non reentrant function)
- update messages (cosmetic) (obsolete functions check)
2012-01-12 22:28:12 +01:00
Robert Reif
6f3807d915
add some more windows types
2012-01-10 21:55:24 -05:00
Reijo Tomperi
be7691c7b4
Refactoring: Move rest of the template simplification into TemplateSimplifier
...
simplifyCalculations() was temporarily moved into TemplateSimplifier also, it should be moved to a better place.
2012-01-09 21:33:11 +02:00
Reijo Tomperi
756b8762ab
Catch InternalError by reference instead of creating a copy of it.
2012-01-09 18:30:36 +02:00
Edoardo Prezioso
2dd53ec966
Fixed ticket #3485 (segmentation fault of cppcheck ( {a:1;}; ))
2012-01-09 16:24:11 +01:00
Edoardo Prezioso
54f54761b4
Fixed ticket #3482 (segmentation fault of cppcheck ( switch(){case} ))
2012-01-09 14:37:20 +01:00
Edoardo Prezioso
57fcde8090
Fixed ticket #3481 (segmentation fault of cppcheck)
2012-01-09 13:39:02 +01:00
Edoardo Prezioso
a951d34aa8
Fixed ticket #3480 (segmentation fault of cppcheck)
2012-01-09 12:48:52 +01:00
Reijo Tomperi
194327048a
Add InternalError and change MathLib to throw it in case of an error.
...
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
PKEuS
c273d6d31d
Refactorized checkautovariables.cpp. Removed indendation counters.
...
Fixed #3478
2012-01-08 15:32:22 +01:00
Kamil Dudka
e09b0330e4
Class: Don't warn about uninitialized union members because they are often combined with a second variable
2012-01-08 12:17:55 +01:00
Daniel Marjamäki
65ce55e675
Fixed #3472 (false positive: (error) Passing value 0 to log() leads to undefined result)
2012-01-08 12:07:25 +01:00
Daniel Marjamäki
ee55d3294a
Refactoring. Assume that .C files contain C code on case insensitive filesystems.
2012-01-08 10:34:31 +01:00
Daniel Marjamäki
304980848f
Fixed #3473 (False positive: variable is assigned value that is never used (used in return statement))
2012-01-08 08:44:18 +01:00
Daniel Marjamäki
70c83d9ca9
Fixed #3467 (False positive: Variable is not assigned a value (new))
2012-01-08 08:31:00 +01:00
Reijo Tomperi
3c0ada52e6
Refactoring: Extract sizeof simplifying from template simplifying
2012-01-08 00:21:12 +02:00
Reijo Tomperi
93e3e7361e
In unix .C is considered C++. Changed isC() and isCPP() to work like they were before refactoring.
2012-01-07 10:47:15 +02:00
Daniel Marjamäki
6a63104743
Fixed #3320 (False positive: Member variable is not initialized in the constructor (namespaces).)
2012-01-07 09:28:26 +01:00
Daniel Marjamäki
a5264f6395
Symbol database: dump if --debug and --verbose is given
2012-01-07 08:21:34 +01:00
Reijo Tomperi
2a79399a53
astyle fix
2012-01-06 21:57:59 +02:00
Reijo Tomperi
e91d239ea5
Refactor: Move file extension checks from Tokenizer to Path class. This has also functional change as now also file.JAVA is considered a Java file.
2012-01-06 21:56:28 +02:00
PKEuS
8378153669
Fixed missing include
2012-01-06 18:11:06 +01:00
Daniel Marjamäki
de4a64332e
Refactoring: Copy FileLister::acceptFile to Path::acceptFile. Use Path::getFilenameExtension and Path::acceptFile in Tokenizer. Use Path::acceptFile in CppCheck::processFile instead of hardcoded handling.
2012-01-06 17:31:10 +01:00
Daniel Marjamäki
9a102702cb
Refactoring: Disable debug warnings when file extension is neither .c nor .cpp. To somewhat prevent that people fix java/c# specific debug warnings.
2012-01-06 16:08:08 +01:00
Edoardo Prezioso
05f16a25af
Fixed ticket #2405 (debug messages provide incorrect file:line information)
2012-01-06 15:15:52 +01:00
Daniel Marjamäki
bd8c21fc6b
Refactoring: Made Preprocessor::simplifyCondition nonstatic
2012-01-06 08:42:07 +01:00
Daniel Marjamäki
66472b09c0
Refactoring: Made Preprocessor::match_cfg_def nonstatic
2012-01-06 08:15:48 +01:00
Daniel Marjamäki
e4875178fa
Refactoring: Removed redundant settings parameter for Preprocessor::removeComments
2012-01-06 08:09:53 +01:00
Daniel Marjamäki
94d220e370
Refactoring: Made Preprocessor::getcode nonstatic
2012-01-06 08:01:50 +01:00
Reijo Tomperi
eda04ad906
Refactoring: Move template code into templatesimplifier: simplifyTemplatesExpandTemplate()
2012-01-05 22:45:19 +02:00
Daniel Marjamäki
07776e90ad
Preprocessor: cleanup
2012-01-05 18:37:15 +01:00
Daniel Marjamäki
c5f62c19d6
astyle formatting
2012-01-05 18:24:27 +01:00
Daniel Marjamäki
56a5e08f6b
Use symbol database dump code written by Robert Reif. The symbol database is dumped if --debug is used.
2012-01-05 18:22:54 +01:00
Edoardo Prezioso
a7029291fd
Tokenizer::simplifyGoto: process also derived class/structs.
2012-01-04 17:08:53 +01:00
Edoardo Prezioso
b0e4dc3ab8
Refactoring: replace forgotten code with function call 'simplifyRedundantConsecutiveBraces'.
2012-01-04 16:47:36 +01:00
Edoardo Prezioso
6f9cd110d0
Improve Tokenizer: improve 'simplifyDoublePlusAndDoubleMinus' when there are negative numbers.
2012-01-04 13:45:27 +01:00
Edoardo Prezioso
75fbe310ff
Extract various functions inside the Tokenizer class and fix tokenization of 'return __LINE__ ;'.
2012-01-04 12:57:58 +01:00
PKEuS
eabdc9082e
Fixed false positives related to %*[] in scanf format string ( #3468 )
2012-01-04 11:22:42 +01:00
Reijo Tomperi
0369681a2c
Refactoring: Move template code into templatesimplifier: simplifyTemplatesGetTemplateNamePosition()
2012-01-03 23:49:50 +02:00
Reijo Tomperi
ac290b1a8a
Refactoring: Move template code into templatesimplifier: simplifyTemplatesUseDefaultArgumentValues(), simplifyTemplatesInstantiateMatch()
2012-01-03 23:35:06 +02:00
PKEuS
756ee800b0
Use std::stack instead of std::vector Tokenizer::createTokens. Removed #pragma warning(disable: 4503)
2012-01-03 11:46:35 +01:00
Edoardo Prezioso
c76f06c01b
Fixed ticket #3447 (Improve void CheckStl::if_find())
2012-01-02 23:12:59 +01:00
Reijo Tomperi
16fb1801e1
Refactoring: Move template code into templatesimplifier: simplifyTemplatesGetTemplateDeclarations(), simplifyTemplatesGetTemplateInstantiations()
2012-01-02 23:05:27 +02:00
Reijo Tomperi
37269d0c28
Refactoring: Move template code into templatesimplifier: simplifyTemplatesExpandSpecialized()
2012-01-02 22:53:13 +02:00
Reijo Tomperi
8084bc80fc
Refactoring: Move template code into templatesimplifier: removeTemplates()
2012-01-02 22:46:43 +02:00
Reijo Tomperi
e9071a8bb6
Refactoring: Move code into templatesimplifier: templateParameters()
2012-01-02 22:43:38 +02:00
Reijo Tomperi
d26bcfe8d5
Refactoring: Move code into templatesimplifier
2012-01-02 22:37:32 +02:00
Daniel Marjamäki
e4f3f91c18
Reverted 9aa8a496
. I don't know why I made this fix.
2012-01-02 19:45:20 +01:00
Edoardo Prezioso
94a2287370
Revert 'using' changes as it was until some time ago.
2012-01-02 19:27:32 +01:00
PKEuS
9c423b82c1
Refactorizations in preprocessor.cpp
2012-01-02 15:52:19 +01:00
PKEuS
621d43e9e4
Fixed #3461 : Support for %m* on scanf-functions
2012-01-02 14:05:58 +01:00
Daniel Marjamäki
906c2b70ac
Fixed #3445 (Problems with lib/standards.h)
2012-01-02 13:36:17 +01:00
PKEuS
08805dd9fe
Fixed compiler errors with GCC
2012-01-02 13:10:35 +01:00
PKEuS
38ddcde7b0
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 12:58:34 +01:00
PKEuS
064e0ea0d0
Revert "- Refactorizations in preprocessor.cpp and tokenizer.cpp"
...
Committing with subversion seems to have issues. Sorry for that. I'll the changes again, now using git.
This reverts commit 69498de6ca
.
2012-01-02 12:10:53 +01:00
Philipp K
69498de6ca
- Refactorizations in preprocessor.cpp and tokenizer.cpp
...
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 03:15:02 -08:00
Daniel Marjamäki
01759b03f9
Fixed #3463 (Uninitialized variable variable pointer)
2012-01-02 11:25:13 +01:00
Daniel Marjamäki
112873e876
Revert "Fixed #3450 (CLI --report-progress is currently useless)"
...
This reverts commit e769fe6294
.
2012-01-02 07:42:39 +01:00
Daniel Marjamäki
e769fe6294
Fixed #3450 (CLI --report-progress is currently useless)
2012-01-02 07:27:45 +01:00
Edoardo Prezioso
b24e6e659e
C# simplification: remove 'using var;' code from the tokenizer.
2012-01-02 00:53:20 +01:00
Edoardo Prezioso
eb657034ba
Handle also C# multidimensional arrays with no specified dimension.
2012-01-02 00:22:45 +01:00
Reijo Tomperi
aa927d5aa3
Refactoring: Add new file lib/templatesimplifier.cpp
...
The plan is to move template simplification into this new class to take some lines from 10 000 line tokenizer.
2012-01-01 22:55:05 +02:00
PKEuS
f4703e026a
Refactoring various issues in cmdlineparser, cppcheckexecutor, check64bit and tokenize.
2012-01-01 21:17:16 +02:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Erik Lax
3d0c1a3301
Fix #3457 (Statement following goto can be executed)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3457
2012-01-01 00:11:03 +02:00
Edoardo Prezioso
38e0e25ce0
Fixed ticket #3448 (segmentation fault of cppcheck).
...
Add testcase related to previous commit (add 'A f(&x);' as declaration of variable).
2011-12-31 21:44:07 +01:00
Edoardo Prezioso
b9c796d9f8
- Re-elaborate 'using' keyword skipping in Tokenizer::setVarId and
...
Scope::getVariableList;
- Improve setVarId: add possible declaration: 'A f(&x);' and change from:
'if (...){}else{ continue; };' to: 'if (!...) continue;';
- Little refactoring of 'Tokenizer::removeTokens()'.
2011-12-31 21:36:19 +01:00
Daniel Marjamäki
8a6b1dc1c9
Fixed #3449 (segmentation fault of cppcheck)
2011-12-31 12:08:49 +01:00
Reijo Tomperi
0e1fb5f75b
astyle fix
2011-12-30 21:01:33 +02:00
Edoardo Prezioso
8f2ad53332
Add testcase for previous commit.
2011-12-30 18:47:42 +01:00
Edoardo Prezioso
0d3bf5340d
Improve varId and getVariableList filter, related to previous commit.
2011-12-30 18:13:42 +01:00
Edoardo Prezioso
8c68b811f3
Fix debug message "Scope::checkVariable found variable '%var%' with varid 0." in C# code with 'using %var%;'.
2011-12-30 13:01:09 +01:00
Edoardo Prezioso
873572d489
Improve C# simplification code with arrays of arrays.
2011-12-30 12:26:28 +01:00
Edoardo Prezioso
d0a3560c92
Rewrite Tokenizer::hasEnumsWithTypedef by using 'findmatch' in order to shorten the code.
2011-12-30 11:38:18 +01:00
Daniel Marjamäki
6a0c463ebd
#3382 (Clarify error message 'invalid deallocation')
2011-12-30 10:32:55 +01:00
Daniel Marjamäki
2ae48c7aef
Fixed #3454 (false positive: (style) Variable 'iFaktor' is assigned a value that is never used)
2011-12-30 09:47:15 +01:00
Reijo Tomperi
65b58bcb99
Partial fix to #3452 (ErrorLogger: complain/raise assertion when error message has extra newlines etc)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3452
Add assert for newlines.
2011-12-30 01:22:16 +02:00
Marek Zmysłowski
dd8316474a
Fixed #3335 (new check: warn about potential missuse of isgraph-like functions)
2011-12-29 08:08:37 +01:00
Daniel Marjamäki
6d98406d71
Fixed #3444 (False positive using putenv)
2011-12-29 07:35:27 +01:00
Reijo Tomperi
90e1a397a2
Refactoring: Remove duplicate function from tokenizer: code_is_c() -> isC()
2011-12-29 00:36:16 +02:00
Reijo Tomperi
614c90b156
astyle fix
2011-12-28 23:57:54 +02:00
Edoardo Prezioso
09bfa66536
Always by pressing request, oops.
2011-12-28 22:51:13 +01:00
Edoardo Prezioso
ec0badb651
By pressing request, extract method: simplifyJavaAndCSharp.
2011-12-28 22:44:53 +01:00
Edoardo Prezioso
f9dd927ff4
Move non-C++ simplification outside big loop.
...
Related to commit b2f8161862
.
2011-12-28 22:12:54 +01:00
Reijo Tomperi
0a588496a0
Fix astyle and test failures.
2011-12-28 22:05:10 +02:00
Edoardo Prezioso
bbac4f1faf
Fix ticket #3451 (A (style) type warning witout message text).
2011-12-28 17:15:04 +01:00
Edoardo Prezioso
b2f8161862
Rewrite fix of ticket #3415 (Segmentation fault in new check for uninitialized variables):
...
new simplify: 'code ; ({ some_code ; });' to 'code ; some_code ;';
remove the sanity check in checkunusedvar, so when it crashes again it's easy to spot a bigger problem;
'internal' reported 'Token::Match' with simple pattern.
'Tokenizer::tokenize()' refactorings:
make one loop with many simple simplifications instead of many loops with one simplification.
some style changes.
2011-12-28 16:55:59 +01:00
Daniel Marjamäki
379440e2a4
CheckNullPointer: Use Tokenizer::IsScopeNoReturn
2011-12-28 08:17:58 +01:00
Daniel Marjamäki
7f42300c18
Null pointer: Removed old code for handling exit(). No testing affected.
2011-12-28 08:07:21 +01:00
Reijo Tomperi
1afd923d34
Fix bug in C# detection code. The test had a bug also, so it was not detected by the test.
2011-12-27 22:50:56 +02:00
Jonathan Neuschäfer
f10d314391
checkmemleak.h: use Tokenizer::isJavaOrCSharp()
2011-12-27 18:01:39 +01:00
Jonathan Neuschäfer
7a5627029f
tokenizer: proper checks for Java and C#
2011-12-27 18:01:39 +01:00
Jonathan Neuschäfer
103588c5bc
Refactoring: tokenizer: factor out fileExtension
2011-12-27 18:01:39 +01:00
Daniel Marjamäki
91874214d8
Refactoring: Added utility function that determine if scope ends with a call to a noreturn function
2011-12-27 18:00:12 +01:00
Daniel Marjamäki
32ed84f4c5
Uninitialized variables: Fixed false positives when using typeof()
2011-12-27 17:03:48 +01:00
Daniel Marjamäki
7c606c4e3b
Uninitialized variables: Fixed false positives for such code: 'if (cond1) { a=0; } if (cond1) { if (cond2) { use_a; } }'
2011-12-27 13:16:16 +01:00
Daniel Marjamäki
987392f254
Tokenizer: Better handling of array of function pointers
2011-12-27 11:56:40 +01:00
Daniel Marjamäki
0bf8e6206c
STL: Fixed false positive when using string::find
2011-12-27 11:02:43 +01:00
Daniel Marjamäki
f6b201bb3b
Uninitialized variables: Fixed false positives when pointer is dereferenced in unexpanded macro
2011-12-27 10:18:49 +01:00
Daniel Marjamäki
9593e14d72
Removed debug variables
2011-12-27 09:27:46 +01:00
Daniel Marjamäki
fdb6ee2ad7
Uninitialized variables: Fix false positives related to for loop
2011-12-27 08:18:05 +01:00
Daniel Marjamäki
5bac8eca37
Uninitialized variables: Fixed false positives (caused by my 'check more variables' commit)
2011-12-26 22:14:52 +01:00
Daniel Marjamäki
5aaec7adc5
Uninitialized variables: Better handling of variable usage in condition
2011-12-26 18:56:40 +01:00
Daniel Marjamäki
59cd099ba7
Uninitialized variables: Fixed false positives caused by recent commit when potentially uninitialized variable is read in condition
2011-12-26 18:32:42 +01:00
Daniel Marjamäki
481fa532a8
Uninitialized variables: Fixed false positives caused by recent improvement when variable is potentially initialized in else block.
2011-12-26 18:17:13 +01:00
Daniel Marjamäki
c56e2e7cf9
Uninitialized variables: Fixed false positives for unconditional inner scopes
2011-12-26 17:52:32 +01:00
Daniel Marjamäki
025518c474
Uninitialized variables: Fixed false positives when goto is used.
2011-12-26 16:46:10 +01:00
Daniel Marjamäki
8eb067358c
Uninitialized variables: check more variables
2011-12-26 14:01:46 +01:00
Daniel Marjamäki
f48edb63a3
Uninitialized variables: Improved checking when there are multiple if/else and a certain path causes an error
2011-12-26 12:36:35 +01:00
Daniel Marjamäki
2d05cae13b
Fixed #3201 (Checking iterators from different objects)
2011-12-26 10:30:39 +01:00
Daniel Marjamäki
fd4bc12ed3
Fixed #3438 (false positive: (style) Variable 'dBuf' is not assigned a value)
2011-12-26 08:12:23 +01:00
Daniel Marjamäki
fd3f384e24
astyle formatting
2011-12-26 07:58:02 +01:00
Daniel Marjamäki
096b22c46e
#3434 (False positive Returning reference to auto variable)
2011-12-26 07:44:16 +01:00
Daniel Marjamäki
385afffb14
Null pointers: show inconclusive errors if functions are called. Assume they won't assign the pointer. Ticket: #3443
2011-12-26 07:13:10 +01:00
Edoardo Prezioso
293437bdfc
Fixed ticket #3416 (segmentation fault of cppcheck)
2011-12-26 03:21:23 +01:00
Reijo Tomperi
e112bfdd47
Refactoring: Rename some variables and funtions in tokenizer.
...
Small logic change also for count variable to make new name more logical.
2011-12-26 00:06:27 +02:00
Daniel Marjamäki
b742c03b65
Fixed #3443 (false positives: possible null pointer dereference (calling unknown function))
2011-12-25 17:01:45 +01:00
Daniel Marjamäki
a4dcf8feea
Fixed #3435 (False positive: (warning) Member variable 'A::m_Vec' is not initialized in the constructor.)
2011-12-25 11:05:06 +01:00
Reijo Tomperi
347982a347
Refactoring: Extract several methods from tokenize()
2011-12-24 23:23:08 +02:00
Reijo Tomperi
8e6ebd4a22
Refactoring: Extract method: simplifyDoublePlusAndDoubleMinus()
2011-12-24 22:51:55 +02:00
Daniel Marjamäki
c81a055caa
C++ Builder: Fixed compiler error (weird error)
2011-12-24 08:10:16 +01:00
Reijo Tomperi
6155932207
Refactoring: Rename some variables with too short names, such as "s".
2011-12-24 00:25:03 +02:00
Reijo Tomperi
00cbf02d84
Refactoring: Rename variable used -> templateInstantiations
2011-12-24 00:03:03 +02:00
PKEuS
dca03c3ce2
Remove unnecessary includes
...
Also add a unit test related to #3427
Also improve the description text in checkclass and remove unused variable.
2011-12-23 23:31:48 +02:00
Daniel Marjamäki
8e94e2261b
Comparing bool with int: Fixed false positives
2011-12-23 19:11:51 +01:00
PKEuS
8213a15b2a
improving checkSizeofForStrncmpSize
2011-12-23 18:11:34 +01:00
Daniel Marjamäki
e9d697b636
Fixed #3419 (false positive: (style) Same expression on both sides of '&'.)
2011-12-23 16:08:53 +01:00
PKEuS
409364747c
Fixed #3441 (segmentation fault of cppcheck (%: return ; ()))
2011-12-23 12:46:59 +01:00
Daniel Marjamäki
df8504f0ea
Clarify calculation: Fixed false positives when there are various function calls
2011-12-23 12:13:39 +01:00
Daniel Marjamäki
ba5558748d
Uninitialized variables: Fixed false 'dangerous usage of strncpy' positive when resulting string is used by strncpy
2011-12-23 08:44:28 +01:00
Reijo Tomperi
70c4bb54b4
Refactoring: Split long function in tokenizer.
...
simplifyTemplatesInstantiate()
2011-12-22 23:13:45 +02:00
Reijo Tomperi
1c12d04d0d
Refactoring: Make a 300 line function a little smaller.
...
simplifyTemplatesInstantiate()
2011-12-22 22:39:15 +02:00
Marek Zmysłowski
4b4f201b79
Fixed #3437 (segmentation fault of cppcheck)
2011-12-22 07:28:28 +01:00
Daniel Marjamäki
deccb1df06
Fixed #3433 (False positive: Same iterator is used with both myVector and myMap)
2011-12-21 06:16:06 +01:00
Daniel Marjamäki
fd0d9c8694
CheckOther: Added line break to make the code more readable
2011-12-20 20:54:14 +01:00
Daniel Marjamäki
f8181df340
Fixed #3410 (Comparing bool against bool produces false positive)
2011-12-20 06:38:05 +01:00
PKEuS
6dc2a6e7ab
Refactorized CheckUnusedVar
2011-12-18 20:15:41 +01:00
PKEuS
b6b97fa43d
Fixed #3427 (False positive: (error) Dangerous usage of c_str(). The returned value by c_str() is invalid after this call.)
2011-12-18 19:44:38 +01:00
PKEuS
0205582161
Fixed #3327 (printf with std::string as parameter)
2011-12-18 19:41:21 +01:00
Daniel Marjamäki
1ba1be4b8d
Fixed #3428 (false negative: array bounds errors not found when duplicate class names present)
2011-12-18 16:35:51 +01:00
Daniel Marjamäki
2bb5de4c89
Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro))
2011-12-18 13:33:23 +01:00
Daniel Marjamäki
772b8cc37d
Array index out of bounds: Avoid false positives when there are duplicate names for structs
2011-12-18 08:12:42 +01:00
Daniel Marjamäki
83cdf734fe
Tokenizer: The tokenizer didn't handle '0x0E-7' correctly
2011-12-18 07:37:20 +01:00
Daniel Marjamäki
5f712cc213
Array index out of bounds: Fixed false positive when taking address beyond array using calculated array index
2011-12-17 21:35:12 +01:00
OGAWA KenIchi
3e9d8e6ae1
Fixed #3422 (Internal error in exceptRethrowCopy check)
2011-12-17 20:00:15 +01:00
Daniel Marjamäki
d21ca7881c
Fixed #3424 (Tokenizer: doesn't tokenize if-if-else-else correctly)
2011-12-17 19:05:14 +01:00
PKEuS
f306246c7f
Improved support for references and pointers in SymbolDatabase
...
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
Daniel Marjamäki
f09a5b408b
Uninitialized variables: Fixed false positives when sizeof is used in condition. Ticket: #3369
2011-12-17 16:08:55 +01:00
Daniel Marjamäki
322f46c761
Fixed #3426 ((error) Invalid number of character ({) when these macros are defined:)
2011-12-17 15:23:55 +01:00
Daniel Marjamäki
95123854ba
Array index out of bounds: Fixed false positive when size is not known.
2011-12-17 13:20:42 +01:00
Daniel Marjamäki
e008a0508b
Null pointers: Fixed false positive when sizeof without parentheses are used
2011-12-17 12:44:11 +01:00
PKEuS
4abee3a345
Refactorings. Use reportError instead of reportInconclusiveError.
2011-12-17 11:39:20 +01:00
PKEuS
009471f4ee
Refactorizations for executionpath.cpp (rearranged code, added some else before if)
2011-12-17 11:26:20 +01:00
PKEuS
2fa0168e55
Patch that improves STL checking: Make use of SymbolDatabase, solved TODO (about returning .c_str() value), check for deleting iterators by value.
2011-12-17 11:21:34 +01:00
Daniel Marjamäki
fe8393aafc
Uninitialized variables: Fixed false positives in sizeof. Ticket: #3369
2011-12-17 09:51:45 +01:00
Daniel Marjamäki
dfedb920f8
Uninitialized variables: Fixed false positive when address of variable is taken inside = { .. }. Ticket: #3369
2011-12-17 07:56:46 +01:00
Daniel Marjamäki
0572321572
Fixed #3423 (Uninitialized variable in operator>>)
2011-12-16 20:34:44 +01:00
Daniel Marjamäki
5f1fadec7b
Uninitialized variables: Fixed false positives when many 'if' are used. Ticket: #3369
2011-12-16 19:56:32 +01:00
PKEuS
a311904a0f
Patch that fixes some bailouts for isEnabled('style') in both directions. Improved checkSizeofForNumericParameter's error message, made it 'warning', made it non-experimental.
2011-12-16 19:21:14 +01:00
Daniel Marjamäki
1f329d7b41
Uninitialized variables: Fixed false positive for x 'a[x=1]'. Ticket: #3369
2011-12-16 18:12:47 +01:00
Daniel Marjamäki
e723ef0569
Uninitialized variables: Fix false positives for '= { .. }'. Ticket: #3369
2011-12-16 18:04:10 +01:00
Daniel Marjamäki
d2d7e25f3f
Uninitialized variables: Fixed false positive in for condition. Ticket: #3369
2011-12-15 20:48:26 +01:00
Daniel Marjamäki
40f2f4f7f6
Uninitialized variables: Fixed false positives when there are assembler code. Ticket: #3369
2011-12-15 20:29:57 +01:00
PKEuS
e5427fe487
Fixed #3048 , further improvements to const correctness check.
2011-12-15 20:18:52 +01:00
Daniel Marjamäki
167530bf60
Uninitialized variable: Fixed test failure. Ticket: #3369
2011-12-15 20:15:37 +01:00
Daniel Marjamäki
f797307edc
Uninitialized variables: Fix false positive if variable is used after return (goto). Ticket: #3369
2011-12-15 20:05:11 +01:00
Daniel Marjamäki
10228881c7
Uninitialized variables: Fixed false positives when taking address. Ticket: #3369
2011-12-15 19:38:06 +01:00
Daniel Marjamäki
fd78816181
Fixed #3418 (preprocessor define assignment not propagated)
2011-12-15 18:49:35 +01:00
Daniel Marjamäki
6221145be8
Fixed #3414 (false positive: (error) Uninitialized variable: SOutput)
2011-12-15 18:30:59 +01:00
Daniel Marjamäki
005b1cff61
Fixed #3417 (False positive: Uninitialized variable when conditionally set)
2011-12-15 18:15:58 +01:00
Daniel Marjamäki
9e54714894
CheckNullPointer::isPointerDeref: better checking if pointer is not dereferenced
2011-12-15 17:01:39 +01:00
Daniel Marjamäki
3a432fa959
Uninitialized variables: better handling of initialization with >>. Ticket: #3369
2011-12-15 16:55:55 +01:00
Daniel Marjamäki
b3c35d4b32
Fixed #3415 (Segmentation fault in new check for uninitialized variables)
2011-12-15 16:49:14 +01:00
PKEuS
00d6a0e877
refactorizations for CheckClass and for less false negatives related to derived classes
2011-12-14 21:11:40 +01:00
Daniel Marjamäki
295f486cde
Uninitialized variables: Detect more errors when variable is given as array index. Ticket: #3369
2011-12-14 19:56:58 +01:00
Daniel Marjamäki
63e2f64b9c
Uninitialized variables: Fixed false positives for loops. Ticket: #3369
2011-12-14 18:54:03 +01:00
Daniel Marjamäki
8e3e634ce0
Uninitialized variables: Detect more errors. Ticket: #3369
2011-12-14 18:28:30 +01:00
Daniel Marjamäki
419ae2a135
Uninitialized variables: Fixed false positive in new checking when variable is initialized in condition
2011-12-14 17:17:24 +01:00
Daniel Marjamäki
6a4b1127aa
astyle formatting
2011-12-14 17:07:06 +01:00
PKEuS
8ed8206b44
Fixed #3296 (false positive (inconclusive): 'C::operator=' should return 'C &')
2011-12-14 15:37:43 +01:00
Daniel Marjamäki
ba463295c2
Uninitialized variables: improved check to detect more errors. Ticket: #3369
2011-12-14 06:00:17 +01:00
Daniel Marjamäki
c7ce87d060
Uninitialized variables: Fixed false positives for break/continue/throw
2011-12-14 05:45:52 +01:00
Edoardo Prezioso
40aa326065
Tokenizer: remove redundant 'done' condition, related to ticket #3409 .
...
Add more possible letters to simplifyInitVar patterns.
Replace 'tokAt(1)' with 'next()' and 'linkAt(1)' with 'next()->link()'.
Little optimizing improvements to simplifyAsm.
2011-12-13 22:41:38 +01:00
Daniel Marjamäki
458fa0874a
Uninitialized variables: Started writing a new check. Ticket: #3369
2011-12-13 21:57:27 +01:00
PKEuS
c9f5117cf5
Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler))
2011-12-13 21:42:38 +01:00
Daniel Marjamäki
34fba9e1ea
Fixed #3405 ((error) Invalid number of character ({) when these macros are def ined: 'WIN32'.)
2011-12-13 21:14:41 +01:00
Edoardo Prezioso
4cad5d4df4
Workaround fixes to shut up some cppcheck '--inconclusive' whinings.
2011-12-13 00:24:34 +01:00
Edoardo Prezioso
81a2e62abd
Tokenizer::simplifyGoto: fix another memory read error reported by Valgrind.
...
Also improvements to Tokenizer are done.
2011-12-12 22:03:25 +01:00
Edoardo Prezioso
79b82f115f
Tokenizer: some changes to line numbers of some tokens:
...
simplifyAsm: change line number of newly added 'asm ( )' in order to be the same as next ';'.
simplifyIfAddBraces: Change line number of newly added '}' in order to be the same as next 'else', except for '{ ; } else'.
2011-12-12 20:55:25 +01:00
Reijo Tomperi
dc59fc4391
astyle fix
2011-12-12 21:27:48 +02:00
Daniel Marjamäki
c8f497a9b3
Fixed #3405 ((error) Invalid number of character ({) when these macros are def ined: 'WIN32'.)
2011-12-12 19:35:25 +01:00
Edoardo Prezioso
626f13ae7e
Tokenizer: Fix another Valgrind error in simplifyErrNoInWhile. Add more jumping patterns to simplifyIfAddBraces and simplifyDoWhileAddBraces.
2011-12-12 13:15:35 +01:00
Daniel Marjamäki
5f5c912f3f
temporary fix for inconclusive false warnings. there is not sufficient logic for determining when there is NOT a pointer dereference.
2011-12-12 07:43:33 +01:00
Daniel Marjamäki
2dbe7ca196
CheckNullPointer::isPointerDeRef: Skip inconclusive checking when --inconclusive hasn't been given.
2011-12-12 07:35:53 +01:00
Edoardo Prezioso
99d8ce3732
Fix Valgrind error in arraySize():
...
if there's code like: 'int [ ] a = { 1 , 5 , }', 'end' is last '}', when 'tok2' arrives to second ',' and cppcheck finds out that next token to 'tok2' is '}', remove this ',' with 'tok2->deleteThis()' but it causes (maybe) a memory corruption to 'end' which will gave problems later because 'tok' will be assigned to it or its next token.
2011-12-12 02:23:49 +01:00
Edoardo Prezioso
52620e6493
Tokenizer::simplifyDoWhileAddBraces:
...
1)rewrite fix for ticket #988 (just don't simplify inside macro parenthesis);
2)use a different organization of the code: start from last token and proceed backwards. This way 'simplifyDoWhileAddBracesHelper' can be called just once, hence the 'Helper' code can be improved and moved in the main function.
2011-12-12 00:20:46 +01:00
Edoardo Prezioso
cf574072b6
Tokenizer::arraySize(): improve code structure, fixed 'tok2' for-looping which didn't stop to the ending '}' parenthesis.
2011-12-11 23:13:37 +01:00
Edoardo Prezioso
3c098839d1
simplifyIfAddBraces: Remove restriction for jumping opening parenthesis '(' as a fix to #2873 , because even without this the original test case doesn't crash anymore. Add more jumping patterns.
...
simplifyFunctionParameters: Add more jumping patterns and an observation related to error message for equal parameter names, help needed.
Fix grammar mistake in comment.
2011-12-11 13:07:13 +01:00
Daniel Marjamäki
ffb5d107be
CheckNullPointer::isPointerDeRef: Tweaks to reduce false warnings when inconclusive is used.
2011-12-11 08:48:55 +01:00
Daniel Marjamäki
497c54a1a7
Fixed #3168 (false negative: buffer overflow in subfunction)
2011-12-11 08:16:58 +01:00
Edoardo Prezioso
27801b35eb
Other improvements to tokenizer code.
...
Handle SQL code better, even when there's no ';' after 'EXEC SQL'.
simplifyVarDecl: Check with 'Token::Match' once when you have to check a pattern inside which there should be a number or a variable. Use '%any%' and after that check if that string is a number or a variable name later.
simplifyGoto: process also anonymous structs and unions which should have 'indentspecial' incremented, skip code like 'var = { ... }'.
2011-12-11 02:02:38 +01:00
Edoardo Prezioso
5134964026
Fix code in commit 5f522fb841
and reapply it again.
2011-12-10 23:49:56 +01:00
Daniel Marjamäki
04159b81b8
reverted 5f522fb841
, to avoid hang in TestBufferOverrun::arrayInfo
2011-12-10 20:51:36 +01:00
Daniel Marjamäki
ee39f6402c
reverted fix for #3168 , I'll rewrite it
2011-12-10 20:46:10 +01:00
Daniel Marjamäki
897e8637b4
Fixed #3168 (false negative: buffer overflow in subfunction)
2011-12-10 19:26:12 +01:00
Edoardo Prezioso
5f522fb841
Tokenizer: improve code and remove redundant checks.
...
In particular: improve 'double sharp' concatenation by handling also code which begins without the [{};]. Do the same with C# code. Also, in the labels simplification function, skip also '{}' when the open bracket is after a '='.
2011-12-10 18:45:27 +01:00
Daniel Marjamäki
e870c68978
Check64BitPortability: Wiki formatting update
2011-12-10 18:41:09 +01:00
Daniel Marjamäki
c5a1b5ecab
--doc : don't write internal checks in the doc output
2011-12-10 18:39:25 +01:00
Edoardo Prezioso
bf815ac1e4
Improve labels simplification code, remove redundant checking.
2011-12-10 14:13:48 +01:00
Daniel Marjamäki
93b447f7f6
1.52: Updated version
2011-12-10 12:55:40 +01:00
PKEuS
9fc7453917
Memory leaks: Code cleanups
2011-12-10 11:55:14 +01:00
Daniel Marjamäki
8624c0b9fd
Merge pull request #67 from makulik/master
...
Fixed ticket #3389 '-U option doesn't supress include file handling for #include statements inside #ifdef code paths'
2011-12-10 02:44:01 -08:00
Daniel Marjamäki
c2e86b867c
Fixed #3386 (Syntax Error: 'int a[]={b<c?1:2,3};')
2011-12-10 11:34:27 +01:00
Edoardo Prezioso
51c1e2303f
CheckBufferOverrun::checkInsecureCmdLineArgs(): Remove recently unused variable 'pattern'.
2011-12-09 23:24:08 +01:00
PKEuS
91a0a071d0
Take symbol database into use or improve its usage in some checks.
2011-12-09 23:28:10 +02:00
makulik
0a777dcb52
Fixed ticket #3389 '-U option doesn't supress include file handling for #include statements inside #ifdef code paths'
...
Signed-off-by: makulik <g-makulik@t-online.de>
2011-12-09 21:57:06 +01:00
PKEuS
9b685ba3c3
Code cleanup
2011-12-09 21:00:57 +01:00
Edoardo Prezioso
7d12951da0
1)Fixed ticket #3184 (Improve Tokenizer: improve simplifyMulAnd to simplify weirder code);
...
2)Fix a test case inside TestSimplifyTokens::flowControl.
2011-12-09 20:47:51 +01:00
PKEuS
f46cf5fd65
Exception safety: refactorings, use the symbol database
2011-12-09 19:53:00 +01:00
Daniel Marjamäki
8ca8887849
C++ Builder : Fixed compiler error
2011-12-08 22:24:09 +01:00
Daniel Marjamäki
b383bae4ab
C++ Builder: Fixed compiler errors
2011-12-08 22:17:50 +01:00
Daniel Marjamäki
6029e23189
Preprocessor: Use const_iterator instead of iterator where possible
2011-12-08 22:14:11 +01:00
Daniel Marjamäki
60d828e778
C++ Builder: Fixed compiler error
2011-12-08 22:09:03 +01:00
PKEuS
167a7e3e51
Various code cleanups
2011-12-08 21:28:34 +01:00