Commit Graph

3334 Commits

Author SHA1 Message Date
Daniel Marjamäki 480c403511 Fixed #3125 (FP: Possible null pointer dereference in conditional operator) 2011-10-02 19:27:18 +02:00
Daniel Marjamäki b2d0e48a31 Fixed #3126 (false positive: Null pointer dereference) 2011-10-02 18:24:45 +02:00
Kimmo Varis 4ef4cb26e9 CLI: Add support for ignoring case in PathMatch.
In Windows (or in Windows code?) we want to ignore case in the
paths. This patch implements the case ignore for the PathMatch-
class.
2011-10-02 11:46:27 +03:00
Robert Reif 65b0fb4519 fix #3153 (false positive buffer access out-of-bounds) 2011-09-30 17:28:59 -04:00
Robert Reif 272783347b another variation of false negative from #3149 2011-09-30 16:26:08 -04:00
Robert Reif 1dcb8b2382 really fix #3149 (false negative: Technically the member function 'A::f' can be const.) 2011-09-30 11:16:34 -04:00
Kimmo Varis 70b153cc1e Disable fileListStdin test from testcmdlineparser.
That test hangs the test run.
2011-09-30 08:35:23 +03:00
Robert Reif 556d523e4f fix #3149 (false negative: Technically the member function 'A::f' can be const.) 2011-09-29 20:16:52 -04:00
Robert Reif ac942c6684 fix #3151 (missing portability warning for extra qualifier on destructor) 2011-09-29 19:25:14 -04:00
Robert Reif 4d12372b65 run astyle 2011-09-29 19:23:30 -04:00
Kimmo Varis 24ce170554 Merge pull request #37 from joshbeck/master
Added support for reading file lists from stdin, correctly this time
2011-09-29 10:50:37 -07:00
Robert Reif 092ba0b1de fix symbol database bug where function variable type of a nested class was not found 2011-09-28 22:05:26 -04:00
Reijo Tomperi 236d0eb178 Fix #2813 (False negative: Uninitialized variable not found for realloc)
http://sourceforge.net/apps/trac/cppcheck/ticket/2813
Patch provided by: marekzmyslowski
2011-09-28 21:46:09 +03:00
Robert Reif 540207533b fix #3008 (New check: Order of initialisation list) 2011-09-27 21:07:37 -04:00
Joshua Beck 15cb2a0c61 Merge remote-tracking branch 'upstream/master' 2011-09-27 18:43:09 -05:00
Robert Reif 44a926aa4d add a few more Microsoft TCHAR function conversions 2011-09-27 07:29:36 -04:00
Joshua Beck 9583394eba Fix test and add info to -h output. 2011-09-27 01:02:58 -05:00
Robert Reif ec377d24eb add support for Microsoft TCHAR character constants 2011-09-26 22:08:24 -04:00
Joshua Beck 87cff36f9d Updated manual and added test for reading file list from stdin. 2011-09-26 20:43:39 -05:00
Robert Reif 2d717d77cd reduce false negatives for checking for CheckOther::checkSignOfUnsignedVariable() 2011-09-26 21:24:34 -04:00
Robert Reif 6e8bf43dc0 add some Windows TCHAR scanf and printf conversions 2011-09-25 10:02:27 -04:00
Robert Reif 545aa9e55b start adding Windows wide character support 2011-09-24 16:02:56 -04:00
Robert Reif f97424b242 start adding Windows ASCII TCHAR conversion support 2011-09-24 14:51:03 -04:00
seb777 424f349b88 fix #3121 ([False Positive] Incorrect obsoleted functions) 2011-09-24 10:54:58 +02:00
Robert Reif a685f1f5b7 add operator support to ertra qualification check 2011-09-23 19:45:19 -04:00
Robert Reif ac070b90f2 fix for loop false positives when zero length arrays present 2011-09-22 21:23:40 -04:00
Robert Reif 97d4277854 add Microsoft memory function conversions to standard cstring functions 2011-09-22 19:59:56 -04:00
Robert Reif 1dc7c0edf9 fix #3127 ([False positive] _tmain function i VS 2010 project) 2011-09-21 20:16:20 -04:00
Robert Reif 5e329d7280 fix typo in last commit 2011-09-21 19:55:11 -04:00
Robert Reif de0f2dc1d0 add test case for false negatives introduced by fix for 3106 2011-09-21 07:32:23 -04:00
Robert Reif 4d1dda10fa add some more windows type conversions 2011-09-20 20:17:02 -04:00
Daniel Marjamäki 1a7511ed48 Fixed #3106 (False positive: Uninitialized variable check has inconsistent behavior with ternary operator) 2011-09-20 21:00:05 +02:00
Robert Reif af5272dfb0 only simplify Microsoft MFC code when Windows platform is selected 2011-09-20 07:20:37 -04:00
Robert Reif e234e8cc5b add some common windows pointer type conversions to standard types 2011-09-19 23:14:58 -04:00
Robert Reif b349d36c50 fix #3124 (FP: Buffer access out-of-bounds when memset two dimension array (a[5][6])) 2011-09-19 20:32:50 -04:00
Robert Reif be660003ec start adding conversions from common Windows types to standard types 2011-09-18 13:06:54 -04:00
Daniel Marjamäki 96a04eee9c Merge pull request #35 from simartin/ticket_3059
Ticket 3059: Report the correct line number in unused functions warnings
2011-09-18 08:15:28 -07:00
Robert Reif 66eb37c135 convert size_t to standard type 2011-09-18 10:31:31 -04:00
Robert Reif 3e35ea0972 fix sizeof long double for unix64 for #2888 (Allow defining sizes of base types) 2011-09-18 08:40:08 -04:00
Simon Martin b493e4bf7b Ticket 3059: Report the correct line number in unused functions warnings 2011-09-18 07:13:39 +02:00
Robert Reif b5d22fda0d fix #2888 (Allow defining sizes of base types) 2011-09-17 19:40:52 -04:00
Simon Martin ba2591b002 Take into account kimmov's review comments 2011-09-17 16:55:59 +02:00
Simon Martin 21a4999c1b Make the build warning clean with clang++ 2011-09-17 14:40:17 +02:00
Robert Reif 1717bda382 fix wrong information about constness of function 2011-09-16 18:07:25 -04:00
Robert Reif cce4303f28 fix a problem with Qt slots immediately followed by signals 2011-09-16 16:59:43 -04:00
Robert Reif 2bc7da2c64 quick fix for #3114 (infinite recursion when operator= is overloaded) 2011-09-14 19:04:06 -04:00
Kimmo Varis 288efd832c Tests: Add more commandlineparser tests.
Add commandlineparser tests for giving two suppressions. Giving
two suppressions in one parameter is not yet supported so it is
todo-test.
2011-09-13 17:55:00 +03:00
Edoardo Prezioso 1ff7410f4f Fixed #3075 (False positive => Improve tokenizer: remove redundant code after a 'return' state) 2011-09-13 07:55:47 +02:00
Robert Reif 302daeb9bd add test for #3110 (false positve: style) Boolean result is used in bitwise operation. Clarify expression with parentheses) 2011-09-12 20:46:00 -04:00
seb777 f3193ef611 Remove invalid test case.
The code does not compile. In addition, it's a "todo test case".
2011-09-12 19:38:38 +02:00
Robert Reif 3f517b5f23 partial fix for #2960 (false negative: buffer access out of bounds) 2011-09-11 21:51:05 -04:00
Robert Reif 40009d091d add multi-dimension array support to second checkScope and use it for member arrays 2011-09-11 20:42:57 -04:00
Robert Reif 0d6592dd2e use correct checkScope function in CheckBufferOverrun for single dimension member arrays 2011-09-11 19:21:13 -04:00
Robert Reif 19928e26d1 refactor to unify functionally identical code in CheckBufferOverrun::checkScope() 2011-09-11 14:00:53 -04:00
Daniel Marjamäki 55230baf78 Fixed #3086 (false positive: Boolean result is used in bitwise operation.) 2011-09-11 09:46:01 +02:00
Daniel Marjamäki 9a97fbe022 Fixed #3104 (unread despite modified and used in IF statement) 2011-09-11 08:19:35 +02:00
seb777 8ed0e3a239 Revert "The case statement requires constant-expression (C, C++, C# and Java."
This reverts commit 5879fe419d.
2011-09-11 00:44:40 +02:00
seb777 5879fe419d The case statement requires constant-expression (C, C++, C# and Java.
Needless to simplify the calculation of a piece of code that can not compile.
2011-09-10 17:28:32 +02:00
Robert Reif 794fdd056b Merge branch 'master' of github.com:danmar/cppcheck 2011-09-10 10:14:49 -04:00
Robert Reif 547a79d4fe calculate array size for variable length structures with array at end in CheckBufferOverrun::checkStructVariable() when possible 2011-09-10 10:14:32 -04:00
Philipp Kloke 2f62d180fe Fixed #1740 (Undefined Behavior: Divide by zero) 2011-09-10 16:12:53 +02:00
seb777 08efad13b2 fix #3093 (Simplify code (math expression) with keywords 'return' and 'case') 2011-09-10 13:28:54 +02:00
Robert Reif b0eab2587d better detection of variable sized structure in CheckBufferOverrun::checkStructVariable() 2011-09-09 08:37:24 -04:00
Robert Reif 27bfa2a346 fix some CheckBufferOverrun::checkStructVariable() flase negatives for possible variable length structs 2011-09-09 07:46:06 -04:00
Robert Reif 4a71693e0c Merge branch 'master' of github.com:danmar/cppcheck 2011-09-09 07:16:55 -04:00
Robert Reif 16924c7c7a fix #3094 (Buffer access out-of-bounds in struct variable) 2011-09-09 07:16:39 -04:00
Daniel Marjamäki 84f190abf7 Fixed #3096 (false negative: memory leak not found when passing string to strtok) 2011-09-09 07:25:47 +02:00
Robert Reif 812a17f294 fix one of the TODO testcases added for #3094 (Buffer access out-of-bounds in struct variable) 2011-09-08 22:44:25 -04:00
Robert Reif 65b1a4df19 add soem test cases for #3094 (Buffer access out-of-bounds in struct variable) 2011-09-08 22:41:18 -04:00
seb777 074ad10a30 fix #195 Unusual shift operation - check this kind of code
return x >> ! y ? 8 : 2;
2011-09-06 22:37:19 +02:00
Robert Reif 7451c5cece warn when buffer is not zero terminated after memmove 2011-09-05 15:59:41 -04:00
Robert Reif f5d71d1ac5 warn when buffer is not zero terminated after memcpy 2011-09-05 15:41:37 -04:00
Robert Reif 3c8988e7a5 warn when buffer is not zero terminated after strncpy 2011-09-05 15:19:38 -04:00
Daniel Marjamäki 2601733ff7 Uninitialized vars: handle printf a little better. Ticket: #3050 2011-09-05 20:18:58 +02:00
Daniel Marjamäki c7d0beefa8 uninitstring: fix false negatives when non-zero memset is used. Ticket: #3050 2011-09-05 19:42:48 +02:00
Robert Reif fe85b8779e fix #2528 (false negative: buffer access out of bounds) 2011-09-04 21:39:52 -04:00
Robert Reif 50688b28fd fix #2889 (false negative: buffer access out of bounds on local struct member) 2011-09-04 19:54:57 -04:00
Daniel Marjamäki 8240422a09 Fixed #3078 (vector::at using int causes false positive) 2011-09-04 20:48:05 +02:00
Kimmo Varis 0c42f46717 Tests: Add tests for new --enable flags.
Adding tests for new --enable flafgs (performance, portability)
to CommandLineParser tests.
2011-09-04 21:45:52 +03:00
Robert Reif c2b76cd41f add some variable length array tests 2011-09-04 14:39:24 -04:00
Daniel Marjamäki c34b77cebf Fixed #3073 (False positive: Assigning an integer (int/long/etc) to a pointer is not portable) 2011-09-04 13:03:29 +02:00
Daniel Marjamäki 85d83d86ac Fixed #3060 (False positive: Uninitialized variable: fresh) 2011-09-04 12:53:53 +02:00
Robert Reif e782d98241 final fix for #3063 (false negative: multi dimensional arrays not well supported) 2011-09-03 21:51:00 -04:00
seb777 5c7ed46e0c Following the discussion XX, replace the keyword C99 '_Bool' with the 'bool' keyword in the process of tokenization\nSee f29b7f9f08 2011-09-03 23:15:33 +02:00
Daniel Marjamäki 46b5d5bd00 Fixed #3069 (False positive: Memory leak: data) 2011-09-03 20:45:48 +02:00
Daniel Marjamäki d098ed6031 Fixed #3065 (False positive: possible null pointer dereference: vi) 2011-09-03 19:43:27 +02:00
Daniel Marjamäki c7886ca1c4 Fixed #3058 (False positive: Uninitialized variable: data) 2011-09-03 18:53:14 +02:00
Daniel Marjamäki d23c58d387 enable: break out 'performance' and 'portability' from the 'style' id. Ticket: #3074 2011-09-03 15:30:30 +02:00
Robert Reif d749e28dc0 another partial fix for #3063 (false negative: multi dimensional arrays not well supported) 2011-09-02 21:07:29 -04:00
Robert Reif d85410de8c partial fix for #3063 (false negative: multi dimensional arrays not well supported) 2011-09-02 19:35:09 -04:00
Robert Reif f29b7f9f08 fix #3062 (false negative: Boolean variable is used in bitwise operation) 2011-09-02 17:19:06 -04:00
Robert Reif e19cbf0cdd fix false positive introduced by previous false negative fix commit 2011-09-02 10:39:04 -04:00
Robert Reif 833865e736 fix #3066 (False positive: Inconclusive: Assigning address of local auto-variable to a function parameter.) 2011-09-01 22:22:33 -04:00
Robert Reif 5bad978833 fix line number in messagex for CheckAutoVariables::autoVariables 2011-09-01 20:34:31 -04:00
Robert Reif f4e07c3179 fix #3070 (Other: failed to parse a typedef string. Check continues anyway.) 2011-09-01 19:10:58 -04:00
Robert Reif 2667e34a07 fix again #3064 (false negative: returning address of stack variable) 2011-09-01 18:30:49 -04:00
Robert Reif e7dc765ece fix #3064 (false negative: returning address of stack variable) 2011-08-31 21:36:31 -04:00
Daniel Marjamäki a96028b43b Fixed #3058 (False positive: Uninitialized variable: data) 2011-08-31 19:45:20 +02:00
Robert Reif 477d1e92c9 add new (nothrow) support to CheckUnusedVar::checkFunctionVariableUsage 2011-08-31 06:39:39 -04:00
Robert Reif acebc635b5 add support for deallocating memory with realloc 2011-08-30 23:42:11 -04:00
Daniel Marjamäki 0529654e37 Fixed #3058 (False positive: Uninitialized variable: data) 2011-08-30 19:13:04 +02:00
Daniel Marjamäki ef30da51bf Fixed #3034 (Cppcheck crash on specific file (truecrypt).) 2011-08-29 19:16:52 +02:00
Robert Reif 7775934492 really fix multi-dimensional arrays with undefined size 2011-08-28 13:32:42 -04:00
Daniel Marjamäki 787bc4c384 Fixed #3016 (Preprocessor has incorrect precedence(?) for &&) 2011-08-28 18:30:58 +02:00
Robert Reif cf6d04de74 fix #3044 (Symbol database: handle multidim array with unknown dimension 'char a[][4]') 2011-08-28 11:40:55 -04:00
Robert Reif 2d952c65e4 fix #3051 (False positive: operator= should return reference (when function takes pointer argument)) 2011-08-28 11:14:15 -04:00
Robert Reif 9a0d076295 fix #3052 (False Positive - Technically the member function 'Example::Clear' can be const.) 2011-08-28 09:21:00 -04:00
Robert Reif d643397a7e better message for strncpy zero-terminated check 2011-08-28 09:06:51 -04:00
Daniel Marjamäki a1aa66f370 Fixed #3039 (False Positive: Memory Leak 'p = pop(p);') 2011-08-28 11:28:14 +02:00
Robert Reif 8c093d0f8a refactor CheckBufferOverrun::checkScope strncpy check and change experimental to inconclusive 2011-08-27 21:18:39 -04:00
Daniel Marjamäki 15e965b530 Fixed #3038 (False Positive - memory leak (struct member passed to subfunction)) 2011-08-26 19:26:21 +02:00
Robert Reif 1d7ab77251 fix #3043 (False Positive - Member variable 'ProgramRecPriorityInfo::profile' is not assigned a value in 'ProgramRecPriorityInfo::operator=') 2011-08-25 23:27:10 -04:00
Robert Reif 423a1ff64e add support for simplifying Qt emit in tokenizer 2011-08-25 20:54:35 -04:00
Robert Reif dfe89f395a fix #3049 (False Positive - Technically the member function 'VideoOutputNull::SetupDeinterlace' can be const.) 2011-08-25 19:13:53 -04:00
Daniel Marjamäki 6d9463139d Fixed #3038 (False Positive - memory leak) 2011-08-25 19:59:44 +02:00
Robert Reif c4fdb8d113 better test for symbol database bug fixed in last commit 2011-08-24 06:53:27 -04:00
Robert Reif 6f3131da8c fix a serious symbol database bug where parts of a function could be skipped 2011-08-23 20:12:29 -04:00
Daniel Marjamäki 2f0fc9444f Fixed #3041 (false positive reported for error with id='deallocuse') 2011-08-23 23:18:47 +02:00
Robert Reif c7cb38b0b5 fix #3040 (False positive - Technically the member function 'PSIPTable::SetSection' can be const.) 2011-08-22 20:34:00 -04:00
Kimmo Varis 3765a7f8f8 Update VS2008/2010 project files. 2011-08-22 20:13:03 +03:00
Kimmo Varis 716679ec7d Move Suppressions class to own source files.
I want to use Suppressions class also in GUI. And that is easier
to do when it is not internal class of Settings class. And in
general is it more natural that Settings class only contains list
of suppressions and implementation is separate.
2011-08-22 19:57:28 +03:00
Robert Reif 8c1efe9bb6 improve message for #3035 (false negative: strcpy(dst, src) where src is bigger than dst) 2011-08-21 15:18:41 -04:00
Robert Reif 67e8731a96 partial fix for #3035 (false negative: strcpy(dst, src) where src is bigger than dst) 2011-08-21 14:44:55 -04:00
Daniel Marjamäki 7afec3cf6d Fixed #3032 (False positive: possible null pointer dereference (assignment in condition)) 2011-08-21 17:49:00 +02:00
Robert Reif 21c9b6d262 add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator) 2011-08-20 16:41:12 -04:00
Robert Reif 7eb43bc107 partial fix for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator) 2011-08-20 15:08:30 -04:00
Daniel Marjamäki 27b29e5b8e Fixed #3023 (False positive: no possible null pointer dereference here: 'WARN_ON(!abc || abc->x == 0);') 2011-08-20 09:47:55 +02:00
Daniel Marjamäki dd09b24208 Fixed #3024 (False positive: memory leak for 'rc.bitmap' when rc is added to linux kernel list) 2011-08-20 09:17:34 +02:00
Kimmo Varis 57e3a4a34b Update test project VS project files.
Ticket: #3025 (Visual Studio projects needs updating for new lib/checkunusedvar files)
2011-08-19 22:47:13 +03:00
Kimmo Varis 385a569ff2 Rename Test VC project files.
When the target name of the test runner binary changed to 'testrunner'
also the filenames of the generated project files changed.
2011-08-19 22:44:32 +03:00
Robert Reif 2dd93dff75 move unused variable checks from checkother to checkunusedvar 2011-08-19 14:35:25 -04:00
Robert Reif 9fbef3ca7b fix #3011 (new check: when first comparison is true, the 2nd comparison is always true) 2011-08-19 13:28:37 -04:00
Daniel Marjamäki a735790e77 using boolean result in bitwise operation. fix false positive for '.. != (char *) &x' 2011-08-19 18:55:20 +02:00
Daniel Marjamäki 2dd1e290eb fixed false positives for the 'bitwise operator / comparison operator' check 2011-08-19 18:06:28 +02:00
Daniel Marjamäki 314d5f1e79 fixed false positive for 'using bitwise operation on boolean result' 2011-08-19 17:07:26 +02:00
Daniel Marjamäki 72b01d1ca0 Improve check: Tweaked the assignAndCompare to handle | also in addition to & 2011-08-19 16:10:09 +02:00
Daniel Marjamäki c107fdd2d4 Fixed #3018 (false positive: (style) Suspicious condition (assignment+comparison), it can be clarified with parentheses) 2011-08-19 13:54:06 +02:00
Daniel Marjamäki 40b493e621 Improve check: Clarify condition (using boolean result in bitwise operation) 2011-08-19 13:40:54 +02:00
Daniel Marjamäki 4606251ce8 Fixed #3001 (False Positive: Redundant assignment to itself) 2011-08-19 07:23:11 +02:00
Daniel Marjamäki e5ff920ea9 Suspicious condition: Better handling when rhs is non-numeric 2011-08-19 00:56:15 +02:00
Daniel Marjamäki a7728fef48 New check: warn about such suspicious conditions: '(a & b == c)' 2011-08-19 00:15:20 +02:00
Daniel Marjamäki afed93d7d6 Command line: Added --std option. Right now only --std=posix is possible but other options might be added later. 2011-08-17 20:08:55 +02:00
Robert Reif 88019658b4 fix #3013 (segmentation fault of cppcheck ( struct x : virtual y )) 2011-08-16 19:16:58 -04:00
Daniel Marjamäki 5f25f2c6e6 Fixed #3012 (False Pos Memory Leak with a Macro) 2011-08-16 20:39:17 +02:00
Daniel Marjamäki 4f962acf16 Fixed #3009 (Using numeric constants in kernel space code) 2011-08-16 20:16:33 +02:00
Robert Reif a6c5eff1be fix #3006 (segmentation fault of cppcheck ( x < () < )) 2011-08-15 07:19:49 -04:00
Robert Reif 4168d79b09 fix #3005 (segmentation fault of cppcheck ( enum : x )) 2011-08-15 07:07:12 -04:00
Robert Reif 5364b4f7fb fix #3007 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-15 06:56:15 -04:00
Robert Reif ed507b73ee fix #3004 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-14 21:00:05 -04:00
Robert Reif 08e9d64a86 fix #3003 (segmentation fault of cppcheck (typedef a x[]; y = x )) 2011-08-14 20:38:16 -04:00
Robert Reif b7f42535ec fix #3000 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-14 18:50:33 -04:00
Robert Reif 389ab80b63 fix #2999 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-14 18:06:05 -04:00
Daniel Marjamäki 01b9c0707d Settings: Removed the --enable=posix option. Ticket: #2949 2011-08-14 09:45:53 +02:00
Robert Reif ce00d0d35e fix #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded) 2011-08-11 18:18:47 -04:00
Robert Reif f7b9d4d726 fix #2991 (segmentation fault of cppcheck ( ::y(){x} )) 2011-08-11 17:57:54 -04:00
Kimmo Varis a71ce607a4 Tests: Re-enable style param for testdivision.
My earlier commit (cfcfa3f0) removed the use of style parameter.
This commit adds it back.

