Commit Graph

7791 Commits

Author SHA1 Message Date
PKEuS b6057a1148 Improved CheckOther::checkIncorrectLogicOperator:
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664)
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
Daniel Marjamäki fc84f55f80 Fixed #3536 (Preprocessor #if fails to correctly compare two #defined values) 2012-03-15 20:04:34 +01:00
Daniel Marjamäki 813a193bb6 Merge pull request #84 from HeisSpiter/master
Fix for bug #3439
2012-03-15 11:37:42 -07:00
Daniel Marjamäki 555e8c6efc Fixed #36221 (Input streams: Wrong token list simplification) 2012-03-15 19:09:36 +01:00
Pierre Schweitzer e9a696f70e Set back getErrorMessages() as private 2012-03-15 18:52:51 +01:00
Pierre Schweitzer 5dc4fcaa0a Add two tests for the new memory leak detection 2012-03-14 23:45:20 +01:00
Pierre Schweitzer f3b1c46c7d Define error messages for --errorlist for CheckMemoryLeakNoVar class 2012-03-14 23:44:04 +01:00
Pierre Schweitzer 81318b3f4a Detect and display an error on leaks due to return of a function that allocates something is ignored.
This fixes #3439
2012-03-14 22:24:43 +01:00
Daniel Marjamäki 45759f6f7d CheckMemoryLeak: report debug warning when variable id is 0. Ticket #3527 2012-03-14 18:54:34 +01:00
Daniel Marjamäki 4f3878eb1e Fixed #3569 (false negative: buffer access out of bounds) 2012-03-13 21:30:03 +01:00
Daniel Marjamäki a9480ca0c1 CheckBufferOverrun: move condition before loop 2012-03-13 21:19:10 +01:00
PKEuS 7cfffc9c9d Improved CheckOther::checkIncorrectLogicOperator:
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
Daniel Marjamäki a9d56f2738 Tokenizer: simplify known variable value inside conditional block 2012-03-12 17:32:30 +01:00
PKEuS 533db6421f Renamed ID uninitialized member variables in constructors to "uninitMemberVar" to avoid ambiguity (#2715)
Refactorizations:
- Replaced another single-token-pattern
- Replaced a "continue" with a "break" statement, because its safe to assume that only one variable with a specific ID can exist in a scope
2012-03-11 14:29:00 +01:00
PKEuS 6f164de609 Improved static string comparision check: Implemented #3214
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655)
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
Daniel Marjamäki 3f1ab5af9b charvar: dont write warning about char type array index when array is small and the full valid range is accessible with the char type. If there are out of bounds access then, it is not because the type of the variable. 2012-03-10 12:19:28 +01:00
PKEuS 81e4eb6503 Merge pull request #83 from simartin/clang_warn_fix
Fixed shadowing warning
2012-03-08 23:43:44 -08:00
Simon Martin 190cba519d Fixed shadowing warning 2012-03-09 08:06:58 +01:00
August Sodora e0bee0e037 Fixed #3567 (False positives in boolean expressions) 2012-03-07 20:31:23 +01:00
Daniel Marjamäki 680883a6a7 fixed #3649 (False Positive: Uninitialized variable using operator assignment) 2012-03-06 18:51:50 +01:00
larudwer e0c880133c on Windows Backslashes in Pathnames must be double quoted, otherwise some editors like e.c. SciTE are not able to open the file. 2012-03-04 15:53:39 +01:00
PKEuS ef6e381d47 Improved bitwise on boolean check to make it working on more code patterns
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +01:00
PKEuS fbef32d27b Updated german translation (nearly complete)
Added my name to AUTHORS (forgotten for a long time)
2012-03-02 16:20:15 +01:00
PKEuS f1068114f3 Merge pull request #82 from vBm/master
Cosmetics regarding AUTHORS
2012-03-01 14:21:52 -08:00
vBm 202508406f cosmetics 2012-03-01 23:18:10 +01:00
PKEuS 8424152f2c Merge pull request #81 from vBm/master
Updated Serbian localization file. (yet to be translated)
2012-03-01 14:01:48 -08:00
vBm 3d612b4bef Added my full name to AUTHORS
Updated Serbian localization file. (yet to be translated)
2012-03-01 22:58:51 +01:00
Stefan Weil 2ce5b80599 Fix compilation with HAVE_RULES=yes
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-03-01 20:07:00 +01:00
PKEuS 1ef99e2f21 Improved checkautovariables:
- Added support for checking a few more code patterns
- Simplified code by using more information from the symboldatabase
- Moved redundant part of c_str-check to checkstl
Two fixes according to output of pvs studio in testsimplifytokens.cpp
2012-03-01 18:38:20 +01:00
PKEuS c61762f454 Refactorized doAssignement:
- Enhanced performance by directly iterating through the token list instead of index access
- Added more allocation functions
- Simplified code
Replaced avoidable strlen call in cppcheckexecutor.cpp
2012-02-29 20:57:48 +01:00
Daniel Marjamäki db1205cdb3 Preprocessor: better handling of '#if A==1' 2012-02-29 19:08:01 +01:00
Daniel Marjamäki 527d3791e6 Fixed #3596 (memory leak false positive on libedit sources) 2012-02-27 18:55:36 +01:00
Ettl Martin 2ac907b40a fixed compiler warning (gcc-4.6.1) 2012-02-27 14:13:34 +01:00
Ettl Martin 013ef6157d fixed regression 2012-02-26 13:35:35 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Daniel Marjamäki 16427b40b9 dmake: move . this fixes compiler errors when compiling with some old gcc 3.X compiler 2012-02-26 10:18:21 +01:00
Daniel Marjamäki 385c9d341d Fixed #3633 (False positive: struct array not assigned a value) 2012-02-26 08:29:02 +01:00
Edoardo Prezioso 4d3013d43d Improve 'Tokenizer::elseif' code in order to not touch 'else if' inside a macro parenthesis. 2012-02-26 02:50:48 +01:00
Daniel Marjamäki bbfae8e3ae Fixed #3583 (False positive Variable X is assigned a value that is never used) 2012-02-25 12:56:33 +01:00
PKEuS 9431fb1b7e Improved STL checks:
- Added performance checking for .c_str() for return values and function parameters (#1079)
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS 9a5f66030c Improved unused private function check:
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS 9f42ce91a1 Refactored STL container usage in CLI.
Pathmatcher masks are converted to lowercase only once when instance is created
2012-02-19 17:22:59 +01:00
Daniel Marjamäki 39b0f1ba95 Fixed #3608 (unreadVariable when variable used in inline assembly) 2012-02-19 16:04:35 +01:00
Daniel Marjamäki 69d03bac34 Fixed #3603 (False Positive: Variable is assigned a value that is never used) 2012-02-19 15:25:46 +01:00
PKEuS b1ff900aaa Some refactorizations 2012-02-18 23:43:51 +01:00
Zachary Blair 0e791929b5 Ticket #3598 - Added a missing ASSERT_EQUALS() statement to the end of checkDoubleFree() 2012-02-18 12:13:21 -08:00
Edoardo Prezioso d7a918e549 Fixed ticket #3616 (segmentation fault of cppcheck). 2012-02-18 17:58:50 +01:00
Daniel Marjamäki a118f82ca7 Tokenizer::simplifyVarDecl: Don't simplify inside parenhteses 2012-02-18 15:05:29 +01:00
PKEuS 4b52df675a Some refactorizations 2012-02-18 14:44:04 +01:00
Daniel Marjamäki 0705dbd34a Tokenizer::simplifyCasts: don't simplify 'f((double)(v1)*v2)' to 'f(*v2)' 2012-02-18 14:26:00 +01:00