Commit Graph

2965 Commits

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