Ticket: #2987 (GCC: warning: unused parameter ‘style’ in test/testdivision.cpp:39:10)
2011-08-10 23:46:26 +03:00
Daniel Marjamäki 9a24492a00 Fixed #2975 (False positive: Return of the address of an auto-variable) 2011-08-10 18:16:31 +02:00
Robert Reif a30da73d3e fix #2986 (segmentation fault of cppcheck ( x[y] )) 2011-08-09 19:45:18 -04:00
Robert Reif 10eb224ac7 fix #2983 (segmentation fault of cppcheck) 2011-08-09 18:31:02 -04:00
Daniel Marjamäki 2b8b0c44b2 Fixed #2969 (False positive: assign address of auto-var to function parameter, when function parameter is reassigned later) 2011-08-09 18:24:39 +02:00
Daniel Marjamäki 003956e42e Fixed #2982 (false positive: using char type as array index (using string as key)) 2011-08-09 17:03:22 +02:00
Daniel Marjamäki 2150995475 Fixed #2981 (False positive: struct member leak) 2011-08-08 19:58:49 +02:00
Daniel Marjamäki 8a6a999f09 Fixed #2979 (Improve message: using char as array index) 2011-08-08 19:35:11 +02:00
Daniel Marjamäki e2367b4149 Fixed #2976 (False positive: array out of bounds) 2011-08-08 18:22:15 +02:00
Robert Reif afe95be966 fix #2980 (segmentation fault of cppcheck) 2011-08-08 06:58:55 -04:00
Robert Reif 403b508371 Merge branch 'master' of github.com:danmar/cppcheck 2011-08-07 16:49:07 -04:00
Robert Reif 829611b129 fix #2978 (segmentation fault of cppcheck ( enum E {} e enum )) 2011-08-07 16:48:47 -04:00
Daniel Marjamäki 999b80bbb8 Buffer overrun: Fix false negative 2011-08-07 17:54:25 +02:00
Daniel Marjamäki a6a966e28e Null pointer: Fixed false positive when condition contains assignment 'if (p==NULL && (p=malloc(10))!=NULL) *p=0;' 2011-08-07 17:06:25 +02:00
Kimmo Varis cfcfa3f000 Use "enabled" list for the style checking.
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.

Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif 85b2bd21dc fix #2968 (new check: testing if unsigned variable is less than 0) 2011-08-06 19:23:09 -04:00
Robert Reif 222ed6d375 fix #2971 (Wrong warning generated) 2011-08-06 19:10:15 -04:00
Robert Reif d23fb873cc fix #2970 (Incorrect report: Class does not have a constructor) 2011-08-06 17:54:02 -04:00
Robert Reif 3bd8bf0e75 run astyle 2011-08-06 17:53:06 -04:00
Kimmo Varis babfba53fb Tests: Disable tests for CLI -i option.
The tests use non-existing relative paths. Currently the code
checks if the paths added to -i exist and hence these tests
fail.
2011-08-06 19:18:20 +03:00
Simon Martin 13360c2a66 Fixed #2870 (Tokenizer: simplify '0 |') 2011-08-06 06:50:29 +02:00
Robert Reif fa82d43562 fix #2967 (segmentation fault of cppcheck ( auto_ptr< x >)) 2011-08-05 18:18:30 -04:00
Robert Reif fd01a7555a fix #2966 (segmentation fault of cppcheck ( enum x : )) 2011-08-05 18:07:18 -04:00
Daniel Marjamäki fd7e085c9d Array index out of bounds: prevent false positive when a dimension for an array is unknown 2011-08-05 13:08:48 +02:00
Daniel Marjamäki 0186fc0650 tweaked the error message somewhat for id arrayIndexThenCheck 2011-08-05 09:10:07 +02:00
Robert Reif ac6d67dc4d add support for using global qualified :: memset on class and class member initialization 2011-08-04 20:37:27 -04:00
Robert Reif 2516aad31d fix #2887 (infinit loop with ( A::A(std::auto_ptr<X> e){} )) 2011-08-04 19:50:18 -04:00
Edoardo Prezioso 973e61087e Fixed #2961 (Test executable name differs between Makefile and test.pro) 2011-08-04 21:20:39 +02:00
Daniel Marjamäki ceb763f57a Fixed #2956 (False negative: read array and then immediately check the index 'str[i] && i<sizeof(str)') 2011-08-04 11:15:14 +02:00
Kimmo Varis 7e8f5be4b6 Update VS project files. 2011-08-03 18:39:02 +03:00
Daniel Marjamäki bab441b7e0 Obsolete functions: Split up functions into posix/standard sets. Only check for obsolete posix functions if --enable=posix has been given. 2011-08-03 16:10:43 +02:00
Kimmo Varis 196a96d93a Add missing test files to test.pro -project. 2011-08-03 10:38:07 +03:00
Kimmo Varis f4950ea836 CLI: Rename --posix to --enable=posix.
Ticket: #2949 (new check: (style) finding non-reentrant functions)
Ticket: #2952 (CLI option --posix is wrong)
2011-08-03 10:28:36 +03:00
Daniel Marjamäki e82df7292f Fixed #2919 (Wrong file name reported with #error in header) 2011-08-03 07:28:37 +02:00
Reijo Tomperi ee7b8d53c6 Fix: #2942 (segmentation fault of cppcheck ( #elif (){ ))
http://sourceforge.net/apps/trac/cppcheck/ticket/2942
2011-08-02 22:06:27 +03:00
Daniel Marjamaki 6dc7554310 Visual Studio: Updated project files 2011-08-02 17:29:02 +02:00
Daniel Marjamäki 493cfa5df2 Null pointer: Added todo test case to better handle dereference in condition 2011-08-02 17:20:13 +02:00
Daniel Marjamäki 08f27564fa Null pointer: reduce false negatives in pointerDerefAndCheck 2011-08-02 17:04:07 +02:00
Daniel Marjamäki 825dce5c4e Fixed #2954 (False negative: Null pointer dereference not detected '*p=4; if (p) { }') 2011-08-02 11:20:09 +02:00
Daniel Marjamäki 5fc2a55bac Fixed #2900 (found memory leak in kernel p54usb and a false positive reported) 2011-08-02 09:04:13 +02:00
Daniel Marjamäki 0c2f2e1c38 Null pointers: Fixed false negative when struct is dereferenced in condition 2011-08-01 21:57:23 +02:00
Robert Reif 9b9a0de777 add test for #2937 (Scope::checkVariable found variable 'sMMF' with varid 0.) 2011-08-01 06:45:06 -04:00
Daniel Marjamäki 207038a087 AssignIf: detect more problems for 'if' and 'else if' conditions 2011-08-01 11:33:09 +02:00
Daniel Marjamäki 103542bb15 Fixed #2908 (common logic when using bitwise and) 2011-08-01 09:36:12 +02:00
Daniel Marjamäki a6c7ae8d51 Fixed #2789 (null pointer: problems not detected when pointer is assigned and checked if it's null in a if statement) 2011-08-01 07:51:32 +02:00
Daniel Marjamäki 880e0e3b5f AssignIf: Improved the error message for mismatching comparison 2011-08-01 07:13:47 +02:00
Robert Reif bc4db75aa9 fix #2146 (uninitialized variable: false negative for 'return x ? 1 : y;') 2011-07-31 21:33:43 -04:00
Robert Reif daf0c71f77 fix #2911 (Token::Match(tok, %oror%|&&) doesn't match &&) 2011-07-31 13:26:26 -04:00
Daniel Marjamäki 1640f3d1ca Null pointer: fix false negatives when unknown function is called and pointer is local/argument 2011-07-31 17:32:25 +02:00
Daniel Marjamäki cc89687e8c Null pointer: better handling when calling standard functions with possible null pointer 2011-07-31 17:19:23 +02:00
Daniel Marjamäki afc825da68 AssignIf: handle parantheses. ticket: #2909 2011-07-31 17:09:53 +02:00
Daniel Marjamäki dd6982a616 Fixed #2935 (possible null pointer dereference when using strcpy etc) 2011-07-31 14:07:35 +02:00
Daniel Marjamäki 00e28f5c4e AssignIf: Match lhs and rhs for comparisons. Ticket: #2909 2011-07-31 11:23:38 +02:00
Daniel Marjamäki e47aac2501 AssignIf: Detect problem for 'y=x&4; if(y!=3)..'. Ticket: #2909 2011-07-31 10:48:31 +02:00
Daniel Marjamäki 47f13860b7 AssignIf: Added new check. Ticket: #2909 2011-07-30 21:43:21 +02:00
Daniel Marjamäki 7f193fb7a1 Fixed #2788 (null pointer: dereference and then check 'if (abc->a == 3) { } if (!abc) ..') 2011-07-30 19:51:06 +02:00
Robert Reif c6a804d306 add std::*.empty() to possible const functions in CheckClass::checkConstFunc 2011-07-30 09:44:20 -04:00
Robert Reif 74c1bdde77 fix #1593 (false negative: the function can be declared as const) 2011-07-30 08:48:11 -04:00
Ettl Martin 2aec4577c0 Merge branch 'master' of github.com:danmar/cppcheck 2011-07-29 23:38:02 +02:00
Ettl Martin f441a958cd mathlib: fixed #2950: comparison of floating point values 2011-07-29 23:37:40 +02:00
Kimmo Varis 335b52653e Tests: add semicolons after TEST_CASE() 2011-07-29 22:00:24 +03:00
Kimmo Varis a50f75ef86 Add --posix CLI option.
Part of ticket #2949 (new check: (style) finding non-reentrant functions)
2011-07-29 20:17:02 +03:00
Ettl Martin 6b23dd9928 added a check to detect nonreentrant functions and a --posix switch 2011-07-29 18:27:01 +02:00
Ettl Martin 35bb5dffa4 Added a new check for finding non-reentrant functions 2011-07-28 23:29:16 +02:00
Daniel Marjamäki dc629b4c39 Fixed 'possible null pointer dereference' warning messages 2011-07-28 08:12:21 +02:00
Daniel Marjamäki d2c0e5e7e6 Fixed #2821 (New Check : bool pointer null truth assignment) 2011-07-28 07:28:24 +02:00
Robert Reif ca2e8b057b fix #2947 (False positive: member variable is not initialized (a[x::y] = 0;)) 2011-07-27 12:03:44 -04:00
Robert Reif 54141f2e7f fix #2943 (Symbol database: Wrong parsing of std::vector as base class.) 2011-07-27 11:23:22 -04:00
Daniel Marjamäki 2b48c7624c Auto Variables: Reverted fix for #1514 because my idea was wrong. See ticket: #2944 2011-07-27 10:43:44 +02:00
Daniel Marjamäki 5cb701d3c1 Fixed #2946 (False positive: Uninitialized buffer variable (init in subfunction)) 2011-07-27 10:34:12 +02:00
Daniel Marjamäki 4e55fb604c Fixed #2945 (False positive: Uninitialized variable reading from stream) 2011-07-26 21:30:58 +02:00
Daniel Marjamäki a6740200cf Null pointer: Added check for 'if (fred); return fred->a;' 2011-07-25 21:58:00 +02:00
Daniel Marjamäki 6e14da7eba Fixed #2812 (false negative: null pointer dereference when returning struct member) 2011-07-25 21:40:32 +02:00
Daniel Marjamäki 63a0c6ad4a Fixed #2796 (uninitialized and leaving scope) 2011-07-25 16:35:30 +02:00
Daniel Marjamäki 2c6e4c423a Fixed #2681 (False negative: Possible null pointer dereference) 2011-07-25 15:45:00 +02:00
Daniel Marjamäki 9a3f95613a Uninitialized variables: Fixed false positive if there is assignment in return statement 2011-07-24 22:41:40 +02:00
Daniel Marjamäki 1bb7a1c23c Fixed #2938 (Uninitialized variable not detected when part of expression) 2011-07-24 22:26:11 +02:00
Robert Reif 9a4447c835 add support for unused const local variables 2011-07-24 12:09:59 -04:00
Daniel Marjamäki 4e6800c474 Fixed #2921 (False positive: Memory leak with static pointer) 2011-07-24 16:08:29 +02:00
Daniel Marjamäki 1ce261e44d astyle formatting 2011-07-24 14:54:13 +02:00
Simon Martin 3fa3a53580 Added testcases for #2933 (Postfix operator check fails to warn for structs) 2011-07-24 14:53:03 +02:00
Simon Martin 539c2e5acb Fixed #2932 (segmentation fault of cppcheck ( i / i )) 2011-07-24 09:06:38 +02:00
Simon Martin fc0f75fe6a Preprocessor: Fix #if0 #elif todo test case. Ticket: #2619 2011-07-24 08:54:24 +02:00
Robert Reif e332f0c186 Merge branch 'master' of github.com:danmar/cppcheck 2011-07-22 08:32:08 -04:00
Robert Reif 527c1aae33 fix #2931 (another false negative in auto variables checking when function parameter is a struct) 2011-07-22 08:31:31 -04:00
Daniel Marjamäki 0dd5472642 Tokenizer::simplifyFunctionPointer: don't simplify function call. Ticket: #2873 2011-07-22 07:58:53 +02:00
Robert Reif 84ca1902a5 fix #1514 (Improve CheckAutoVariables: assign autovariable address to effective parameter) 2011-07-21 22:37:36 -04:00
Robert Reif 4e64d35462 fix #2926 (false negative in auto variables checking when function parameter is a struct) 2011-07-21 22:26:42 -04:00
Robert Reif c3c3eb74e8 fix #2929 (Additional Unused variable check) 2011-07-21 18:37:37 -04:00
Robert Reif cc1ecccd01 fix #2928 (False positive (static variable misinterpreted as auto variable)) 2011-07-21 18:20:19 -04:00
Daniel Marjamäki fb3870071a Fixed #2885 (crash of cppcheck while checking gcc-testsuite) 2011-07-21 16:13:35 +02:00
Daniel Marjamäki d34a778848 Fixed #2848 (False positive: Memory leak when assigning and freeing from another struct) 2011-07-21 13:33:20 +02:00
Daniel Marjamäki 9f22d2fc6b Fixed #2897 (out of bounds false positive, using reinterpret_cast) 2011-07-21 09:32:24 +02:00
Robert Reif 32f94a47cc fix #2925 (False negative: auto variables - assigning address of array to function parameter) 2011-07-20 19:02:54 -04:00
Daniel Marjamäki 7e7f6eecf5 Fixed #2794 (Improper hanling of preprocessor directives #if defined) 2011-07-20 23:50:57 +02:00