Commit Graph

3232 Commits

Author SHA1 Message Date
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