Commit Graph

3098 Commits

Author SHA1 Message Date
Daniel Marjamäki adc47f1820 Fixed #1487 (fix gcc compiler warnings) 2010-08-06 21:02:43 +02:00
Daniel Marjamäki eedb5e383e Memory leaks: better handling of 'return strcmp(..' etc 2010-08-05 21:23:32 +02:00
Daniel Marjamäki 2450a80556 Visual Studio: Added /MP switch 2010-08-05 19:02:05 +02:00
Daniel Marjamäki e5a2c6426b Memory leaks: Added ASSERT_EQUALS near the TODO_ASSERT_EQUALS 2010-08-05 13:30:07 +02:00
Daniel Marjamäki 1b2f16f443 Buffer overflow: Fixed two TODO test cases 2010-08-05 11:01:47 +02:00
Daniel Marjamäki 65f7bcbfa5 null pointers: fixed TODO assertion - dereference pointer in function call and then checking that it is not NULL 2010-08-05 08:19:36 +02:00
Daniel Marjamäki 6f228033d2 null pointers: fixed todo test case 2010-08-05 08:06:19 +02:00
Daniel Marjamäki 9d24c9ceaa Memory leaks: refactoring return handling 2010-08-04 23:01:32 +02:00
Daniel Marjamäki 239d264432 uninitialized variables: fixed false negatives when uninitialized pointer data is read 2010-08-04 21:13:40 +02:00
Daniel Marjamäki 6d94c4f15e Memory leaks: don't translate 'return p[10];' to 'return use ;' 2010-08-04 20:48:20 +02:00
Daniel Marjamäki 33bf8bf730 Fixed #1670 (False negative: Array index out of bounds in return statement) 2010-08-04 20:38:52 +02:00
Daniel Marjamäki 08e2d91372 Fixed #1919 (option '--suppressions file' can not work when filename includes colon) 2010-08-03 17:52:03 +02:00
Daniel Marjamäki 6700351ede Fixed #1833 (memory leak detected in version 1.37 not detected in 1.43) 2010-08-02 23:04:23 +02:00
Daniel Marjamäki ff9d3d0965 memory leaks: better handling of 'loop { dealloc ; alloc ; }' 2010-08-02 22:17:09 +02:00
Daniel Marjamäki ae0252dc91 memory leaks: simplify 'callfunc ; ;' 2010-08-02 21:59:47 +02:00
Daniel Marjamäki df44703ee9 memory leaks: better checking of function calls. If there are statements after the function call it is unlikely the function call is noreturn 2010-08-02 21:56:50 +02:00
Kimmo Varis 2fa4378338 Astyle cleanup with new Astyle options. 2010-07-31 15:44:08 +03:00
Daniel Marjamäki 694325d51f Fixed #1912 (False positive: memory leak (calling noreturn function)) 2010-07-30 08:50:10 +02:00
Daniel Marjamäki 2e2baa23a6 Fixed #1909 (### Internal error in Cppcheck. Please report it) 2010-07-28 21:03:15 +02:00
Kimmo Varis 45a6742e3f Windows: Add _CRT_SECURE_NO_WARNINGS define.
The _CRT_SECURE_NO_WARNINGS define suppresses some Windows-specific
compile warnings. Windows has "secure" versions of some functions
and compiler outputs warnings that those "secure" versions should
be used instead. Since other platforms don't have those functions
we just suppress this warning for now on.
2010-07-27 17:34:13 +03:00
Zachary Blair 9f44d9eb62 Fixed #1889 (false positive: Common realloc mistake) 2010-07-26 23:17:27 -07:00
Daniel Marjamäki 7c5219324e Refactoring: Cleanup include that checkheaders reported as not needed 2010-07-26 22:05:51 +02:00
Kimmo Varis 60cf37d1ef Update VS 2010 project files. 2010-07-26 22:06:33 +03:00
Robert Reif 0bb07e6947 Create a symbol database 2010-07-26 16:46:37 +02:00
Daniel Marjamäki 29b2be19ab Fixed #1383 (Preprocessor: define - ifndef problem) 2010-07-25 15:19:25 +02:00
Daniel Marjamäki 0c65796984 Refactoring: Cleanup headers using checkheaders 2010-07-24 22:12:56 +02:00
Daniel Marjamäki 9c17114668 Fixed #1893 (false positive: dereferencing null pointer (try/catch)) 2010-07-24 14:27:18 +02:00
Daniel Marjamäki 3ad8f98c61 Refactoring: Settings::addSuppression return error message and callers make sure it's reported properly. Ticket: #1839 2010-07-23 23:12:56 +02:00
Daniel Marjamäki 5e0a4a173a Refactoring: The preprocessor will report errors instead of throwing exceptions. Ticket: #1866 2010-07-23 13:54:52 +02:00
Daniel Marjamäki e1612bc175 Fixed #1891 (Internal error when enum assigned to sizeof without brackets) 2010-07-22 22:21:12 +02:00
Daniel Marjamäki f69109fbf6 Fixed #1828 (### Internal error in Cppcheck. Please report it.) 2010-07-22 19:57:48 +02:00
Kimmo Varis 618076a65f Better fix for #1371.
Now handles also system includes. And have couple of tests.
2010-07-21 14:16:42 +03:00
Kimmo Varis 9d29ee6edd Use enum for header file types 2010-07-21 12:58:30 +03:00
Robert Reif f2f5b3ebf0 Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const) 2010-07-20 09:43:27 +02:00
Daniel Marjamäki 9debcb84cd filelocation-refactoring: Fixed unit tests in windows 2010-07-19 22:02:51 +02:00
Daniel Marjamäki 3c376047ba pulled changes from kimmov (filelocation-refactor) 2010-07-19 18:06:49 +02:00
Zachary Blair df1c911d84 Merge branch 'master' of github.com:danmar/cppcheck 2010-07-19 07:49:44 -07:00
Robert Reif 4cf92992a8 Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const) 2010-07-19 13:16:11 +02:00
Daniel Marjamäki d4d0bc050a Fixed #1865 (Tokenizer::simplifyRedundantParantheses: wrong handling of 'operator delete') 2010-07-19 12:06:20 +02:00
Daniel Marjamäki bbf2c6c6e6 Fixed #1880 (false positive: Uninitialized array (initialized in subfunction)) 2010-07-19 10:03:54 +02:00
Zachary Blair 9ffd06ff5e Fixed #1856 (false positive: "pData" nulled but not freed upon failure) 2010-07-18 23:55:39 -07:00
Robert Reif 37b37218cf Fixed #1882 (false negative: function can be declared const) 2010-07-19 08:40:46 +02:00
Robert Reif 689de10abf uninitialized class members: better handling of nested classes 2010-07-18 20:43:51 +02:00
Martin Ettl 6cc3f76668 #1880: added todo testcase (false positive: (error) Uninitialized variable: y) 2010-07-18 18:55:53 +02:00
Martin Ettl 5ab36d8a6d added a testcase for ticket #1879 2010-07-18 15:13:48 +02:00
Daniel Marjamäki 1fb4758583 Fixed #1855 (false positive: uninitialized variable (function call in switch condition)) 2010-07-18 13:19:37 +02:00
Daniel Marjamäki c16b5d6f3a Fixed #1857 (XML tag no more included for unusedFunction error (1.44 regression)) 2010-07-18 11:22:26 +02:00
Robert Reif 81a053aa90 Fixed #1311 (false negative: missing const not found in derived classes) 2010-07-18 10:18:41 +02:00
Kimmo Varis 6903f61f69 Update Visual Studio projects. 2010-07-17 17:59:47 +03:00
Kimmo Varis 5d1a10b0a3 Astyle cleanup. 2010-07-17 17:42:17 +03:00
Robert Reif 9c4bbd4c65 Fixed #1730 (False negative in 'variable not initialized in ctor') 2010-07-17 12:26:05 +02:00
Kimmo Varis 6db365e6f7 Improve path name handling in ErrorLogger.
This commit adds setfile() method to FileLocation class. The setfile
method converts in Windows path separators to internally used Unix
separators. And getfile() converts path separators back to Windows
separators. This fixes bugs that error reports had mixed path
separators in paths.
2010-07-17 01:27:40 +03:00
Robert Reif d72365ab00 Fixed #1375 (false negative: uninitialized member variables not found in nested class constructors) 2010-07-15 10:16:16 +02:00
Kimmo Varis d811970531 Merge remote branch 'remotes/kimmo/severity-refactor' 2010-07-14 22:29:02 +03:00
Kimmo Varis fcfa292205 Fix tests after severity-refactor.
Now previously used testSeverity is not valid severity.
2010-07-14 21:12:54 +03:00
Robert Reif fd352865ca CheckClass: Improvements and refactorings for constructors and variables checking 2010-07-14 19:00:52 +02:00
Daniel Marjamäki a6b6022497 Fixed #1851 (false positive: Member variable not initialized int ctor) 2010-07-14 18:50:29 +02:00
Kimmo Varis fa0f6edacf Rename ErrorMessage::toText() to ErrorMessage::toString(). 2010-07-14 18:31:05 +03:00
Daniel Marjamäki bea714445a Fixed #1850 (An access to a nested std::map via a negative integer key is reported as 'Array index out of bounds') 2010-07-14 12:24:07 +02:00
Daniel Marjamäki a1ce80806e Fixed #1844 (False positive: invalid iterator when erase() is used in if-else (with continue)) 2010-07-14 09:42:10 +02:00
Robert Reif c572e6af87 Fixed #1846 (False positive with -s: Variable hides typedef with same name) 2010-07-13 08:08:12 +02:00
Robert Reif ab088bcec9 Fixed #1847 (False positive: Method using std::swap<>() can be declared const) 2010-07-13 08:04:48 +02:00
Daniel Marjamäki 61150498c4 Variable Id: fixed issue with function call. Ticket: #1848 2010-07-12 20:18:03 +02:00
Robert Reif e86e8449f8 Variable usage: better handling of pointer aliasing. Ticket: #1729 2010-07-12 09:50:18 +02:00
Daniel Marjamäki 4b0e3edfa4 Unit Testing: Test that suppressions work 2010-07-09 13:27:15 +02:00
Daniel Marjamäki 2531bb73d7 Fixed #1834 (False positive: invalid iterator when erase() is used in if-else) 2010-07-09 10:50:24 +02:00
Daniel Marjamäki c34c3ee742 Unused functions: Refactoring 2010-07-08 13:01:53 +02:00
Daniel Marjamäki 11a72461f3 Fixed #1835 (false positive: uninitialized variable when using ?) 2010-07-08 11:16:49 +02:00
Robert Reif 566b4b4beb Variable usage: fixed false positive reported in #1729 2010-07-08 08:42:34 +02:00
Robert Reif 2d6dfa57e1 Variable usage: Better aliasing support (Ticket #1729) 2010-07-08 08:00:50 +02:00
Daniel Marjamäki 49626e427e Realloc: changed the error message. I think it's better to mention realloc in the message. 2010-07-07 20:28:15 +02:00
Reijo Tomperi b5da0b8ed2 Fixed #1650 (Cppcheck deadlock)
http://sourceforge.net/apps/trac/cppcheck/ticket/1650
2010-07-07 15:42:39 +03:00
Reijo Tomperi f5d3042635 Add more unit tests 2010-07-07 14:59:42 +03:00
Daniel Marjamäki a1793edabe Fixed #1825 (*log(0) error) 2010-07-07 09:03:40 +02:00
Daniel Marjamäki 4ebf4caf66 Variable usage: only warn about variables that have variable id > 0 2010-07-07 08:50:34 +02:00
Daniel Marjamäki 2bb07a55bd Fixed #1803 (False positive: unused variable: this) 2010-07-07 08:39:18 +02:00
Daniel Marjamäki a107cd1b59 Fixed #1729 (False positive: variable is assigned a value that is never used (pointer aliasing)) 2010-07-07 08:26:24 +02:00
Robert Reif b0f1d5669b Fixed #1829 (### Internal error in Cppcheck. Please report it.) 2010-07-07 07:40:11 +02:00
Daniel Marjamäki dc2a0a6468 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter)) 2010-07-06 21:36:50 +02:00
Daniel Marjamäki 1b20f8d27d Fixed #1824 (false positive: unitialised variable) 2010-07-06 13:18:28 +02:00
Robert Reif 1799e4a575 Fixed #1827 (### Internal error in Cppcheck. Please report it.) 2010-07-06 08:26:30 +02:00
Robert Reif c949a29d1e Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-05 23:03:54 +02:00
Daniel Marjamäki 18a75edd20 Fixed #1823 (tokenize && wrong) 2010-07-05 22:41:02 +02:00
Daniel Marjamäki b02fc037ed Buffer Overrun: Fixed false positive when variable is reassigned in called function 2010-07-05 22:19:27 +02:00
Daniel Marjamäki ae3557fa92 Fixed #1820 (False positive: memory leak (auto deallocated class)) 2010-07-05 14:01:25 +02:00
Daniel Marjamäki b173d5f117 Fixed #1817 (False positive: Resource leak (casting)) 2010-07-05 13:16:33 +02:00
Daniel Marjamäki c811acaa50 Fixed #1818 (False positive: Dangerous usage of strncpy (copying a constant string)) 2010-07-05 12:45:39 +02:00
Robert Reif 28c265b20c Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-02 15:22:29 +02:00
Daniel Marjamäki 3205775eb9 Fixed #1790 (mismatching allocation/deallocation false positive) 2010-06-30 09:21:15 +02:00
Zachary Blair 5ea28ccbba Fixed #157 (Forgetting to put a break in a switch statement) 2010-06-30 00:10:30 -07:00
Daniel Marjamäki c6888845a0 Fixed #1815 (False positive: uninitialized variable when using ? operator) 2010-06-30 08:28:34 +02:00
Robert Reif b33fb48618 Fixed #1816 (Tokenizer: remove restrict keyword) 2010-06-30 08:10:39 +02:00
Daniel Marjamäki 76133e0234 Class checking: Fixed FP for static arrays (not initialized in constructor) 2010-06-29 12:51:18 +02:00
Robert Reif 4668359b51 Fixed #1808 (false positive: uninitialized variable with multiple assignment) 2010-06-29 08:38:24 +02:00
Daniel Marjamäki 46e2f1e64b --author=Robert Reif <reif@earthlink.net>
Fixed #1814 (false positive: Variable hides typedef with same name)
2010-06-28 15:33:27 +02:00
Daniel Marjamäki f82895c1f2 Fixed #1809 (false positive: uninitialized variable with nested if) 2010-06-26 17:15:44 +02:00
Robert Reif 539804369a Fixed #1811 (false positive: Uninitialized variable) 2010-06-26 07:50:53 +02:00
Daniel Marjamäki ad0908cb3f Fixed #1808 (false positive: uninitialized variable with multiple assignment) 2010-06-25 19:39:30 +02:00
Robert Reif f3538dd574 Unit Testing: Added TODO test case for uninitialized member variable in operator=. Ticket: #1813 2010-06-25 07:56:40 +02:00
Robert Reif 38f90dae09 Fixed #1813 (false negative: Member variable not assigned a value in operator=) 2010-06-25 07:52:12 +02:00
Daniel Marjamäki 9fd89d3bdc Fixed #1495 (False -s positive: Member variable not assigned a value in operator=) 2010-06-24 20:09:26 +02:00
Robert Reif 2a1edff77f Fixed #1812 (false negative: functionVariableUsage doesn't support static variables) 2010-06-24 17:00:32 +02:00
Robert Reif 74e48d4bb1 Fixed #1732 (False positive: Variable not assigned a value (pointer to pointer)) 2010-06-23 06:54:14 +02:00
Robert Reif fac9f66cc0 Fixed #1810 (False positive: Variable 'separator' is assigned a value that is never used) 2010-06-22 17:07:41 +02:00
Robert Reif a5b45a7f83 Fixed #1807 (false positive: Variable is not assigned a value (casting function parameters)) 2010-06-22 17:04:11 +02:00
Daniel Marjamäki d22da6088c Fixed #1800 (false positive: memory leak when ptr used as map key) 2010-06-21 18:43:28 +02:00
Robert Reif bdd28b47aa Fixed #1799 (false positive: Variable is assigned a value that is never used) 2010-06-21 18:12:01 +02:00
Martin Ettl 866d66ba78 added testcases for testing dangerous functions: mktemp 2010-06-20 13:32:00 +02:00
Nicolás Alvarez df3d98a7c2 Fix typos in sizeofsizeof error message. 2010-06-19 17:16:14 -03:00
Daniel Marjamäki 85bf4b2be6 Fixed #1795 (false positive: nullpointer dereference (needs to improve Tokenizer::simplifyKnownVariables)) 2010-06-19 17:54:38 +02:00
Daniel Marjamäki 82b63dd736 Fixed #1633 (tokenizer: simplifyKnownVariable: improved handling of arithmetic) 2010-06-19 14:00:45 +02:00
Daniel Marjamäki a402b6bb98 Fixed #1802 (Preprocessor: macros are expanded wrong) 2010-06-19 12:03:39 +02:00
Robert Reif 81403479bd Refactoring testunusedvariables. This fixes #1804. 2010-06-18 07:19:26 +02:00
Robert Reif ec61c6fa26 Fixed #1801 (simplifyTypedef: duplicate typedefs not handled properly) 2010-06-18 07:16:05 +02:00
Reijo Tomperi 0c61454b3f Added test case deadlock_with_many_errors() for ticket #1650
http://sourceforge.net/apps/trac/cppcheck/ticket/1650
The test case is currently commented out, because it would cause tests to hang also.
2010-06-18 00:42:01 +03:00
firewave d6d4b99b85 Removed obsolete checkheaders from Visual Studio projects 2010-06-17 15:00:58 +02:00
Robert Reif f116e74f6e Fixed #1801 (Segmentation fault while scanning Qt's qcups.cpp) 2010-06-17 06:59:01 +02:00
Leandro Lisboa Penz ad4681223b Ticket #1789 is not really fixed; added TODO. 2010-06-16 22:47:05 -03:00
Leandro Lisboa Penz 350810e3c1 Improved test of pointer argument realloc. 2010-06-16 22:46:47 -03:00
Leandro Lisboa Penz 58a872e6a0 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter))
Detecting reallocations in the other function.
2010-06-16 22:29:55 -03:00
Daniel Marjamäki 8a6f4254e0 Fixed #853 (False positive: memory leak for member variable with unknown function) 2010-06-16 19:28:47 +02:00
Robert Reif ee7ad272d6 variable usage: fix false positives when __attribute__ is used. Ticket: #1792 2010-06-16 18:04:31 +02:00
Robert Reif 7dba21858a simplify the alias handling in the checking of variable usage. Ticket: #1729 2010-06-16 18:00:21 +02:00
Robert Reif 61e7e759f0 Fixed #1798 (structure templates) 2010-06-16 07:13:52 +02:00
Daniel Marjamäki dc12a9b3b5 Fixed #1545 (new check: usage of iterator pointing to invalid memory after reserve) 2010-06-15 19:53:09 +02:00
Daniel Marjamäki a42273da63 Fixed #887 (Tokenizer: Simplify variable value after loop) 2010-06-15 17:56:14 +02:00
Zachary Blair efefceabae Fixed #920 (new style check: find empty catch blocks) 2010-06-14 23:45:46 -07:00
Reijo Tomperi c27e631aa2 Add testthreadexecutor.cpp 2010-06-14 23:18:09 +03:00
Robert Reif 98ae660260 Fixed #1792 (false positive: Variable 'test' is assigned a value that is never used) 2010-06-14 15:46:57 +02:00
Daniel Marjamäki cb7e9fbec1 Fixed #1776 (False Negative: Unitialized array) 2010-06-14 08:36:34 +02:00
Daniel Marjamäki e987d2e05b Memory leaks: more specific bailouts to reduce false negatives 2010-06-13 19:00:11 +02:00
Daniel Marjamäki 37ade20dad Added testcase for #1557 (false positive: memory leak) 2010-06-13 10:43:23 +02:00
Daniel Marjamäki 5de124280a Fixed #1783 (false positive: uninitalized variable in constructor/operator=, when calling overloaded functions) 2010-06-13 10:23:59 +02:00
Daniel Marjamäki 70bfa890a8 Fixed #1718 (Tokenizer add close braces to for loop at wrong place when if-else presents inside) 2010-06-13 08:00:46 +02:00
Robert Reif 18bb7488b9 Fixed #1787 (false negative: out of bounds in derived class) 2010-06-13 07:17:50 +02:00
Daniel Marjamäki 76221c0916 Fixed #1510 (false positive '(possible error) Memory leak' when 'a = b = new ...; delete a' (but not b)) 2010-06-12 13:37:44 +02:00
Daniel Marjamäki 3a4a151cc4 reverted 'added a todo testcase for ticket #1788' 2010-06-12 08:36:10 +02:00
Daniel Marjamäki f3fbdc96e1 Fixed #1788 (Tokenizer: template destructor is lost) 2010-06-12 08:32:05 +02:00
Martin Ettl 69ecc24bf5 added a few testcases for checking memory leaks in classes 2010-06-11 13:33:10 +02:00
Martin Ettl 81828742ac added a todo testcase for ticket #1788 2010-06-11 13:23:10 +02:00
Martin Ettl be9c23cb1a added todo-testcase for ticket #1401 2010-06-10 22:49:34 +02:00
Robert Reif 3d2c28a524 Fixed #1784 (false positive: Variable is not assigned a value) 2010-06-10 07:21:47 +02:00
Robert Reif 6b65b77acf Fixed #1782 ((error) ### Internal error in Cppcheck. Please report it.) 2010-06-10 07:18:55 +02:00
Daniel Marjamäki e64ce2e812 Fixed #1781 (false positive: uninitialized variable when using asm statement in macro) 2010-06-09 21:28:15 +02:00
Martin Ettl c9cd5ea250 added a todo testcase for ticket 1778 2010-06-09 01:21:52 +02:00
Robert Reif 00dcec47ac Variable usage: read variable when using syntax '..=*(p);' 2010-06-08 18:26:14 +02:00
Robert Reif f37a7ba934 Variable usage: Added TODO testcases for handling pointer alias. Ticket: #1729 2010-06-06 20:37:48 +02:00
Martin Ettl 0d34416bce added TODO_TESTCASE for ticket 1734: Array index out of bounds 2010-06-06 16:20:50 +02:00
Martin Ettl 2b557cee45 added a TODO testcase for ticket 1724 2010-06-06 12:46:08 +02:00
Daniel Marjamäki 472bd9dabe Fixed #1726 (False negative: null pointer dereference in switch block) 2010-06-06 12:15:31 +02:00
Daniel Marjamäki e140ff6e84 Memory leaks: skipping function call inside allocation 2010-06-06 11:22:59 +02:00
Daniel Marjamäki a9196e8710 Memory leaks: Added allocation function 'g_strdup_printf' 2010-06-06 11:09:19 +02:00
Daniel Marjamäki 68ad8219ed Fixed #1722 (Member variable initialized in call to base class constructor) 2010-06-06 08:29:35 +02:00
Martin Ettl f75ca79849 applied patch from php-coder from ticket 1724; removed TODO_TESTCASES; 2010-06-05 19:49:49 +02:00
Daniel Marjamäki 07e00d57d9 Fixed #1725 (segfault in ExecutionPath::bailOutVar (probably caused by #1721 fix)) 2010-06-05 09:45:35 +02:00
Leandro Lisboa Penz 4ac7da7d51 Fixed #73 (memory leaks not found when calling a function that returns allocated memory through a parameter) 2010-06-04 20:58:50 -03:00
Daniel Marjamäki b11e23eb08 Fixed #1721 (False negative: uninitialized variable in switch block) 2010-06-03 20:02:58 +02:00
Martin Ettl 90a3d29d70 run astyle 2010-06-03 18:23:16 +02:00
Martin Ettl 156a29815f removed a wrong const declaration 2010-06-03 12:55:56 +02:00
Martin Ettl 7b52284177 added a testcase and todo testcases for ticket #1724 2010-06-03 12:51:42 +02:00
Robert Reif 4c4844b722 Fixed #1723 (Variable assigned value which is never used but is thrown) 2010-06-03 07:05:57 +02:00
Daniel Marjamäki cb43168d81 Fixed #1720 (segmentation fault of cppcheck) 2010-06-02 18:10:32 +02:00
Daniel Marjamäki 5789eb116d astyle formatting 2010-06-02 18:09:25 +02:00
Zachary Blair 33b4254d33 Fixed #568 (string functions with command line arguments may overflow buffer) 2010-06-01 22:41:07 -07:00
Daniel Marjamäki a8f38e55dc Added unit test for ticket #1720 2010-06-01 20:00:43 +02:00
Daniel Marjamäki 45821b3871 Fixed #1719 (False negative: memory leak (fgets in condition)) 2010-05-31 18:20:34 +02:00
Daniel Marjamäki 9b1ed1112b Memory leaks: Fixed bug in CheckMemoryLeak::functionReturnType 2010-05-30 20:30:08 +02:00
Daniel Marjamäki 08b6e6ee09 Fixed #1717 (False positive: Resource leak with while) 2010-05-30 13:15:15 +02:00
Daniel Marjamäki 83c62eca9c Tokenizer: simplify loops that continue while errno is EINTR 2010-05-30 12:49:39 +02:00
Daniel Marjamäki 37ae4692bb Uninitialized variables: fixed false negative when using uninitialized variable inside malloc call 2010-05-30 10:30:51 +02:00
Daniel Marjamäki 1ec49430e3 Uninitialized variables: better handling when uninitialized variables are used in function calls 2010-05-30 09:31:10 +02:00
Daniel Marjamäki ab41879246 ExecutionPath: Better handling of 'FOREACH (..) {}' 2010-05-30 09:00:18 +02:00
Daniel Marjamäki f41334e58a ExecutionPath: better handling of 'FOREACH(..){..}' 2010-05-30 08:26:44 +02:00
Daniel Marjamäki 406cbda563 Uninitialized variables: better handling of struct variables 2010-05-30 07:55:11 +02:00
Daniel Marjamäki 46b5e4e79a Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 22:20:10 +02:00
Daniel Marjamäki 0c6352a826 Memory leaks: small fixes. add checking of 'g_fopen'. don't let 'fclose' calls be interpreted as 'callfunc' 2010-05-29 21:56:18 +02:00
Daniel Marjamäki 495dfde32c Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 21:11:59 +02:00
Daniel Marjamäki 24703418bd Fixed #1715 (switch with fallthrough and 'return' confuses cppcheck) 2010-05-29 20:55:09 +02:00
Daniel Marjamäki d09e1df0d7 Fixed #1714 (Wrong precedence for shift operators when simplifying calculations?) 2010-05-29 20:27:08 +02:00
Daniel Marjamäki b702b8542d Memory leaks: enabled the leaks checking when members are not deallocated in the destructor. This checking was previously an --all check so there could be false positives. 2010-05-29 19:29:59 +02:00
Daniel Marjamäki 7601089bee astyle formatting 2010-05-29 11:19:56 +02:00
Daniel Marjamäki 82f030df2c the virtual destructor error message needs to be restricted. marked the checking as inconclusive for now. 2010-05-29 11:19:28 +02:00
Zachary Blair fe1fa4022d Merge branch 'master' of github.com:danmar/cppcheck 2010-05-28 22:53:54 -07:00
Robert Reif 1a25183e8f Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-29 07:52:06 +02:00
Zachary Blair 59086fa599 Fixed #818 (Detect sprintf buffer overrun with struct members) 2010-05-28 22:51:28 -07:00
Robert Reif 3fb0260ef1 Fixed #1713 (remove Microsoft variants of inline) 2010-05-29 07:43:58 +02:00
Robert Reif 26a7d29760 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-28 06:55:54 +02:00
Daniel Marjamäki d3c20cac81 Fixed #1712 (False negative: dereferencing uninitialized pointer) 2010-05-27 19:00:52 +02:00
Robert Reif dc34a1b3ff Fixed #1711 (Wrong typedef name shown when struct declared with __attribute__) 2010-05-27 18:15:42 +02:00
Robert Reif 8881a0c361 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-27 07:00:33 +02:00
Robert Reif 176b41caa5 Fixed #1709 (char buffer that is only accessed with pointers is marker not assigned) 2010-05-26 19:22:35 +02:00
Daniel Marjamäki d23f63c805 astyle formatting 2010-05-26 19:21:34 +02:00
Daniel Marjamäki 88e9a4ade6 Fixed #1704 (false negative: null pointer dereference) 2010-05-26 19:16:42 +02:00
Zachary Blair 619cfbc56f Fixed #168 (buffer overflow: not enough room for the null terminator) 2010-05-26 01:56:34 -07:00
Robert Reif 019e1f9dfe Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-25 20:43:44 +02:00
Robert Reif 4306082fcf Fixed #1708 (False positive for const) 2010-05-25 06:55:49 +02:00
Daniel Marjamäki 5692e7a6f6 Fixed #1707 (false positive: Memory leak) 2010-05-24 19:28:27 +02:00
Daniel Marjamäki c5b946f9b7 Unit Testing: Added a few more test cases related to ticket #1700 2010-05-23 21:03:14 +02:00
Daniel Marjamäki bf8ef94f0c Unit Testing: Added test case for ticket 1700 2010-05-23 20:56:51 +02:00
Daniel Marjamäki 78255fdfc5 Tokenizer: Removed the Tokenizer::simplifyNamespaces. Ticket: #1700 2010-05-23 13:51:41 +02:00
Robert Reif b20cf06b66 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-23 10:46:39 +02:00
Robert Reif 048733a15e false positive: Variable is assigned a value that is never used 2010-05-23 10:41:05 +02:00
Daniel Marjamäki 75c9355e9a Added some multipass checking for the uninitialized variables. It is still experimental. You can activate it with the '--test-2-pass' switch. Some more refactorings are needed to make it truly usable, the main thing is to make it thread safe. 2010-05-21 19:35:18 +02:00
Robert Reif 78614b8dc1 Fixed #1699 (False positive: The function '...' can be const) 2010-05-20 17:45:10 +02:00
Robert Reif 5dfbb38dc9 #1697 (false positive: The function can be const) 2010-05-20 06:52:59 +02:00
Daniel Marjamäki c31accc52a Fixed #1695 (Ticket #1614 is broken using latest from git) 2010-05-19 19:23:09 +02:00
Daniel Marjamäki f87eb774eb Fixed #1646 (False positive: array access after return cannot have default loop value) 2010-05-18 19:55:23 +02:00
Robert Reif 41c43c1790 Fixed #1691 (False positive: Function parameter 'x' is passed by value. It could be passed by reference instead.) 2010-05-18 18:20:11 +02:00
Zachary Blair 1539c0b3d2 Fixed #1649 (add a warning for potential memory leaks when using realloc) 2010-05-17 22:46:48 -07:00
Robert Reif 0d7474042a Fixed #1685 (segmentation fault of cppcheck) 2010-05-18 07:11:23 +02:00
Robert Reif 9dfbd3946a Fixed #1673 (Tokenizer::simplifyTypedef causes segfault for boost library) 2010-05-17 19:58:27 +02:00
Daniel Marjamäki f8442391af astyle formatting 2010-05-17 19:51:35 +02:00
Daniel Marjamäki 49c9413798 Visual Studio 2008: Updated test project 2010-05-17 19:36:52 +02:00
Daniel Marjamäki 268fe0175d asd 2010-05-17 19:18:05 +02:00
Monika Lukow 71e5c56bf9 Fixed #1418 (false negative: buffer access out of bounds) 2010-05-16 23:53:42 +02:00
Erik Lax 20289b1f5b Fixed #1683 (false positive: The function can be const) 2010-05-16 20:26:32 +02:00
Daniel Marjamäki 56d176e1ce Fixed #1684 (false positive: buffer access out of bounds when using extern variable declaration) 2010-05-16 20:21:22 +02:00
Daniel Marjamäki d0e122079f Refactoring: Removed possibleError messages from CheckMemoryLeaks 2010-05-16 19:55:16 +02:00
Erik Lax 19aaa32a99 Fixed #1688 (Tokenizer::simplifyKnownVariables and pointer assignments) 2010-05-16 19:38:44 +02:00
Daniel Marjamäki 01034cd48d Refactoring: Removed 'possible error' message about cin 2010-05-16 19:09:36 +02:00
Daniel Marjamäki 26fab24de4 Refactoring: Removed some inconclusive checking in CheckBufferOverrun 2010-05-16 15:30:39 +02:00
Daniel Marjamäki 6edb2e77b4 Refactoring: Removed Severity::possibleStyle 2010-05-16 14:43:42 +02:00
Daniel Marjamki 14b27f97fa Fixed #1212 (Allow giving used defines in command line) 2010-05-16 07:38:29 +02:00
Daniel Marjamki d7b117402c Code cleanup: Removed autodealloc handling 2010-05-16 07:15:31 +02:00
Daniel Marjamki 8e3c39ae5b Fixed #1678 (false positive: Member variable not initialized in the constructor, for arrays of undefined type) 2010-05-15 20:24:11 +02:00
Erik Lax c0149d3cd1 Fixed #1679 (Bad iterators checks fails to detect bugs with indent levels) 2010-05-15 20:00:41 +02:00
Erik Lax 0510d9a2b0 Fixed #1680 (Bad iterators checks fail to detect invalidation of iterator for deletion by value) 2010-05-15 19:46:42 +02:00
Daniel Marjamki 70d20ac544 Fixed #1681 (false negative: memory leak in operator =) 2010-05-15 19:40:32 +02:00
Daniel Marjamki 972046c4bd Added test CheckOther::sizeofsizeof. Inspired by #1682 2010-05-15 14:06:45 +02:00
Daniel Marjamki 85afa86da3 astyle formatting 2010-05-14 18:40:37 +02:00
Daniel Marjamki 8b1ffefd74 Fixed #1682 (Internal error) 2010-05-14 18:40:15 +02:00
Konrad Windszus c39f80d361 Ticket #1318: Make sure error ids are unique 2010-05-13 22:14:29 +02:00
Robert Reif f8cceface5 Fixed #1677 (False positive: (style) Variable 'xxx' is assigned a value that is never used) 2010-05-13 13:59:41 +02:00
Martin Ettl 1382832bd0 mathlib:isInt() now handles calles of 'u' and 'l' correctly; testcases added 2010-05-12 23:49:09 +02:00
Robert Reif 963108d957 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-11 21:41:33 +02:00
Daniel Marjamäki 84c3ec9c4c Fixed #1669 (Still seeing 'possible style' warnings in 1.43) 2010-05-10 21:22:59 +02:00
Daniel Marjamäki 5d01047ae4 Fixed #1665 ('If you see this, there is a bug': Token::Match('%var% ( %varid% [,)]', 0)) 2010-05-10 18:11:02 +02:00
Robert Reif a390f3c8f4 Better handling of function pointer typedef 2010-05-10 17:50:40 +02:00
Robert Reif ac7515cdcc Fixed #1666 (simplifyTypedef: add support for typedefs of functions) 2010-05-10 07:12:06 +02:00
Daniel Marjamäki d7118c4d36 Fixed #1648 (mismatch allocate and deallocate calls.) 2010-05-09 13:46:13 +02:00
Daniel Marjamäki 7c52c8683d Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf) 2010-05-09 07:48:52 +02:00
Robert Reif be35b72c7e Fixed #1660 (false positive: Variable is assigned a value that is never used, when using cast) 2010-05-09 07:15:40 +02:00
Robert Reif 87a54580a8 Added unit test for #5 2010-05-09 07:10:51 +02:00
Daniel Marjamäki 8971d697b2 Fixed #1656 (dangerous usage of erase not detected: for (; it != it2; ++it) ints.erase(it);) 2010-05-08 20:11:15 +02:00
Daniel Marjamäki 2901434773 Fixed #1658 (false negative: uninitialized pointer usage) 2010-05-08 19:23:46 +02:00
Daniel Marjamäki bd22a18dc1 Refactoring: Changed 'possible style' to 'style' 2010-05-08 09:49:01 +02:00
Daniel Marjamäki d19dd2c61d Fixed #1654 (False positive: Memory leak with: ( delete ( p ) , ( p ) = 0 );) 2010-05-07 18:37:50 +02:00
Zachary Blair 21b7eb61f5 Fixed #959: (new check: wrong usage of fflush()) Simplified and set severity to error 2010-05-06 23:08:10 -07:00
Daniel Marjamäki c8c5f95721 Fixed #1651 (Tokenizer::setVarId wrong handling of return statement) 2010-05-06 18:40:52 +02:00
Daniel Marjamäki 95f3533252 Robert Reif <reif@earthlink.net>
refactoring chained assignments
2010-05-05 19:34:03 +02:00
Daniel Marjamäki af4c4cef34 Fixed #1646 (False positive: array access after return cannot have default loop value) 2010-05-05 18:29:56 +02:00
Robert Reif 4c95264d29 Fixed #1647 (False positive: buffer is not assigned value (assigned through alias)) 2010-05-05 17:31:07 +02:00
Daniel Marjamäki 612be2557b Fixed #1646 (False positive: array access after return cannot have default loop value) 2010-05-04 20:02:47 +02:00
Robert Reif 7ce70777a4 Fixed #1643 (Variable usage (pointer is assigned but never used)) 2010-05-04 17:28:03 +02:00
Robert Reif eb276346c5 Fixed #1639 (False positive: unused variable value (pointer aliasing)) 2010-05-04 17:26:09 +02:00
Zachary Blair 707d27f3d8 Fixed #959 (new check: wrong usage of fflush()) 2010-05-03 23:14:45 -07:00
Daniel Marjamäki 804b2a0952 Fixed #1642 (Tokenizer::simplifyKnownVariables: simplify after loop) 2010-05-02 14:41:21 +02:00
Daniel Marjamäki 0415560912 refactoring: changed the severity for strncatUsage from possibleError to style 2010-05-02 09:54:08 +02:00
Daniel Marjamäki 883d462553 refactoring: Use style severity instead of possible error for the 'The size argument is given as a char constant' 2010-05-02 09:16:45 +02:00
Daniel Marjamäki 136b84eaf5 STL: added testcase for 'if (str.find(%any%)) ..' 2010-05-01 21:56:39 +02:00
Daniel Marjamäki ae576be088 refactoring: enable the 'suspicious pointer subtraction' checking 2010-05-01 21:43:47 +02:00
Robert Reif 6eb16e0f16 Fixed #1640 (False negative: Unused value (variable is assigned but never read)) 2010-05-01 21:15:14 +02:00
Daniel Marjamäki dfde9772e2 astyle formatting 2010-05-01 11:54:04 +02:00
Slava Semushin f50d182750 Fixed #1574 (chain assignments could be simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/1574
2010-05-01 15:28:35 +07:00
Daniel Marjamäki 080374dc04 Fixed #1638 (Tokenizer::simplifyKnownVariables: removing variable declaration) 2010-05-01 10:09:53 +02:00
Robert Reif 4014bd234f Unit testing: Improved test coverage for variable usage checking 2010-05-01 09:26:47 +02:00
Robert Reif 1fa1ff8d14 Fixed #1636 (Fix false positive with strncpy termination check) 2010-04-30 21:36:48 +02:00
Robert Reif 5738f34872 Fixed #1622 (False positive: buf is not assigned a value (pointer aliasing)) 2010-04-30 18:11:51 +02:00
Robert Reif 70d475f8c2 Fixed #1622 (False positive: buf is not assigned a value (pointer aliasing)) 2010-04-29 07:10:50 +02:00
Daniel Marjamäki cccccff96f Fixed #1629 (False negative: null pointer derefence not detected 'c[0] = 0') 2010-04-28 22:07:39 +02:00
Daniel Marjamäki 2666aad207 Fixed #1632 (false positive: unintialized variable) 2010-04-28 21:33:11 +02:00
Daniel Marjamäki d3b5c30c6c Fixed #1628 (false negative: memory leak when using redundant braces) 2010-04-27 20:43:31 +02:00
Robert Reif f0018100e1 Variable usage: Use variable id instead of variable name to identify variable 2010-04-27 05:05:32 +02:00
Daniel Marjamäki 0444ff5298 Fixed #1627 (###### If you see this, there is a bug ###### - Token::Match('%varid% [ %num% ]', 0)) 2010-04-26 18:52:40 +02:00
Daniel Marjamäki 6bb93b5eb7 Fixed #943 (Tokenizer: improve handling of pointer aliasing) 2010-04-25 15:12:47 +02:00
Daniel Marjamäki eb82a89758 ExecutionPath: Better handling of if 2010-04-25 11:55:57 +02:00
Daniel Marjamäki 1a34e7daf6 Fixed #948 (array index out of bound not detected 'a[i-1] = 0') 2010-04-25 07:34:50 +02:00
Daniel Marjamäki e068979d62 Fixed #1440 (false negative: memory leak (function parameters)) 2010-04-24 22:24:03 +02:00
Daniel Marjamäki 8ccd95a643 Fixed #836 (buffer overrun: memmove) 2010-04-24 21:48:58 +02:00
Daniel Marjamäki 5e5b8d3861 Fixed #1146 (improve check: memory leak not detected (allocation in subfunction)) 2010-04-24 20:40:57 +02:00
Daniel Marjamäki a15e25f9fe Fixed #1571 ('C-style pointer casting' should not be reported for C files) 2010-04-24 16:46:09 +02:00
Daniel Marjamäki 6b52730d4e Fixed #1616 (false positive - Upon exception there is a memory leak) 2010-04-24 14:51:10 +02:00
Daniel Marjamäki f3bea249ac Removed the check for unreachable code. The g++ warning -Wunreachable-code is recommended instead. This closes #1603 (break after a return or goto should not be an error in a switch statement). 2010-04-24 14:30:45 +02:00
Daniel Marjamäki 1eafe45c47 Redundant assignment: Added TODO testcase for detecting redundant assignment in inner scope 2010-04-24 12:21:26 +02:00
Daniel Marjamäki e6f640d816 unit testing: Added TODO test case for unused variables when using pointer aliasing. Related with ticket #1622 2010-04-24 10:35:41 +02:00
Robert Reif 2bdcf3b5b2 variable usage: refactoring the checking 2010-04-24 09:45:03 +02:00
Robert Reif 99a7755218 tokenizer improvements: remove calling convention (#1619) 2010-04-24 09:40:05 +02:00
Zachary Blair 5835b2665b Fixed #1169 (improve check: divsion by zero not detected when using the shift (>>) operator) 2010-04-23 22:59:53 -07:00
Martin Ettl 5eb9c78533 added further testcases to multidimensional out of bounds unit test 2010-04-23 22:04:49 +02:00
Martin Ettl bd4bead561 update in todo testcase (line number was wrong) 2010-04-23 21:59:46 +02:00
Martin Ettl 572ae0c1b4 added todo testcases for multidimensional out of bounds checking 2010-04-23 21:56:35 +02:00
Daniel Marjamäki a3b781a181 Fixed #819 (array index out of bounds not detected for multidimension arrays) 2010-04-23 16:26:40 +02:00
Robert Reif f4ce5a37d7 Fixed #1615 (False positive - C-style pointer casting) 2010-04-22 20:08:29 +02:00
Daniel Marjamäki b9d8f52cca CheckBufferOverrun: Fixed false positives caused by refactorings 2010-04-22 19:22:23 +02:00
Zachary Blair 680a470741 Fixed #1564 (CppCheck does not recognise redundant IF) 2010-04-22 01:21:54 -07:00
Robert Reif 90541386da Fixed #1619 (tokenizer: remove calling convention) 2010-04-21 21:08:47 +02:00
Daniel Marjamäki f9f6927e63 CheckBufferOverrun: Don't give false positives when reading from array with strncpy/strncat 2010-04-21 20:02:58 +02:00
Daniel Marjamäki f057e127a0 CheckBufferOverrun: Refactoring the checking of function calls 2010-04-21 19:27:28 +02:00
Daniel Marjamäki 798aa84151 Refactoring: CheckBufferOverrun refactorings. split up the checkScope into two separate functions. The ArrayInfo usage was improved. Also broke out for-loop handling into separate functions. 2010-04-21 18:33:21 +02:00
Zachary Blair c26e619b23 Fixed #855 (Refactoring: move conditions into checks) 2010-04-20 23:38:25 -07:00
Reijo Tomperi 96d66af478 Change "Array index -1 corresponds with 4294967295..." error message into "Array index -1 is out of bounds" 2010-04-20 21:44:31 +03:00
Reijo Tomperi 47234e2dab fileLister_win32.h -> filelister_win32.h 2010-04-20 21:31:38 +03:00
Daniel Marjamäki 7e2f39290d Fixed #1614 (negative array index issues in latest from git) 2010-04-20 16:43:51 +02:00
Robert Reif e8ac1f07d9 Unit Testing: Added TODO testcases for ticket #1593 (false negative: the function can be declared as const) 2010-04-19 21:18:53 +02:00
Reijo Tomperi b11fc0a069 Fix one compiler warning 2010-04-18 22:14:25 +03:00
Daniel Marjamäki 8eff4fcbba Buffer overruns: Added testcase for negative index when using 2-dimensional array 2010-04-18 21:07:21 +02:00
Daniel Marjamäki b6ab419a06 Buffer Overrun: Broke out the checking for negative array index 2010-04-18 20:51:39 +02:00
Robert Reif 76a683a73a Fixed #1602 (functions defined in header outside of class cannot be const) 2010-04-18 15:40:31 +02:00
Daniel Marjamäki a473345f18 Buffer overruns: First change to detect overruns in multidimensional arrays (#819) 2010-04-18 11:08:29 +02:00
Robert Reif bee4608b27 Fixed #1613 (False -s positive: Template instantiation hides typedef with same name) 2010-04-18 09:13:55 +02:00
Robert Reif d90f59051c Fixed #1612 (false positive: The function can be const) 2010-04-18 07:53:39 +02:00
Daniel Marjamäki 6db4ab68ef Unit Testing: added assertions for todo testcases to detect changes 2010-04-17 15:01:18 +02:00
Robert Reif d851b4a3d4 Fixed #1607 (false positive: variable is assigned a value that is never used) 2010-04-17 14:23:29 +02:00
Daniel Marjamäki 9cd8bd842e STL: fixed false negative when erasing invalidated iterator 2010-04-17 13:37:04 +02:00
Daniel Marjamäki 6371327487 Unit Testing: Added assert for todo testcase to catch changes. 2010-04-17 12:51:59 +02:00
Daniel Marjamäki e417d3080a Unit Testing: Added assert for todo testcase to catch changes. 2010-04-17 12:49:27 +02:00
Daniel Marjamäki b19113426f Unused struct member: Fixed false positives 2010-04-17 11:16:05 +02:00
Daniel Marjamäki c0e9a546f7 Refactoring: Refactoring the Settings class 2010-04-17 09:23:54 +02:00
Reijo Tomperi 1b8799e7ef Add test cases for --template parsing 2010-04-16 18:28:00 +03:00
Daniel Marjamäki c9fb5f87e0 Fixed #1600 (false positive: After insert, the iterator 'aI' may be invalid) 2010-04-16 16:56:55 +02:00
Robert Reif 61b5a21ac9 Fixed #1605 (false positive: uninitialized variable) 2010-04-16 16:25:57 +02:00
Robert Reif 45573ad101 Fixed #1607 (false positive: variable is assigned a value that is never used) 2010-04-16 15:57:09 +02:00
Reijo Tomperi 15e4b8dbd5 Fix #1595 (case marks improperly tokenized with macro)
http://sourceforge.net/apps/trac/cppcheck/ticket/1595
2010-04-15 23:21:00 +03:00
Daniel Marjamäki c718a7c595 astyle: Update to astyle 1.24 2010-04-15 20:08:51 +02:00
Daniel Marjamäki 3fa2137ee3 Fixed #1596 ('Index out of bounds' false positive) 2010-04-15 19:09:19 +02:00
Robert Reif 01aa414f32 Fixed #1253 (improve check: uninitialized variable not found when using reference) 2010-04-15 18:44:52 +02:00
Robert Reif 176795ef95 Another fix for #1601 (change simplifyInitVar to split declaration from initialization) 2010-04-15 18:42:11 +02:00
Zachary Blair 2e276576a4 Fixed #1526 (Cppcheck checks redundant configurations) 2010-04-15 18:37:51 +02:00
Robert Reif d2bb4964d0 Fixed #1588 (typedef struct incorrectly simplified) 2010-04-14 19:06:51 +02:00
Robert Reif 3bbb2e1d7f Fixed #1601 (change simplifyInitVar to split declaration from initialization) 2010-04-14 19:04:16 +02:00
firewave 2038684839 Moved shared files back into executable projects - it caused the instances of the checks to be optimized away 2010-04-14 17:52:46 +02:00
firewave 8e20d5b08d Added Visual Studio 2010 soultion and project files 2010-04-14 12:05:10 +02:00
firewave 2a0ac7dd7c Merge branch 'master' of github.com:danmar/cppcheck 2010-04-14 12:04:02 +02:00
firewave e3e2ee35aa Disabled link time code generation for debug builds. Enabled .pdb generation for release builds. 2010-04-14 12:01:45 +02:00
Reijo Tomperi e1fe238f06 Add simple --showtime test case 2010-04-13 23:52:19 +03:00
Reijo Tomperi 9c5e907b5c Fix compiler warning: cast truncates constant value 2010-04-13 23:39:41 +03:00
firewave 4a5463d533 Merge branch 'master' of github.com:danmar/cppcheck 2010-04-13 22:24:12 +02:00
firewave efd18e3d42 More cleanups to the Visual Studio projects. All options are now in line. Also enabled some default options like intrinsic functions, buffer checks and lick time code generation. 2010-04-13 22:22:44 +02:00
Reijo Tomperi 0912836c25 Fix: sizeof(char*) was not simplified correctly 2010-04-13 23:17:27 +03:00
Reijo Tomperi 4a33b226e6 Fix #1599 (false positive on if( (f = fopen("foo", "r")) == ((FILE*)NULL) ))
http://sourceforge.net/apps/trac/cppcheck/ticket/1599
2010-04-13 22:57:52 +03:00
firewave bffc097ab3 Moved shared files to seperate lib project 2010-04-13 21:40:00 +02:00
firewave 2271425dae - cleaned up .vcproj files a bit
- raised the warning level in test.vcproj to 4 to match cppcheck.vcproj.
2010-04-13 21:33:08 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Zachary Blair bd7dc9946e Fixed #1530 (possible new check: strlen return value versus zero.) 2010-04-13 19:30:25 +02:00
Daniel Marjamäki a7903c3385 dos2unix 2010-04-13 19:25:08 +02:00
firewave fef5ee81eb Added test cases for more command-line options 2010-04-13 11:26:45 +02:00
Daniel Marjamäki 05eb894b82 Unit Testing: Better unit testing of Tokenizer::setVarId. Related to ticket #1592 2010-04-12 21:16:47 +02:00
Reijo Tomperi d102369196 Fix #1590 (False negative: Array index out of bounds: "0 <= i")
http://sourceforge.net/apps/trac/cppcheck/ticket/1590
2010-04-12 22:04:59 +03:00
Robert Reif 67fafd4028 Fixed #1588 (typedef struct incorrectly simplified) 2010-04-12 19:05:31 +02:00
Reijo Tomperi 7f7e621ecb More tests added to test/testbufferoverrun.cpp 2010-04-11 23:22:16 +03:00
Reijo Tomperi 9a4cbe0540 Changed CppCheck::parseFromArgs() to return boolean value and reportOut() in case of error.
It used to throw exception and return error message with the exception.
2010-04-11 22:53:21 +03:00
Daniel Marjamäki 6f74c0af5e Fixed #1587 (Crash while processing file) 2010-04-11 20:57:30 +02:00
Reijo Tomperi b063783bc3 Add some unit tests for command line argument parsing 2010-04-11 15:25:30 +03:00
Daniel Marjamäki 5fed938f56 Fixed #1190 (array index out of bounds when index variable is assigned in a condition) 2010-04-10 21:12:00 +02:00
Daniel Marjamäki e17cce6ac4 Unit Testing: Added an ASSERT 2010-04-10 18:54:12 +02:00
Daniel Marjamäki 15da4fe689 Refactoring: simplified test case 2010-04-10 18:50:28 +02:00
Daniel Marjamäki e9b4ea44a2 Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes 2010-04-10 14:05:33 +02:00
Daniel Marjamäki 7763d25847 Fixed #1357 (problem in stl insert method of set template) 2010-04-10 10:22:34 +02:00
Zachary Blair 3152816619 Fixed #779 (Tokenizer: delete register keyword everywhere) 2010-04-10 09:58:09 +02:00
Daniel Marjamäki b4e9185177 Fixed #1134 (improve check: pointer access out of bounds not detected (allocated with malloc)) 2010-04-10 07:57:29 +02:00
Martin Ettl 3388daadc3 ticket 1253 added testcases and one todo 2010-04-09 23:36:32 +02:00
Reijo Tomperi 6dc3860ae9 Fix more -Wshadow compile warnings 2010-04-09 22:40:37 +03:00
Daniel Marjamäki f77dbbb14b Fixed some false positives for unused struct members 2010-04-09 19:55:41 +02:00
Daniel Marjamäki d360c01675 Fixed #1579 (False positive: function can be const when return type is unknown) 2010-04-09 19:15:39 +02:00
Daniel Marjamäki 1328a57103 Fixed #1584 (False positive: (static) Member variable not assigned a value in operator=) 2010-04-09 18:35:54 +02:00
Daniel Marjamäki 38a28e28ec Fixed #1581 (False positives 'The scope of the variable x can be reduced') 2010-04-09 16:53:27 +02:00
Daniel Marjamäki 9a4707c025 Fixed #1576 ('Index out of bounds' false positive) 2010-04-08 19:57:38 +02:00
Daniel Marjamäki 1b81a9d435 Fixed #1537 ('Unused private function' when using pointer to member function) 2010-04-08 19:06:54 +02:00
Robert Reif bc0a318b6d Fixed #1580 (unnamed anonymous struct can segfault) 2010-04-08 17:40:23 +02:00
Robert Reif b651acfc39 Unit testing: Testing handling of Borland C++ properties 2010-04-07 19:19:28 +02:00
Reijo Tomperi a562430f3f Add a few test cases for CppCheck::parseFromArgs 2010-04-06 22:13:23 +03:00
Martin Ettl 2e11805c1a added TODO testcase for checking fwrite() and fread() check for buffer overrun 2010-04-06 20:56:01 +02:00
Robert Reif d498095fa1 Unit Testing: Better code coverage of the operator= checking 2010-04-06 18:26:29 +02:00
Reijo Tomperi c28b365ea0 astyle fix 2010-04-06 16:56:06 +03:00
Martin Ettl c4d1d47f6b fixed ticket 997, now fread and fwrite checked for bufferoverrun 2010-04-06 13:55:03 +02:00
Reijo Tomperi 928163b0cf Fix line number in previously committed unit test 2010-04-05 23:37:30 +03:00
Daniel Marjamäki 0cffe547f9 Unit Testing: Added unit test for untested code in CheckBufferOverrun. Using memset on struct. 2010-04-05 21:50:40 +02:00
Reijo Tomperi d3c251f53a Refactor and fix "After a strncpy() the buffer should be zero-terminated" checking, 2010-04-05 21:47:50 +03:00
Martin Ettl 4bc325f077 #ticket 1513: added sqrt() support 2010-04-05 20:20:20 +02:00
Martin Ettl f895ab9a0d Merge branch 'master' of git@github.com:danmar/cppcheck 2010-04-05 20:08:21 +02:00
Martin Ettl fe7c6aed9f #ticket 1513: added pow() support 2010-04-05 20:07:53 +02:00
Daniel Marjamäki 6327ed55a2 Unit Testing: Buffer overruns when using memchr/memset/memcpy/etc 2010-04-05 20:02:28 +02:00
Martin Ettl 218c18496d #ticket 1513 added fmod() support 2010-04-05 19:45:33 +02:00
Martin Ettl d4923e2a92 added atan2() check to ticket #1513 2010-04-05 19:35:56 +02:00
Daniel Marjamäki 262e5390a0 Refactoring: Renamed TestTOKEN to TestToken 2010-04-05 10:15:30 +02:00
Daniel Marjamäki 61e1c4183f Uninitialized variables: better handling of 'a[b[..]]' when b is not initialized 2010-04-05 09:04:30 +02:00
Daniel Marjamäki d26a2cfc16 Uninitialized variables: Detect reading uninitialized data through array/pointer variable 2010-04-05 08:38:26 +02:00
Daniel Marjamäki f5b1a4db36 Refactoring unit testing 2010-04-04 19:28:15 +02:00
Daniel Marjamäki ba2843883b Added TODO testcase for ticket #1169 (improve check: divsion by zero not detected when using the shift (>>) operator) 2010-04-04 18:48:51 +02:00
Daniel Marjamäki abceff497b Refactoring: some refactoring of ExecutionPath. The foundError was removed. No automatic bailout of all checks are made when errors are found. 2010-04-04 11:24:52 +02:00
Daniel Marjamäki 78852b08ab Fixed #1566 (false negative: uninitialized variable) 2010-04-04 09:17:53 +02:00
Daniel Marjamäki 849be383e6 Tokenizer: tokenize 1E-2 into a single token 2010-04-04 08:01:05 +02:00
Reijo Tomperi be598757a1 Fix segmentation fault when calling with --errorlist and add a testcase for it. 2010-04-03 22:53:06 +03:00
Daniel Marjamäki 6acb304ef2 Cleanup: Removed unfinnished checking of std::find 2010-04-03 15:33:13 +02:00
Martin Ettl 622663b8db added a helper function to mathlib::isNullValue(), it checks wheter a string has a null representation or not and returns a boolian result; extended nullchecks in testmathlib.cpp 2010-04-02 22:41:54 +02:00
Martin Ettl 0f284b477d coverage report fix: more testcases for mathlib::isInt() added in order to get a better coverage 2010-04-02 22:18:50 +02:00
Daniel Marjamäki 427d155644 Fixed #1527 (Function can't be const if it has non-const operator overload call) 2010-04-02 22:03:07 +02:00
Reijo Tomperi a1d0defbc0 astyle fix 2010-04-02 21:42:06 +03:00
Martin Ettl 5a21fe7ae8 Merge branch 'master' of git@github.com:danmar/cppcheck 2010-04-02 20:24:04 +02:00
Martin Ettl c391a03db6 added acos() check to ticket #1513; added testcases for MathLib::toDoubleNumber(), now double conversion of zeros is handled correctly; changed assertEquals() function of testsuite parameters from unsigned int to double. This is needed to avoid overflow of unsigned int by comparing negative floating point values. 2010-04-02 20:23:37 +02:00
Daniel Marjamäki c6bbc9d739 Fixed #1565 (False positive: Uninitialized variable 'B::j'. There are 2 classes with the name 'B') 2010-04-02 19:29:54 +02:00
Daniel Marjamäki 4225544c82 Added TODO test case to reduce false negatives for uninitialized class members 2010-04-02 19:10:05 +02:00
Daniel Marjamäki 734b10e650 Fixed #1479 (false positive: unintialized variable when using goto) 2010-04-02 08:35:05 +02:00
Robert Reif 3507b06e0b Fixed #1563 (false positive: function can be const (assignment to static)) 2010-04-02 08:02:47 +02:00
Robert Reif 1dcbf02bd8 Fixed #1553 (false positive : uninitialized variable for struct timeval from <sys/time>) 2010-04-02 07:36:18 +02:00
Daniel Marjamäki 8b5aae9adb astyle formatting 2010-04-02 07:32:03 +02:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Martin Ettl b5fb01c202 ticket #1513 new check: Detecting obviously wrong math call arguments passed to math functions) 2010-04-02 02:19:38 +02:00
Reijo Tomperi c7d36b73ed Fix #1548 (False positive: array index out of bounds in for-loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/1548
2010-04-01 22:35:36 +03:00
Robert Reif 2825773918 Fixed #1552 (false positive: function can be const (array of struct)) 2010-04-01 17:01:52 +02:00
Robert Reif 2c5fb55c3b Fixed #1551 (false positive: The function 'A::vSet' can be const) 2010-04-01 16:59:35 +02:00
Robert Reif a8c9aa1f8d Fixed #1550 (Improve check: Assignment to self) 2010-04-01 16:40:12 +02:00
Daniel Marjamäki a68d8dbc77 Fixed #1549 (false positive: uninitialized variable) 2010-03-31 20:20:51 +02:00
Robert Reif 78e54e17f2 Unit testing: Added test case for memset. Ticket: #1538 2010-03-31 19:53:53 +02:00
Robert Reif ef57d01f7a Fixed #1492 (false negatives: array index out of bounds) 2010-03-31 17:14:49 +02:00
Robert Reif 7fb5b9b67b Better checking for assignment to self. Ticket: #1550 2010-03-31 17:09:59 +02:00
Robert Reif 32e597e343 Fixed #1539 (False positive: possible error Array index out of bounds) 2010-03-30 17:33:17 +02:00
Daniel Marjamäki c213227133 Fixed #1535 (False positive: member variable not initialized, struct with constructor) 2010-03-29 20:34:47 +02:00
Robert Reif 0bddd1977f Fixed #1536 (###### If you see this, there is a bug ###### Token::Match() - varid was 0) 2010-03-29 17:25:38 +02:00
Daniel Marjamäki c3edc5fd89 Fixed #1148 (improve check: usage of uninitialized variables) 2010-03-28 21:27:06 +02:00
Daniel Marjamäki 9656379ffb Merge branch 'master' of git@github.com:danmar/cppcheck 2010-03-28 15:56:38 +02:00
Robert Reif 62d2845014 Fixed #1492 (false negatives: array index out of bounds) 2010-03-28 15:56:13 +02:00
Reijo Tomperi 417f14fccf Fix #1534 (False positive with #elif (defined NAME))
http://sourceforge.net/apps/trac/cppcheck/ticket/1534
2010-03-28 15:15:25 +03:00
Robert Reif 2dc4222c9a Refactoring: Added CheckClass::isMemberFunc 2010-03-28 11:46:42 +02:00
Daniel Marjamäki 16124ce646 Fixed #1516 (C++Builder properties mistaken for uninitialized variables) 2010-03-28 10:58:03 +02:00
Daniel Marjamäki c7867af3c5 Fixed #1533 (False positive: Uninitialized variable) 2010-03-28 10:42:37 +02:00
Reijo Tomperi 86fabd03b3 Fix #1532 (hang due to commit 772aa95c8a)
http://sourceforge.net/apps/trac/cppcheck/ticket/1532
2010-03-27 21:52:31 +02:00
Reijo Tomperi a18c964efa astyle fix 2010-03-27 21:41:17 +02:00
Martin Ettl e4bda66b28 extended The function can be const test 2010-03-27 14:11:46 +01:00
Robert Reif c50469dba6 Fixed #1523 (false negative:: buffer access out of bounds when using shift operator) 2010-03-27 07:21:08 +01:00
Reijo Tomperi 0cc84bd2be Partial fix for #1475 (False positive: Not enough parameters for macro: #define A(a, b...))
http://sourceforge.net/apps/trac/cppcheck/ticket/1475
2010-03-26 22:11:49 +02:00
Robert Reif 2eceaaefc0 Fixed #1519 (false negative: the function can be declared as const) 2010-03-26 20:14:31 +01:00
Robert Reif 45865f54a8 Fixed #1525 (false negative: the function can be declared as const (member declared as mutable)) 2010-03-26 19:06:00 +01:00
Robert Reif 307000b448 Fixed #1529 (false positive: function can be const (struct member variable)) 2010-03-26 18:16:33 +01:00
Daniel Marjamäki 258e7e292e Fixed #1496 (false positive: Member variable not initialized in the constructor 'X::m_d') 2010-03-26 17:19:33 +01:00
Raphael Geissert c0e09c4cb3 Fixed #1511 (false negative null pointer deref when dereferencing pointers to constants) 2010-03-26 16:44:46 +01:00
Robert Reif a1528d3154 Fixed #1522 (false positive: function can be const (assignment in return)) 2010-03-26 16:30:30 +01:00
Daniel Marjamäki 80edb4d8f4 Tokenizer: Simplify 'false ==' to '!' 2010-03-24 19:55:02 +01:00
Robert Reif e95bc41e59 Fixed #1522 (false positive: function can be const (assignment in return)) 2010-03-24 19:31:30 +01:00
Daniel Marjamäki bef1857221 Preprocessor: Added TODO testcase when using variadic macros 2010-03-24 19:24:53 +01:00
Robert Reif 9808a59cc1 Fixed #1515 (false positive: The function 'wxThreadInternal::SetExitCode' can be const) 2010-03-23 07:37:20 +01:00
Robert Reif 637a34bfd2 Fixed #1517 (false negative: the function can be declared as const) 2010-03-23 07:34:34 +01:00
Daniel Marjamäki 5b1b845750 Fixed #1504 (False positive: Cppcheck incorrectly reports that extern variable is not initialized) 2010-03-20 08:03:18 +01:00
Daniel Marjamäki f687e85be5 Fixed #1498 (false positive: The function 'V<unsigned>::vSet' can be const) 2010-03-19 19:34:26 +01:00
Robert Reif 0fb680d887 Tokenizer: remove unnamed anonymous structures and unions (#1493) 2010-03-19 19:04:56 +01:00
Robert Reif 92fe14e7f0 Fixed #1491 (False positive when putting an access specifier at the end of a class declaration) 2010-03-19 17:40:23 +01:00
Daniel Marjamäki 54c5d53eac Fixed #1428 (False positive: (possible error) Memory leak when memory deleted in destructor) 2010-03-19 16:57:23 +01:00
Robert Reif 9c2248254e Here is a patch that adds support for derived structs and fixes a bug that missed some nested structs. (#1493) 2010-03-19 16:17:25 +01:00
Raphael Geissert d11004fa3d Fixed #1512 (incorrect handling of ndefs in the preprocessor) 2010-03-19 16:13:45 +01:00
Robert Reif 5ea7e32bf9 Partial fix for #1493 (false positives: function can be const and struct or union member is never used) 2010-03-18 18:14:52 +01:00
Daniel Marjamäki 89719b023e unit testing: made Tokenizer functions public so they can be unit tested 2010-03-17 22:08:02 +01:00
Daniel Marjamäki 2441a79c7b unit testing: use const_cast instead of defines 2010-03-17 21:58:53 +01:00
Robert Reif b3856cbc5e Fixed #1506 (typedef name hiding check combined with forward declaration leeds to false positive) 2010-03-17 17:31:08 +01:00
Daniel Marjamäki 12c45a1aba Fixed #1476 (false positive: Uninitialized variable) 2010-03-16 19:53:09 +01:00
Daniel Marjamäki 235404077f Fixed #1501 (false positive: Variable 'n' is assigned a value that is never used) 2010-03-16 19:25:10 +01:00
Daniel Marjamäki 15d67a2369 Fixed #1503 (False positive for uninitialized variable) 2010-03-16 19:09:37 +01:00
Robert Reif 89c57c72c5 small const fix 2010-03-16 07:31:40 +01:00
Daniel Marjamäki 382e41d92a Fixed #1494 (Improve Tokenizer::simplifyKnownVariables to handle for loops better) 2010-03-14 09:57:34 +01:00
Daniel Marjamäki 9fe9be1ea9 Fixed #1465 (false positive: unintialized class member) 2010-03-13 20:24:39 +01:00
Daniel Marjamäki 65ae37de2f Fixed #1460 (false positive: memory leak when using throw no_memory) 2010-03-13 17:11:48 +01:00
Daniel Marjamäki 772aa95c8a Fixed #1477 (false positive: Uninitialized variable when pointer given to struct) 2010-03-13 11:52:48 +01:00
Robert Reif 846a3a0186 Fixed #1491 (False positive when putting an access specifier at the end of a class declaration) 2010-03-13 08:06:20 +01:00
Robert Reif f552ca5462 Fixed #1482 (Improve check const-function: function can be made const when assignment not to member variable (false negative)) 2010-03-12 18:30:20 +01:00
Kimmo Varis 95cbb60974 Fix compiling tests. 2010-03-12 17:21:41 +02:00
Daniel Marjamäki 587081cab5 Fixed #1488 (Invalid warning about shadowed variable) 2010-03-10 16:47:39 +01:00
Robert Reif 09ab841789 Fixed #1486 (--errorlist shows two identical id values) 2010-03-10 07:47:01 +01:00
Daniel Marjamäki dbc235bd39 Function constness: I don't think it's necessary to show both definition and implementation location. I changed so only the location of the definition is shown. This fixes #1486. 2010-03-09 07:29:03 +01:00
Daniel Marjamäki 770d2ff835 Simplify enum: Fixed segmentation fault if code ends with enum type id 2010-03-07 13:01:56 +01:00
Daniel Marjamäki fa493b7fd1 Fixed #1474 (segmentation fault of cppcheck) 2010-03-07 12:50:45 +01:00
Daniel Marjamäki 7f42ed3ad0 Fixed #1472 (false positive: Data is allocated but not initialized: service) 2010-03-07 09:08:52 +01:00
Reijo Tomperi b88126a669 Fix #1469 (False positive: Resource leak when fclose() is inside while)
http://sourceforge.net/apps/trac/cppcheck/ticket/1469
2010-03-06 16:28:52 +02:00
Daniel Marjamäki fe30c1ca9d Fixed #1432 (false positive: uninitialized variable) 2010-03-06 13:48:43 +01:00
Reijo Tomperi 237fdbc653 Fix #1454 (False positive: arrayindexoutofbounds, static member sharing local name)
http://sourceforge.net/apps/trac/cppcheck/ticket/1454
2010-03-06 14:35:04 +02:00
Robert Reif 7c283d1321 Fixed #1321 (Improve check const-function: function that is not implemented inline can be made const) 2010-03-05 17:06:25 +01:00
Daniel Marjamäki 4bb5272760 Fixed #1466 (false positive: Invalid number of character ({) when these macros are defined: '') 2010-03-04 18:51:25 +01:00
Reijo Tomperi d881fd7a31 Partial fix #1464 (takes too long (days) to process some files)
Fix template functions that return "&T".
http://sourceforge.net/apps/trac/cppcheck/ticket/1464
2010-03-03 23:02:32 +02:00
Daniel Marjamäki e207da18a2 STL: don't warn about the suspicious string::find condition because it's not always a bug 2010-03-03 17:11:31 +01:00
Daniel Marjamäki 6ca4b008d0 null pointer: Fixed better error message for 'possible null pointer' + removed redundant check in our Tokenizer. 2010-02-28 07:26:50 +01:00
Daniel Marjamäki 4407aabe55 STL: suspicious condition when using std::find 2010-02-28 07:04:58 +01:00
Reijo Tomperi 88840e6a08 Fix #1453 (possible infinite loop processing GNU Go's engine/montecarlo.c)
http://sourceforge.net/apps/trac/cppcheck/ticket/1453
2010-02-27 23:47:56 +02:00
Daniel Marjamäki 69d6453ea8 STL: suspicious conditions when using find. Added ok testcases and assert that no error message is written 2010-02-27 21:35:33 +01:00
Daniel Marjamäki 4de700c9de STL: suspicious condition when using find on strings and containers 2010-02-27 21:26:11 +01:00
Daniel Marjamäki 50210857a6 Fixed #1439 (false positive: memory leak when using realloc) 2010-02-27 19:41:14 +01:00
Kimmo Varis 839a81a865 Move build products to Build and BuildTmp folders.
This avoids polluting source folders with created/temp files. Also makes it
easier for installer to pick files from consistently named folders.
2010-02-27 21:15:00 +08:00
Kimmo Varis ae58f54230 Projfiles: Fix preprocessor definitions. 2010-02-27 21:15:00 +08:00
Kimmo Varis 7bab8c3c03 Projfiles: fix test project include paths. 2010-02-27 21:15:00 +08:00
Kimmo Varis 6b07097cf4 Projfiles: Use $IntDir and $OutDir as paths where applicable.
Try to also keep outdir clean of unnecessary files and direct most of build-
time files to intdir.
2010-02-27 21:15:00 +08:00
Daniel Marjamäki a8ee4a03f0 Fixed #1456 (PATCH: Variable hides typedef with same name false positive) 2010-02-27 07:27:51 +01:00
Daniel Marjamäki ce0131a1e6 Fixed #1397 (false positive: Memory leak in while loop) 2010-02-26 22:14:56 +01:00
Reijo Tomperi 9b6336013b Fix #1455 (Preprocessor: Wrong line number in "No pair for character" error)
http://sourceforge.net/apps/trac/cppcheck/ticket/1455
2010-02-26 23:11:23 +02:00
Robert Reif 54bf67e766 Fixed #1456 (PATCH: Variable hides typedef with same name false positive) 2010-02-26 21:43:00 +01:00
Robert Reif f4d600e93b Fixed #1457 (PATCH: Variable hides enumerator with same name false negative) 2010-02-26 21:40:57 +01:00
Reijo Tomperi b35acc1e6b Add TODO test case for #1444 (inline suppression suppress all errors of the same type in a function)
http://sourceforge.net/apps/trac/cppcheck/ticket/1444
2010-02-25 22:55:09 +02:00
Reijo Tomperi 13f8e10c40 Add TODO test cases for #1454 (False positive: arrayindexoutofbounds, static member sharing local name)
http://sourceforge.net/apps/trac/cppcheck/ticket/1454
2010-02-25 22:02:12 +02:00
Reijo Tomperi 23407c7f1d Cleanup test/testtokenize.cpp a bit by putting duplicate code into a function. 2010-02-25 22:00:39 +02:00
Daniel Marjamäki 377d3091a9 Fixed #1452 (Simplify goto better) 2010-02-25 20:03:39 +01:00
Robert Reif 0da133f8a0 Fixed #1451 (false positive: operator = should return reference to self) 2010-02-25 07:26:59 +01:00
Robert Reif f9d444ed52 Fixed #1445 (segfault in Tokenizer::simplifyRedundantParanthesis()) 2010-02-25 07:24:32 +01:00
Reijo Tomperi 01c5bdfc68 Add TODO test case for #1452 (Simplify goto better)
http://sourceforge.net/apps/trac/cppcheck/ticket/1452
2010-02-24 22:55:16 +02:00
Robert Reif 7d8adfb4df Fixed #1449 (segmentation fault of cppcheck) 2010-02-24 17:50:02 +01:00
Robert Reif d9df3d5c6e Fixed #1434 (### Internal error in Cppcheck. Please report it.) 2010-02-23 22:12:55 +01:00
Daniel Marjamäki 40bb5144e1 removed some more cmake files 2010-02-23 20:12:53 +01:00
Daniel Marjamäki 0b2ad2164f Fixed #1442 (false positive: getting offset instead of dereferencing a null pointer) 2010-02-22 21:30:21 +01:00
Daniel Marjamäki 8f4edb5e45 Fixed #1409 (False positive: Buffer access out-of-bounds with strncpy and an array in typedef'ed struct) 2010-02-21 15:23:50 +01:00
Daniel Marjamäki d5611a1a06 Fixed #1426 (false positive: returning LPVOID can be const) 2010-02-21 10:19:28 +01:00
Daniel Marjamäki 459a3bac50 Fixed #1396 (false positive: Resource leak) 2010-02-21 09:47:41 +01:00
Daniel Marjamäki 7a72932078 Tokenizer: simple simplification of array sizes 2010-02-20 18:13:09 +01:00
Daniel Marjamäki e4cc8cf1a0 Fixed #1395 (false positive: Possible null pointer dereference) 2010-02-20 15:50:44 +01:00
Daniel Marjamäki ccef1d6eb5 Fixed #1424 (false positive: unintialized variable) 2010-02-20 13:24:50 +01:00
Daniel Marjamäki 084b21494a Fixed #1422 (false positive: uninitialized variable) 2010-02-20 11:43:53 +01:00
Daniel Marjamäki a6c9a6fc54 Fixed #1407 (false positive memory leak when returning pointer to the allocated memory) 2010-02-20 10:17:45 +01:00
Daniel Marjamäki d0348fa57a Fixed #1403 (false positive: The function can be const) 2010-02-20 09:55:51 +01:00
Daniel Marjamäki 6a03fa604c Fixed #1402 (false positive: uninitialized variable) 2010-02-20 09:35:57 +01:00
Robert Reif 24628013f1 Fixed #1427 (new check: check for typedef name hiding) 2010-02-20 09:07:29 +01:00
Daniel Marjamäki 5e90945486 renamed gui/test.cpp to test/test.cxx 2010-02-19 07:21:16 +01:00
Daniel Marjamäki 375d2b1fcd astyle formatting 2010-02-18 19:55:47 +01:00
Daniel Marjamäki b59d79c303 readded checks for unused variables and unreachable code that were removed in 42c608b6f0 2010-02-18 18:45:13 +01:00
Robert Reif 5c6ec0364d Fixed #1411 (### Internal error in Cppcheck. Please report it.) 2010-02-18 07:24:24 +01:00
Robert Reif 9e61e7dda8 Fixed #1405 (false positive: operator = should return reference t 2010-02-17 22:46:03 +01:00
Robert Reif deb71fc566 Fixed #1405 (false positive: operator = should return reference to itself) 2010-02-17 22:42:08 +01:00
Daniel Marjamäki db2c362604 Fixed #1389 (false positive: uninitialized variable) 2010-02-17 18:10:50 +01:00
Robert Reif f15c408f13 Fixed #1388 (enum token/template parameter confusion - False positive) 2010-02-16 07:33:23 +01:00
Reijo Tomperi e44f0b1b8d Fix #1392 (Segfault in CheckBufferOverrun::checkScope)
http://sourceforge.net/apps/trac/cppcheck/ticket/1392
2010-02-15 23:20:09 +02:00
Monika Lukow e9e5174797 Fixed #1333 (Detect access out of bounds 'for (i = 100; i > 0; --i) a[i] = 0;') 2010-02-14 23:10:15 +01:00
Reijo Tomperi b52fa9451f Fix #1385 (False positive: unsigned division)
http://sourceforge.net/apps/trac/cppcheck/ticket/1385
This also fixes a bug in setVarId(). "unsigned int a" didn't get varid,
untill later when unsigned was simplified away.
2010-02-12 22:24:06 +02:00
Daniel Marjamäki 669fe1b23d Fixed #1382 (False positive: uninitialized variable when using assembly to initialize variable) 2010-02-12 18:15:15 +01:00
Reijo Tomperi 2a78637da7 Fix #1340 (False positive: Array out of bounds for re-initialised array pointer)
http://sourceforge.net/apps/trac/cppcheck/ticket/1340
2010-02-10 23:11:08 +02:00
Daniel Marjamäki 0a6aa0f094 Fixed #1376 (Member variable not initialized in the constructor false positive) 2010-02-10 19:28:51 +01:00
Reijo Tomperi faced1b483 Possibly fix #1369 (Internal error - double-declared enum followed by another enum)
http://sourceforge.net/apps/trac/cppcheck/ticket/1369
Don't include same file twice if one is a/a.h and other is a/../a/a.h
2010-02-09 22:26:15 +02:00
Daniel Marjamäki 18e7813e04 Fixed #1373 (###### If you see this, there is a bug ######) 2010-02-09 18:11:06 +01:00
Reijo Tomperi 45abd2d7fc Fix #1366 (void Tokenizer::simplifyTemplates() --> Abort)
http://sourceforge.net/apps/trac/cppcheck/ticket/1366
2010-02-09 00:16:12 +02:00
Daniel Marjamäki 8853f304af Fixed #1364 (False positive: (error) Possible null pointer dereference) 2010-02-08 18:25:08 +01:00
Reijo Tomperi 7e2e20c2d3 astyle fix 2010-02-08 09:35:53 +02:00
Robert Reif 9591e09dd0 Fixed #1344 (false negative: missing const not found) 2010-02-08 07:25:19 +01:00
Monika Lukow 2d5d060514 Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str') 2010-02-07 21:44:11 +01:00
Daniel Marjamäki cd5b95849d Fixed #1361 (### Internal error in Cppcheck. Please report it) 2010-02-07 15:00:19 +01:00
Daniel Marjamäki fb09b2fd37 Fixed #1356 (Double-False positive: uninitialized variable) 2010-02-07 13:34:39 +01:00
Daniel Marjamäki 1b0c81a24b Tokenizer: Fixed bug in setVarId. functions should never have a variable id 2010-02-07 13:04:33 +01:00
Daniel Marjamäki ed8f3bc806 Fixed #1362 (Internal error when using ?-operator and nested {}) 2010-02-07 09:14:59 +01:00
Daniel Marjamäki e1b54df368 Fixed #1346 (False positive: Memory leak when allocated memory is stored elsewhere inside a condition) 2010-02-06 22:35:36 +01:00
Daniel Marjamäki 71117378ef Fixed #1363 (false positive: memory leak) 2010-02-06 21:47:52 +01:00
Daniel Marjamäki 0a31e5e3ee Fixed #1352 (false positive: uninitialized variable) 2010-02-06 16:51:32 +01:00
Robert Reif b78845174d Fixed #1355 (Fixed enum bug when expression contain comma) 2010-02-06 09:49:56 +01:00
Daniel Marjamäki cbc853fdba Partial fix for #322 (get configurations from headers that don't start at the beginning of the file) 2010-02-06 09:30:48 +01:00
Reijo Tomperi fb81100bec Minor fix to previous commit 2010-02-06 00:30:47 +02:00
Reijo Tomperi 35f778716a Test case for #1356 (Double-False positive: uninitialized variable) 2010-02-06 00:24:57 +02:00
Reijo Tomperi 9852ab86e9 Fix #1358 (False negative: out-of-bounds not found near return)
http://sourceforge.net/apps/trac/cppcheck/ticket/1358
2010-02-05 23:55:10 +02:00
Daniel Marjamäki 0d18050b55 Fixed #984 (improve output if strncpy is followed by strncat) 2010-02-05 17:35:18 +01:00
Robert Reif 6cbfc5f894 Fixed #1351 (add expression support to simplifyEnum) 2010-02-05 07:37:17 +01:00
Daniel Marjamäki 9e6ea07c14 CheckClass::noMemset: Refactoring so it handles more complex std template types 2010-02-04 21:49:58 +01:00
Daniel Marjamäki da7e75f69e Class checking: Minor refactoring when analysing memset on class 2010-02-04 20:53:04 +01:00
Daniel Marjamäki 9943262da0 Fixed #1287 (Use of memset on struct - std template types not handled) 2010-02-04 19:40:35 +01:00
Daniel Marjamäki 0ba665d77f Fixed #1337 (Division by zero with __alignof__()) 2010-02-03 21:23:44 +01:00
Daniel Marjamäki d3b5889f88 Fixed #1345 (Not initialised variables warning missing in classes with dllexport) 2010-02-03 20:01:56 +01:00
Daniel Marjamäki b01af012cd Fixed #1342 (Superclass constructors in initializer lists are considered unused functions when superclass has a namespace.) 2010-02-03 18:37:48 +01:00
Robert Reif f2eac901c0 Fixed #1343 (simplifyTypedef doesn't support deeply nested classes) 2010-02-03 07:58:36 +01:00
Daniel Marjamäki 4ec94116f5 Fixed #1341 (false positive 'uninitialized variable' when using Exception specifications) 2010-02-02 19:56:41 +01:00
Robert Reif b704fc7bc7 Fixed #1339 (add nested struct support to simplifyEnum and simplifyTypedef) 2010-02-01 19:59:24 +01:00
Daniel Marjamäki 1b9afc82a4 Reverted 4f30468c80. There was false positives such as #1335 so please fix them and then re-commit. 2010-02-01 19:46:51 +01:00
Kimmo Varis 6f47f77977 CMake - fix building tests for Visual Studio.
Need to include lib sources directly to test project also.
2010-02-01 20:16:30 +02:00
Robert Reif 64afcc8179 Fixed #1338 (simplify typedefs with global and nested namespace) 2010-01-31 21:46:18 +01:00
Reijo Tomperi db2aff03c7 Added test case for #1333 (Detect access out of bounds 'for (i = 100; i > 0; --i) a[i] = 0;')
http://sourceforge.net/apps/trac/cppcheck/ticket/1333
2010-01-31 22:02:26 +02:00
Daniel Marjamäki 1375a60e3f Fixed #1004 (improve check: Unintialized variable not detected when using a reference (&)) 2010-01-31 16:29:12 +01:00
Monika Lukow 4f30468c80 Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str') 2010-01-31 11:42:02 +01:00
Daniel Marjamäki 1a59e1bc68 Tokenizer: remove redundant assignments and variables 2010-01-31 09:52:19 +01:00
Daniel Marjamäki e15a16eb15 Tokenizer: Remove redundant assignments and variables 2010-01-31 09:33:57 +01:00
Daniel Marjamäki e1efad0c27 Tokenizer: remove the keyword 'inline' 2010-01-31 08:11:29 +01:00
Robert Reif d17d199415 Tokenizer: fix for multiple array definitions for a single typedef 2010-01-31 07:16:19 +01:00
Robert Reif 7cbdb9f8a1 Fixed #1331 (simplify typedef of complex arrays) 2010-01-30 19:41:22 +01:00
Daniel Marjamäki 48f3921c36 Null pointer dereference: sending to output stream 2010-01-30 14:40:33 +01:00
Daniel Marjamäki 8716c771a4 Tokenizer: improved the simplifyInitVar 2010-01-30 14:25:11 +01:00
Daniel Marjamäki 3b08712930 Fixed #1005 (improve check: nullpointer dereference not found when it is initialized with NULL-cast) 2010-01-30 09:33:16 +01:00
Robert Reif 882e2225e0 Fixed 1329 (simplify typedef of function pointer returning template) 2010-01-30 08:00:11 +01:00
Daniel Marjamäki f9d5fb3191 Fixed #1327 (False positive: Redundant code: Found a statement that begins with numeric constant) 2010-01-29 22:28:49 +01:00
Reijo Tomperi 1d5ba4e320 Improved updateClassList(), but not yet took it into use.
findClassFunction is now non-static.
updateClassList usage is currently commented out as it doesn't handle class inside a function
2010-01-29 23:22:18 +02:00
Daniel Marjamäki f561441d90 Fixed #1319 (false negative: missing const not found) 2010-01-29 19:38:56 +01:00
Daniel Marjamäki 53f514fc5c Tokenizer: Fixed const simplification 2010-01-29 19:34:43 +01:00
Robert Reif c6263b51b5 Fixed #1324 (show number of tests that don't produce the desired results) 2010-01-29 18:49:07 +01:00
Robert Reif 94c5d92b2b Fixed #1323 (segfault with style in CheckClass::operatorEqRetRefThis()) 2010-01-29 16:04:27 +01:00
Robert Reif fc54ed1eef Fixed #1326 (remove simplified enum definitions) 2010-01-29 15:57:26 +01:00
Daniel Marjamäki 9d11492845 Fixed #1286 (Memory leak not detected) 2010-01-27 22:05:04 +01:00
Daniel Marjamäki e49f7bfa0e Fixed #1315 (mismatched allocation and deallocaton not detected) 2010-01-27 21:02:13 +01:00
Daniel Marjamäki 1c84dc814c Auto variables: Improved handling of temporaries 2010-01-27 19:16:32 +01:00
Robert Reif 45b6b9e5a1 Fixed #1316 (### Internal error in Cppcheck. Please report it.) 2010-01-27 19:03:24 +01:00
Daniel Marjamäki 32fcb8fe18 Auto variables: returning pointer to temporary .c_str() data 2010-01-26 22:11:34 +01:00
Daniel Marjamäki fa305d70bc Fixed #1302 (False positive: Confusion between POSIX open() and class member) 2010-01-26 20:10:52 +01:00
Daniel Marjamäki db0466eb19 Fixed #1278 (Confusing style message formatting) 2010-01-26 19:37:22 +01:00
Daniel Marjamäki e12d115e9a Fixed #1312 (false positive: missing const message on functions returning references) 2010-01-25 21:40:57 +01:00
Robert Reif 8be8c266ac Fixed #1313 (unnamed enums not simplified properly) 2010-01-25 07:45:16 +01:00
Robert Reif 989e8393e4 Fixed #1307 (Internal error with typedef in parameter list) 2010-01-24 22:40:35 +01:00
Daniel Marjamäki 724c55b32a Memory leaks: some refactorings and minor improvements 2010-01-24 21:48:39 +01:00
Daniel Marjamäki 65881b9346 Fixed #1238 (False Negative : memory leak with template class) 2010-01-24 20:04:09 +01:00
Daniel Marjamäki 6d9740adea Tokenizer: Fixed Tokenizer::simplifyKnownVariable bug when the variable is re-assigned in a loop 2010-01-24 19:27:39 +01:00
Daniel Marjamäki 7ce4825f95 Fixed #1308 (False positive: The function 'x' can be const for a static member function) 2010-01-24 18:26:39 +01:00
Daniel Marjamäki 019f775aa5 TestOther::uninitvar1: refactoring. splitting up this function into multiple functions 2010-01-24 15:23:21 +01:00
Daniel Marjamäki b4b97e5706 const: fixed false positive when using increment/decrement 2010-01-24 13:33:30 +01:00
Daniel Marjamäki a0d8f44603 CheckClass: The operator< etc member functions can often be const 2010-01-23 22:36:04 +01:00
Reijo Tomperi 7817d5b142 Fix #1279 (Change error message: Invalid number of character ({). Can't process file.)
http://sourceforge.net/apps/trac/cppcheck/ticket/1279
2010-01-23 23:18:11 +02:00
Daniel Marjamäki 4d7ac2f82e STL: fixed false positive when using erase 2010-01-23 22:03:38 +01:00
Daniel Marjamäki 43c8fe895c Fixed #1301 (False positive: Data is allocated but not initialized) 2010-01-23 21:25:17 +01:00
Daniel Marjamäki aab05524e5 Fixed #1305 (False positive: The function 'x' can be const when indirectly calling a non-const member) 2010-01-23 21:08:40 +01:00
Daniel Marjamäki 9a6b450501 Fixed #1304 (False positive: The function 'x' can be const when modifing a member) 2010-01-23 20:59:20 +01:00
Daniel Marjamäki 5b76be4935 Fixed #1303 (False positive: The function 'x' can be const for a constructor) 2010-01-23 20:47:29 +01:00
Daniel Marjamäki f62466493b New Check: Detect return of invalid reference 2010-01-23 20:39:12 +01:00
Daniel Marjamäki fb10396cb3 only run CheckClass::checkConst if style checking is on 2010-01-23 09:38:35 +01:00
Daniel Marjamäki 35c303943f Partial fix for #13 - detect simple cases of member functions that can be const 2010-01-23 09:19:22 +01:00
Daniel Marjamäki 037ecffc34 detect when function pointer that is null is used 2010-01-23 09:15:30 +01:00
Daniel Marjamäki 7b986c831d Report when using uninitialized function pointer 2010-01-23 07:57:57 +01:00
Daniel Marjamäki 8a9eba980b Function pointers: re-enabled the simplifyFunctionPointers 2010-01-23 07:43:12 +01:00
Robert Reif 13ca2510cc Fixed #1298 ((error) ### Internal error in Cppcheck. Please report it. (typedef in fun proto)) 2010-01-22 20:26:07 +01:00
Daniel Marjamäki 1552c0f7f2 Fixed #1276 (False Uninitialized variable when using goto) 2010-01-22 20:20:43 +01:00
Daniel Marjamäki 59de7934b7 Fixed #643 (Member variable not initialized not detected if any unknown function called) 2010-01-22 18:51:25 +01:00
Robert Reif 9f853cb164 Fixed #1297 (typedef causes internal error in vlc/modules/access/imem.c) 2010-01-22 17:27:40 +01:00
Daniel Marjamäki d4b13eee9f Fixed #1290 (1.40: Internal error) 2010-01-21 20:05:32 +01:00
Daniel Marjamäki 2e707974d0 Fixed #1273 (scope of variable limited not detected in latest versions) 2010-01-21 18:50:56 +01:00
Robert Reif 9f0b9551cf This patch simplifies the function pointer return type code and allows more complex return types. 2010-01-21 18:01:09 +01:00
Robert Reif e9e64033e7 Improved typedef simplification of function pointers 2010-01-21 07:51:08 +01:00
Daniel Marjamäki a6e81c2ee7 Fixed #1293 (Things to add to call_func_white_list) 2010-01-20 22:03:06 +01:00
Daniel Marjamäki 3447030564 Merge branch 'master' of git@github.com:danmar/cppcheck 2010-01-20 21:19:32 +01:00
Daniel Marjamäki 96359b14ff Simplify function pointers 2010-01-20 21:19:06 +01:00
Robert Reif e163f878ab Handle/simplify function pointer typedefs 2010-01-20 21:16:40 +01:00
Reijo Tomperi b83d257852 Fix #1296 (false positive: index out of bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/1296
2010-01-20 21:26:54 +02:00
Daniel Marjamäki 85fcd4c9a9 Fixed #1282 (False positive for a memory leak in a simple loop) 2010-01-19 19:08:03 +01:00
Daniel Marjamäki f49cc7f0ff CheckMemoryLeak: Added 'scanf' and 'sscanf' to the whitelist 2010-01-18 21:58:27 +01:00
Daniel Marjamäki 32604dd55e Fixed #1266 ('qsort' missing in call_func_white_list) 2010-01-18 21:34:11 +01:00
Robert Reif cd31cd9298 Fixed #1251 (tokenize typedef of reference) 2010-01-18 19:06:50 +01:00
Daniel Marjamäki fbf428550a Fixed #1262 (cppcheck false positives: 'Possible null pointer dereference', 'Uninitialized variable') 2010-01-17 19:08:45 +01:00
Daniel Marjamäki 3aa67cd537 Added TODO test for better pointer aliasing with memset 2010-01-17 08:43:10 +01:00
Robert Reif 70dbb8ba17 Fixed #1275 (Cppcheck hangs when analysing the code 'typedef struct { } A, *B, **C;') 2010-01-17 08:16:17 +01:00
Daniel Marjamäki fbefb8df34 Fixed #1272 (links in typedef not handled correctly) 2010-01-16 19:42:37 +01:00
Robert Reif a0caea4ee6 Refactoring the handling of typedefs 2010-01-16 09:18:21 +01:00
Reijo Tomperi d37864f8c4 Fix part of #1262 (cppcheck false positives: 'Possible null pointer dereference'
http://sourceforge.net/apps/trac/cppcheck/ticket/1262
2010-01-15 23:46:47 +02:00
Daniel Marjamäki ac077d3160 Fixed #1264 (False positive: Resource leak with if-else in while) 2010-01-14 21:41:50 +01:00
Daniel Marjamäki a7bddc8fd3 Fixed #1268 (Null pointer dereference false positive) 2010-01-14 20:02:38 +01:00
Daniel Marjamäki cefa695dba Fixed #1265 ((error) Uninitialized variable on macro expansion) 2010-01-13 19:37:55 +01:00
Robert Reif 0212225859 Tokenizer: fixed typedef issues 2010-01-13 07:59:47 +01:00
Daniel Marjamäki 2de49129dc Fixed #1259 (false postive: Member variable 'A::b' is not assigned a value in 'A::operator=') 2010-01-12 21:36:40 +01:00
Daniel Marjamäki 2358c51694 Tokenizer: some cleanup of std:: 2010-01-12 21:25:31 +01:00
Reijo Tomperi 913ede45aa Get rid of casting in test file.
http://sourceforge.net/apps/trac/cppcheck/ticket/1242
2010-01-12 21:24:44 +02:00
Daniel Marjamäki 374def4a53 Fixed #1070 (Improve scope error message) 2010-01-12 19:34:33 +01:00
Daniel Marjamäki 814eb6caee Fixed #1257 (potential leaks not reported becauseof 'continue' in loop) 2010-01-12 19:12:08 +01:00
Robert Reif 5e8e4fd3e9 Fixed #1252 (Internal error in Cppcheck while parsing struct) 2010-01-12 17:38:36 +01:00
Robert Reif 7b6bf80057 Fixed #1250 (tokenize typedef of union) 2010-01-11 22:58:57 +01:00
Daniel Marjamäki d3b7f5931f Fixed #1174 (improve check: Unintialized variable not detected in subfunction) 2010-01-11 22:28:07 +01:00
Daniel Marjamäki c666a9662b BufferOverrun: negative index is out of bounds 2010-01-11 21:18:07 +01:00
Daniel Marjamäki b8b6b0ec32 Uninitialized variables: fixed false positives when using pointer aliasing 2010-01-11 19:25:01 +01:00
Robert Reif 94d5e32aa1 Fixed #1248 (tokenize typedef of array) 2010-01-11 17:09:04 +01:00
Daniel Marjamäki 8be54b592d ExecutionPath: better handling of for/while/do/switch, it doesn't bail out everything 2010-01-10 22:05:51 +01:00
Daniel Marjamäki c5966bba59 Fixed #1225 (false negative :: uninitialized variable not detected when using enums) 2010-01-10 20:36:15 +01:00
Daniel Marjamäki 3fb420cbf0 fixed unlogged errors from the tokenizer and also some errors reported by valgrind 2010-01-10 20:03:46 +01:00
Daniel Marjamäki 1c69d54fb3 ivoire: 64-bit portability fix 2010-01-10 17:30:35 +01:00
Daniel Marjamäki a50ec2eded memory leaks: better handling of loops and switch 2010-01-10 15:40:50 +01:00
Daniel Marjamäki f65bf6d565 Fixed #1220 (False memory leak when using while) 2010-01-10 14:00:32 +01:00
Daniel Marjamäki 3fabe53570 Memory leaks: Better handling of switch 2010-01-10 10:37:54 +01:00
Daniel Marjamäki b82cb2e41e Fixed #1218 (Improve check: incrementing uninitialized variable i++) 2010-01-10 09:09:37 +01:00
Robert Reif 19ba151531 Fixed #1244 (tokenize typedef of unnamed struct) 2010-01-10 08:49:02 +01:00
Daniel Marjamäki 4c641ed80c Fixed #1189 (false negative: using uninitialized variable i 'a[i] = 0;') 2010-01-09 22:26:05 +01:00
Daniel Marjamäki 0908728601 Fixed #1231 (Preprocessor: Fail to evaluate '#if ! defined _ABCD_') 2010-01-09 21:54:20 +01:00
Daniel Marjamäki 2dd0907146 fixed segmentation fault 2010-01-08 21:54:24 +01:00
Daniel Marjamäki ca74f57fd0 Fixed #1237 (Uninitialized variable false positive for return-value pattern in pan source code.) 2010-01-08 21:24:48 +01:00
Robert Reif 60ef3ef872 Fixed #1233 (false positive: operator = should check for assignment to self) 2010-01-08 19:15:24 +01:00
Daniel Marjamäki 686137415f Fixed #1235 (CheckMemoryLeakInFunction: Wrong handling of 'fcloseall') 2010-01-07 21:36:51 +01:00
Robert Reif b30b07beee Fixed #1232 (segmentation fault of cppcheck when scanning templates) 2010-01-07 18:09:35 +01:00
Daniel Marjamäki 57d1da3910 Ticket #1228 : Handle tokensBack in the Token class. When adding&removing tokens the Token class can make sure that this pointer is updated accordingly. It is very important that the tokensBack has the same scope as the token list, otherwise there will be a dead pointer problem. 2010-01-06 20:19:27 +01:00
Daniel Marjamäki 485f3c7708 Fixed #1221 ([False positive] Member variable not initialized with operator[] gives wrong result) 2010-01-06 19:04:15 +01:00
Robert Reif e6cc897e29 Fixed #1224 (segmentation fault of cppcheck) 2010-01-05 21:55:33 +01:00
Kimmo Varis a753c41ced CMake - Include test project's header file to VS IDE project. 2010-01-05 22:16:53 +02:00
Robert Reif 13f627d0d5 Fixed #1215 (are enums processed properly?) 2010-01-04 17:22:06 +01:00
Daniel Marjamäki e248f7d3e5 Fixed #1023 (improve check: Unintialized variable not detected when using +=) 2010-01-03 18:49:13 +01:00
Daniel Marjamäki e6d5c76138 refactoring 2010-01-03 15:52:52 +01:00
Daniel Marjamäki 79223b71d5 added test case for #1193 (false negative: array out of bounds in loop when there is calculation) 2010-01-03 15:49:17 +01:00
Daniel Marjamäki e286896d75 Fixed #1216 (false positive: uninitialized variable when using exit|abort) 2010-01-03 15:35:32 +01:00
Daniel Marjamäki fa535ff3ae Fixed #440 (NULL referencing not detected) 2010-01-03 13:30:20 +01:00
Robert Reif 2a546dc9c0 Fixed #1184 (improve test: operator =) 2010-01-03 08:26:02 +01:00
Daniel Marjamäki 1032eb2449 Fixed #1214 (false positive: uninitialized variable 'bool fixed = std::ios_base::fixed;') 2010-01-03 08:03:28 +01:00
Daniel Marjamäki 38b480a4b5 Fixed #1203 (Preprocessor: Doesn't handle macros usage that contain ';') 2010-01-02 20:54:52 +01:00
Daniel Marjamäki d82079e86f Fixed #1209 (False positive: uninitialized variable c when it is initialized with 'ab(sizeof(xyz), &c)') 2010-01-02 18:16:44 +01:00
Robert Reif bcafb30d0d Fixed #1211 (add struct support for constructor checks) 2010-01-02 17:29:55 +01:00
Daniel Marjamäki 2e62a3f4c7 Fixed #1202 (false positive: uninitialized variable when using 'do') 2010-01-02 09:08:36 +01:00
Daniel Marjamäki 6af5e434d8 Fixed #1204 (Tokenizer::findClassFunction broken) 2010-01-02 08:33:54 +01:00
Slava Semushin 82ae064218 Fixed #1013 (autovariables: detect when assigning parameter **par)
http://sourceforge.net/apps/trac/cppcheck/ticket/1013
2010-01-02 03:53:34 +06:00
Slava Semushin b816968f28 Fixed #1197 (Segmentation fault when we define function which was already defined by preprocessor)
http://sourceforge.net/apps/trac/cppcheck/ticket/1197
2010-01-02 03:25:37 +06:00
Daniel Marjamäki ddfd0b948e Fixed #1178 (1.39: Internal error) 2010-01-01 21:06:30 +01:00
Daniel Marjamäki 071b7b463d Fixed #1200 (false positive 'uninitialized variable' when using throw) 2010-01-01 20:12:39 +01:00
Daniel Marjamäki f8bd59f5b5 Fixed #1191 (false positive: uninitialized variable) 2010-01-01 19:43:02 +01:00
Daniel Marjamäki 77c5b793c9 Fixed #1196 (Hang: Cppcheck hang for the file linux-2.6/drivers/crypto/hifn_795x.c) 2010-01-01 13:26:54 +01:00
Daniel Marjamäki 7ecd333ffa Fixed #1188 (false negative: dereferencing p, which is a null pointer 'int y = 5 + *p') 2009-12-31 20:00:20 +01:00
Daniel Marjamäki e0ecef5d71 fixed a hang in Tokenizer::simplifyFunctionParameters 2009-12-31 19:31:21 +01:00
Daniel Marjamäki 774e331dea Self assignment in class: added TODO test cases to reduce false positives 2009-12-31 14:03:35 +01:00
Robert Reif 12641e2d76 Fixed #1184 (improve test: operator =) 2009-12-31 13:44:03 +01:00
Daniel Marjamäki 0159287437 Fixed #1183 (False positive: uninitialized variable p 'd = bar(sizeof(*p));') 2009-12-31 09:10:20 +01:00
Daniel Marjamäki 0ee3d7e46a Fixed #1182 (False positive: uninitialized variable 'int *pa = &a;') 2009-12-30 21:42:15 +01:00
Daniel Marjamäki 6c0919d9bd Fixed #1173 (Improve check: memory leak not detected in constructor) 2009-12-30 21:29:54 +01:00
Robert Reif f8f0a31e41 Fixed #1167 (### Internal error in Cppcheck. Please report it.) 2009-12-30 20:56:16 +01:00
Daniel Marjamäki ae3ff7d376 Fixed #1087 (uninitialized data not detected 'char z = *str') 2009-12-30 20:37:11 +01:00
Daniel Marjamäki 461d826eff Fixed #1105 (improve check: uninitialized variable not detected for 'a = a') 2009-12-30 20:15:44 +01:00
Robert Reif 3a46ef0487 Fixed #1176 (void operator = check doesn't support struct) 2009-12-30 18:40:02 +01:00
Daniel Marjamäki d83131ca92 Fixed #1041 (passing a nullpointer to a reference) 2009-12-30 17:42:41 +01:00
Daniel Marjamäki a7ab47bb98 Fixed #1067 (Tokenizer: K&R style function that returns function pointer) 2009-12-30 15:12:38 +01:00
Daniel Marjamäki 06ee643c6a Fixed #1177 (False positive: pointer is not dereferenced 'sizeof(*p)') 2009-12-30 11:32:46 +01:00
Daniel Marjamäki 2de2ecafe4 Fixed #1168 (false positive: Uninitialized variable) 2009-12-30 08:24:27 +01:00
Daniel Marjamäki 2a28ca72cc Fixed #1166 (improve check: using uninitialized pointer to create reference 'int &r(*p);') 2009-12-29 20:36:20 +01:00
Daniel Marjamäki 71b328d703 Robert Reif: Fixed #1163 (post increment test broken for complex template types) 2009-12-29 19:24:48 +01:00
Daniel Marjamäki 160f795710 Fixed #1165 (Tokenizer: wrong simplification of 'do { .. } while (0)' if the body contains continue or break) 2009-12-29 12:15:39 +01:00
Daniel Marjamäki cfdf2b8cfe Fixed #1160 (Null pointer dereference vs. goto) 2009-12-29 09:17:07 +01:00
Daniel Marjamäki 905533552d Robert Reif: Fixed #1164 (only first void operator = found) 2009-12-29 07:48:37 +01:00
Daniel Marjamäki 84ce6ba75a Robert Reif: Fixed #1162 (add support to tokenize typedefs with templates) 2009-12-29 07:28:00 +01:00
Daniel Marjamäki 61e61c1584 Robert Reif: Fixed #1158 ((possible style) message with regular check) 2009-12-28 18:06:26 +01:00
Daniel Marjamäki 28f2bf2150 Robert Reif: Fixed #1161 (add tokenize support for typedefs with enum definitions) 2009-12-28 17:57:52 +01:00
Daniel Marjamäki 9aca2e7680 Fixed #1156 ([False positive] Uninitialized variable - class member in constructor) 2009-12-28 12:51:28 +01:00
Daniel Marjamäki 197bcf17ba Tokenizer: Simplify 'while (0)' better 2009-12-28 08:37:34 +01:00
Daniel Marjamäki b1e963fe2c Fixed another issue with #1154 (false positive: Data is allocated but not initialized) 2009-12-27 18:00:43 +01:00
Daniel Marjamäki 24c5f4d53c astyle formatting 2009-12-27 17:46:24 +01:00
Daniel Marjamäki 1c0f3ee179 Fixed #1154 (false positive: Data is allocated but not initialized) 2009-12-27 17:35:18 +01:00
Daniel Marjamäki 738987a686 Fixed #1138 (improve check: dereferencing uninitialized pointer) 2009-12-27 17:20:34 +01:00
Martin Ettl c3886a5803 added further testcases to testmathlib::convert(); now the conversion of +-[hexnumber|octalnumber] works correctly 2009-12-27 15:18:18 +01:00
Martin Ettl f06adb18cd added further testcases to testmathlib::isint() 2009-12-27 14:46:47 +01:00
Martin Ettl c2b3cfccc9 extended testcases of mathlib; fixed zero conversion: +0 and -0 is converted to 0 2009-12-27 14:30:23 +01:00
Daniel Marjamäki c7cede1d76 Fixed #972 (New check: return pointer of stack memory) 2009-12-27 13:08:41 +01:00
Daniel Marjamäki fbfe5a4bd1 Fixed #1153 (False positive: uninitialized data for reinterpret_cast) 2009-12-27 09:27:05 +01:00
Daniel Marjamäki afad0205c4 Fixed #1120 (Test compile warnings with Cygwin) 2009-12-26 17:49:05 +01:00
Daniel Marjamäki ab7ffd2391 Uninitialized variables: Fixed false positive for 'if (ptr)' 2009-12-26 16:22:14 +01:00
Daniel Marjamäki a82a085d10 Fixed #1151 (false positive: Data is allocated but not initialized) 2009-12-26 09:30:02 +01:00
Daniel Marjamäki 9819b75e17 ExecutionPath: Refactoring if-handling 2009-12-25 20:50:23 +01:00
Daniel Marjamäki b5291825ce Fixed #683 (wrong usage of strcmp) 2009-12-25 19:45:21 +01:00
Daniel Marjamäki 5925b88b38 Robert Reif: improve check: array index out of bounds, show name of array, array size and array index 2009-12-25 15:25:58 +01:00
Daniel Marjamäki 44a629ec74 Fixed #1141 (Tokenizer: Wrong simplification of calculations) 2009-12-25 14:47:15 +01:00
Daniel Marjamäki 9b05850e97 fixed unit testing 2009-12-23 20:00:12 +01:00
Daniel Marjamäki ea51c3e098 Refactoring the uninitialized variable / null pointer checks so they use a common function to inspect function calls 2009-12-23 19:51:32 +01:00
Daniel Marjamäki a7d48f2eb4 Fixed #1147 (Improve check: return uninitialized variable) 2009-12-23 17:55:03 +01:00
Daniel Marjamäki b6c320de8a Fixed false positives about uninitialized variables 2009-12-23 15:01:23 +01:00
Daniel Marjamäki ef21ba7425 Fixed #1137 (false positive: uninitialized variable when using a class object) 2009-12-23 13:57:01 +01:00
Daniel Marjamäki 5a89cc3259 Robert Reif: Fixed #1139 (false negative: CheckOther::postIncrement() only finds at most one problem) 2009-12-23 13:38:54 +01:00
Daniel Marjamäki fe74c65c89 Robert Reif: code cleanup 2009-12-23 12:17:48 +01:00
Daniel Marjamäki 2bd60ab6c8 Fixed #1133 (Uninitialized array: strchr, strrchr, etc) 2009-12-22 21:08:29 +01:00
Daniel Marjamäki 566cfce8da Fixed #1128 (false positive: Data is allocated but not initialized) 2009-12-22 21:00:52 +01:00
Daniel Marjamäki c05aebbc0a Fixed #1112 (cppcheck fails because of accented characters in comments) 2009-12-22 20:38:12 +01:00
Daniel Marjamäki 4dac46b2d7 Fixed #1127 (Segfault with template) 2009-12-22 20:10:08 +01:00
Daniel Marjamäki aaf908bd5e astyle formatting 2009-12-22 19:18:02 +01:00
Daniel Marjamäki 11da89784f Eric Sesterhenn: Fixed #1130 (False positive uninitialized variable) 2009-12-22 19:16:34 +01:00
Daniel Marjamäki b4b63789fc Eric Sesterhenn: Fixed #1131 (descriptor leak false positive) 2009-12-22 19:13:46 +01:00
Daniel Marjamäki 5b87a51aa5 Robert Reif: Fixed #1108 (Only trivial typedefs are tokenized properly) 2009-12-22 19:10:33 +01:00
Daniel Marjamäki 2e0566bf7a Fixed #1096 (Non-obvious error message: Overlapping data buffer) 2009-12-21 21:05:55 +01:00
Daniel Marjamäki 72bf1c1dbe Fixed #1095 (Non-obvious error message: Dangerous usage of erase) 2009-12-21 20:49:16 +01:00
Daniel Marjamäki 83d5a72659 Fixed #1126 (False positive: upon exception there is memory leak (calling unknown function)) 2009-12-21 20:04:55 +01:00
Daniel Marjamäki b3b07321ca ericsesterhenn: Fixed #1091 (improve check: nullpointer dereference not detected) 2009-12-21 19:09:13 +01:00
Reijo Tomperi df0d2ca83c Fix #1124 (Invalid number of character ((). Can't process file.)
http://sourceforge.net/apps/trac/cppcheck/ticket/1124
2009-12-20 23:50:57 +02:00
Daniel Marjamäki 11c7b8a839 Execution Path: some refactorings of the checking 2009-12-20 19:44:32 +01:00
Daniel Marjamäki d9cf70c1c6 Fixed #1119 (false positve: uninitialized variable y when y is assigned in inner expression 'x = (y = 10)') 2009-12-20 13:55:17 +01:00
Kimmo Varis eb8c6aec55 CMake - add 'make check' -target.
Tests are now excluded from normal targets to make compiling
faster. 'make check' -target will compile and run tests.
2009-12-20 11:16:56 +02:00
Kimmo Varis 9e2a42ebf9 CMake - use more strict compiler flags. 2009-12-20 10:45:57 +02:00
Daniel Marjamäki e7c0e4d482 Fixed #1093 (False positive: missing constructor) 2009-12-19 17:58:52 +01:00
Daniel Marjamäki 8a1940e043 astyle 2009-12-19 17:57:58 +01:00
Kimmo Varis 2fb6c21509 Merge branch 'master' of github.com:danmar/cppcheck 2009-12-19 16:55:15 +02:00
Daniel Marjamäki 95f652a2b4 robert reif: Fixed #1118 (new check: use empty() instead of checking size() against zero) 2009-12-19 15:24:59 +01:00
Kimmo Varis 41eb141e61 CMake - cleaner way to set additional library for Windows. 2009-12-19 16:21:46 +02:00
Daniel Marjamäki 69a98d81fc Fixed #1107 (False positive: Dangerous usage of erase, when using std::list) 2009-12-18 20:55:51 +01:00
Daniel Marjamäki b3a055e20a Fixed #1101 (link error with latest git in Visual Studio) 2009-12-18 18:29:31 +01:00
Daniel Marjamäki 0da0b5ffed ericsesterhenn: Fixed #1106 (check if buffer is zero terminated after a strncpy) 2009-12-18 17:26:15 +01:00
Kimmo Varis d70c60b702 CMake - Fix Windows build. 2009-12-17 22:31:13 +02:00
Kimmo Varis 6e540e615d Add testsuite to CMake build files. 2009-12-15 22:27:17 +02:00
Daniel Marjamäki 1680d1fb42 Fixed #1086 (segmentation fault of cppcheck '#if define(A)+define(B)+define(C)!=1') 2009-12-15 20:18:32 +01:00
Daniel Marjamäki e03ff727d4 Fixed #1103 (false positive: uninitialized variable when using references) 2009-12-15 19:50:48 +01:00
Daniel Marjamäki 368df4c083 TestLocalLeaks: going out of scope 2009-12-15 19:27:07 +01:00
Reijo Tomperi 30f789a168 Fix #1076 (Invalid number of character ({). Can't process file.)
http://sourceforge.net/apps/trac/cppcheck/ticket/1076
2009-12-15 00:06:05 +02:00
Daniel Marjamäki 0c13f9ba5c Added TestLocalLeaks 2009-12-14 20:30:31 +01:00
Reijo Tomperi 42c2437f78 Test case for #1076 (Invalid number of character ({). Can't process file.) 2009-12-13 22:36:42 +02:00
Daniel Marjamäki 4dc8794c69 Fixed #1082 (False positive: Resource leak in loop which exits only after releasing resource) 2009-12-13 19:50:49 +01:00
Daniel Marjamäki 829a4f8453 Fixed #1084 (define configuration lost) 2009-12-13 17:18:27 +01:00
Daniel Marjamäki b4a454fc47 Fixed #1058 (Preprocessor: extracting configuration for '#if DEF == 1') 2009-12-13 15:23:44 +01:00
Daniel Marjamäki 01cfa3b6bd Fixed #1072 (False positive: class member initialization with '*p=0;') 2009-12-13 09:36:59 +01:00
Daniel Marjamäki bc808710a0 Fixed #1097 (Internal error: When macro is not expanded 'ABC(for (i=0;i<10;i++) ..);') 2009-12-12 19:58:19 +01:00
Daniel Marjamäki 1002457b17 Fixed #1074 (Exception safety: auto deallocated classes don't leak) 2009-12-12 18:56:26 +01:00
Daniel Marjamäki c6f913ac3e Preprocessor: Fixed TODO_ASSERT_EQUALS 2009-12-11 22:32:44 +01:00
Daniel Marjamäki 4d185f0935 Fixed #1080 (false positive: member variable not initialized) 2009-12-11 21:34:04 +01:00
Daniel Marjamäki 9646f62ec1 Fixed #1075 (False positive: uninitialized variable 'return bar(s);') 2009-12-11 19:58:29 +01:00
Daniel Marjamäki e52fb36c5c Fixed #1060 (Preprocessor: wrong define handling) 2009-12-11 19:28:37 +01:00
Daniel Marjamäki 91114c50d2 Fixed #1061 (false positve: uninitialized variable) 2009-12-09 20:05:06 +01:00
Daniel Marjamäki e2473314b5 Fixed #1024 (Preprocessor: doesn't expand macro in macro) 2009-12-09 19:14:07 +01:00
Daniel Marjamäki 418d93eafb Preprocessor: Refactoring the Preprocessor::expandMacros 2009-12-09 17:13:48 +01:00
Reijo Tomperi 87325799c5 Fix #1071 ((style) The function 'throw' is never used)
http://sourceforge.net/apps/trac/cppcheck/ticket/1071
2009-12-08 23:41:47 +02:00
Reijo Tomperi db30c5b0d2 Fix #1069 (Minor spelling mistake across cppcheck)
http://sourceforge.net/apps/trac/cppcheck/ticket/1069
2009-12-08 20:10:08 +02:00
Reijo Tomperi 798e07dee4 Added test case for else if simplification 2009-12-08 01:22:24 +02:00
Reijo Tomperi bd024b7a2d Fix #1065 (Internal error - incrementing single char in char array)
http://sourceforge.net/apps/trac/cppcheck/ticket/1065
2009-12-07 23:42:30 +02:00
Daniel Marjamäki e5c507dc02 Fixed #1063 (False positive: deallocated memory doesn't leak upon exception) 2009-12-07 19:23:33 +01:00
Reijo Tomperi f5849f9be2 Fix #1057 (Tokenizer: negative numbers are not tokenized correctly in switch-case)
http://sourceforge.net/apps/trac/cppcheck/ticket/1057
2009-12-07 00:09:56 +02:00
Daniel Marjamäki 3c063bfdb8 Preprocessor: Reverted refactoring 2009-12-06 20:10:10 +01:00
Daniel Marjamäki 046db9b2bb Preprocessor: Fix so the unit tests work again 2009-12-06 19:53:17 +01:00
Daniel Marjamäki 46b19e0184 Preprocessor: Refactoring to make it simpler 2009-12-06 19:17:59 +01:00
Daniel Marjamäki 2d180ab918 newcheck: added the 'newcheck' functionality. It's still in early state so it needs refactoring 2009-12-06 18:41:28 +01:00
Daniel Marjamäki c2a37c5d69 class checking: It's a 'possible style' error if a private constructor is not initializing a member variable 2009-12-06 18:35:32 +01:00
Daniel Marjamäki cd4e355f17 Fixed #1052 (Internal error for 'int vals[] = { 0x13, 1?0x01:0x00 };') 2009-12-06 10:58:27 +01:00
Daniel Marjamäki 75f6e20e61 Fixed #1050 (Internal error: In tokenizer for: 'do { sizeof 1; } while (0);') 2009-12-06 08:46:59 +01:00
Daniel Marjamäki da4d03f6c4 Fixed #1048 (False positive: exceptNew error with nothrow) 2009-12-05 22:05:59 +01:00
Reijo Tomperi 5a40a8c2dd CRLF -> LF fix 2009-12-05 22:17:58 +02:00
Daniel Marjamäki e9b342c56b Fixed #1046 (tokenizer: internal error for 'discard_block< (1 << 24), 10, 24 > u, v;') 2009-12-05 21:15:14 +01:00
Daniel Marjamäki 0b09c36851 Fixed #1026 (false positive: buffer access out of bounds) 2009-12-05 11:41:30 +01:00
Daniel Marjamäki 84a6fe6b54 Fixed #1034 (change --enable to --enable=all) 2009-12-04 19:35:58 +01:00
Reijo Tomperi 54629ff221 Fix #1037 (tokenizing a nested do while, while loop fails)
http://sourceforge.net/apps/trac/cppcheck/ticket/1037
2009-12-04 00:06:03 +02:00
Daniel Marjamäki 48bb1fdc83 Eric Sesterhenn: Fixed #1032 (False positive resource leak with exit at end of function) 2009-12-03 19:19:20 +01:00
Daniel Marjamäki 96268b4caf Fixed #1030 (wrong line number with goto) 2009-12-02 19:47:35 +01:00
Reijo Tomperi f5c81429cb Refactoring: Parse --enable values in Settings class 2009-11-30 23:48:58 +02:00
Daniel Marjamäki 153a13272c ericsesterhenn: Fix #1028 (False positive resource leak) 2009-11-30 16:45:19 +01:00
Daniel Marjamäki ded2e68c2e Fix #1022 (False positive: uninitialized variable when using local struct) 2009-11-29 19:23:31 +01:00
Daniel Marjamäki e6b5fe99f6 Fixed #1027 (Internal error: sizeof a++) 2009-11-29 17:25:35 +01:00
Daniel Marjamäki e7d7507c65 Fixed #1020 (lib/tokenize.cpp:4615: bool Tokenizer::validate() const: Assertion 0 failed) 2009-11-29 12:14:42 +01:00
Daniel Marjamäki a57af3b3e9 use checked STL in debugmode 2009-11-28 18:29:32 +01:00
Martin Ettl 03e7914c98 partial fix of ticket #997; added check for write() two testcases 2009-11-28 13:41:24 +01:00
Daniel Marjamäki f75c9619d1 Fixed #1021 (Out-of-bounds access false positive) 2009-11-28 12:51:23 +01:00
Reijo Tomperi 2c51542cf1 Fix #1018 (strcat(strcat()) causes assertion in Tokenizer::validate)
Test case provided by povaddict
http://sourceforge.net/apps/trac/cppcheck/ticket/1018
2009-11-27 23:21:13 +02:00
Daniel Marjamäki c94ecfe1a3 Fixed #1015 (SIGABRT: Tokenizer::validate for openttd/src/ai/ai_config.cpp) 2009-11-27 17:32:53 +01:00
Daniel Marjamäki 7616246597 Fixed #1014 (Preprocessor: Invalid preprocessing of '#define some_delete(x) delete x;') 2009-11-26 17:32:18 +01:00
Reijo Tomperi 12a87fa3a4 Fix #1007 (False positive array index out of bounds concerning a switch statement in a for loop)
Bailout if switch is found in for loop.
http://sourceforge.net/apps/trac/cppcheck/ticket/1007
2009-11-25 22:40:51 +02:00
Daniel Marjamäki 128b2b8c59 Fixed #989 (CppCheck crashes on Win XP when scanning large directories/subdirectories) 2009-11-23 18:59:50 +01:00
Daniel Marjamäki 9b397afeca Temporary fix for #994 (cppcheck cannot check my sources with segfaulting) 2009-11-22 13:38:45 +01:00
Daniel Marjamäki 7f6f41fd53 Fixed #993 (Latest Git drop aborts at 63% of wine tree) 2009-11-22 09:06:39 +01:00
Daniel Marjamäki 092f64b77a Fixed #982 (Preprocessor: detects and remove conditions which always true) 2009-11-21 19:53:07 +01:00
Reijo Tomperi 9bdf4502ed Fix #995 (false positive: buffer access out of bounds when using fgets)
http://sourceforge.net/apps/trac/cppcheck/ticket/995
2009-11-21 15:45:52 +02:00
Reijo Tomperi 6417704577 Fix #985 (Detect buffer overrun with read())
http://sourceforge.net/apps/trac/cppcheck/ticket/985
2009-11-20 23:47:06 +02:00
Daniel Marjamäki 531d0fa685 Fixed #965 (Division by zero false positive with nested macros) 2009-11-20 20:42:28 +01:00
Slava Semushin 41b2a52915 Fixed #990 (Tokenizer::simplifyIfAddBraces() handle case where statement after if doesn't end by semicolon)
http://sourceforge.net/apps/trac/cppcheck/ticket/990
2009-11-21 01:40:46 +06:00
Daniel Marjamäki 91f7c15c24 Fixed #960 (Tokenizer::validate() assertion failure with mismatched brackets) 2009-11-20 20:10:42 +01:00
Daniel Marjamäki 7890589693 Fixed #912 (### Unlogged error at Tokenizer::syntaxError: Invalid number of character (()) 2009-11-20 19:18:57 +01:00
Slava Semushin 5369965e55 Fixed #983 (Tokenizer::simplifyTypedef() incorrectly substitute type inside namespace)
http://sourceforge.net/apps/trac/cppcheck/ticket/983
2009-11-20 00:02:16 +06:00
Reijo Tomperi 7ddc4f4e02 Fix #971 (Preprocessor: Handle partial macro in macro)
http://sourceforge.net/apps/trac/cppcheck/ticket/971
2009-11-19 00:34:00 +02:00
Daniel Marjamäki 42ffea4f16 Fixed #968 (False positive when TEMP_FAILURE_RETRY used) 2009-11-18 17:17:37 +01:00
Reijo Tomperi 8f07e2711c Added a few TODO test cases for #971 (Invalid number of characters (())
http://sourceforge.net/apps/trac/cppcheck/ticket/971
2009-11-18 00:21:21 +02:00
Reijo Tomperi bd2ca8babd astyle fix 2009-11-17 22:15:25 +02:00
Daniel Marjamäki a3a3ff4349 fixed testcase so it's valid syntax 2009-11-17 19:06:53 +01:00
Slava Semushin 42c5025000 Fixed #970 (Tokenizer: Incorrect comparison order simplification)
Revert changes from 11cb7b4710 commit
for lib/tokenize.cpp (fixed it by another way).

Teach unsignedint() to expand "unsigned" in casts.

http://sourceforge.net/apps/trac/cppcheck/ticket/970
2009-11-18 00:05:18 +06:00
Daniel Marjamäki d866c174cf Fixed 2009-11-15 20:26:07 +01:00
Daniel Marjamäki 469a8e4032 Fixed #925 (uninitialized deletion not detected) 2009-11-15 20:01:57 +01:00
Reijo Tomperi 9275b49688 Fix #964 (Integer division by zero exception)
http://sourceforge.net/apps/trac/cppcheck/ticket/964
2009-11-15 17:44:30 +02:00
Daniel Marjamäki 2b1b7f78f5 Fixed #883 (Add new command line argument --enable) 2009-11-15 15:24:33 +01:00
Slava Semushin 6669a50634 Fixed #842 (out of bounds: when buffer is allocated with malloc)
http://sourceforge.net/apps/trac/cppcheck/ticket/842
2009-11-15 18:38:57 +06:00
Slava Semushin 3911dd79cb Fixed #900 (Improve out-of-bounds check to detect error with "new char(x)")
http://sourceforge.net/apps/trac/cppcheck/ticket/900
2009-11-15 18:04:17 +06:00
Daniel Marjamäki 822f64ec9a Fixed #953 (false positive: 'uninitialized variable' with function pointer) 2009-11-15 12:42:04 +01:00
Daniel Marjamäki b5cbc509f3 Fixed #483 (False positive: found leak when foreach for lists used) 2009-11-15 10:30:00 +01:00
Daniel Marjamäki 14fd0154d2 memory leaks: simple code cleanup 2009-11-15 09:53:38 +01:00
Daniel Marjamäki 5dd7b054f9 Fixed #915 (false positive: memory leak for struct member (allocated in condition) 2009-11-15 09:28:08 +01:00
Daniel Marjamäki ebf907cbc0 Fixed #936 (false positive: uninitialized variable '.. else return; .. ') 2009-11-14 20:37:54 +01:00
Slava Semushin 11cb7b4710 Fixed #961 (Tokenizer: call simplifyCasts() before removing "unsigned" keyword)
http://sourceforge.net/apps/trac/cppcheck/ticket/961
2009-11-14 17:01:59 +06:00
Daniel Marjamäki fee96f3cd6 Fixed #944 (new false positives against Wine Git Tree) 2009-11-14 09:06:28 +01:00
Daniel Marjamäki ec6d66ff45 Fixed #913 (false positive: uninitialized variable) 2009-11-14 08:00:17 +01:00
Daniel Marjamäki a36c410d45 Preprocessor: When #error is encountered the result is an empty string => don't check configuration 2009-11-13 22:12:29 +01:00
Daniel Marjamäki 1187587521 Fixed #919 (possible memory leak not detected) 2009-11-13 20:22:28 +01:00
Slava Semushin 2ec5438186 Fixed #954 (Tokenizer: correctly simplify sizeof of class members)
http://sourceforge.net/apps/trac/cppcheck/ticket/954
2009-11-14 01:07:44 +06:00
Reijo Tomperi c4244ac9e8 Fix #945 (Array index out of bounds not detected, because of "int const")
http://sourceforge.net/apps/trac/cppcheck/ticket/945
2009-11-12 23:49:39 +02:00
Reijo Tomperi 3d5760b149 Fix #947 (Errors not detected when size_t is used instead of int)
http://sourceforge.net/apps/trac/cppcheck/ticket/947
2009-11-12 23:31:13 +02:00
Reijo Tomperi 0518eed937 Fix #946 (False positive: Buffer access out-of-bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/946
2009-11-12 23:24:44 +02:00
Daniel Marjamäki b2cec721c0 Fixed #951 (Preincremented struct member confused with numeric constant) 2009-11-12 22:16:24 +01:00
Reijo Tomperi d2db4d3a27 Test case for #903 (segmentation fault of cppcheck)
http://sourceforge.net/apps/trac/cppcheck/ticket/903
2009-11-12 21:04:11 +02:00
Daniel Marjamäki c337b4eb33 Fixed #950 (Bug in cppcheck tokenize.cpp) 2009-11-12 18:53:26 +01:00
Daniel Marjamäki 39614a699e Uninitialized variables: detect uninitialized pointer array 2009-11-10 19:35:54 +01:00
Daniel Marjamäki c301dc1907 Fixed #928 (false positive: member variable not initialized in constructor) 2009-11-10 19:30:37 +01:00
Daniel Marjamäki b470ea06b8 Fixed #931 (Invalid interator false positive with identical variable names) 2009-11-10 19:07:04 +01:00
Daniel Marjamäki e0b1303b50 Fixed #929 (Uninitialized variable false positive) 2009-11-10 18:05:55 +01:00
Daniel Marjamäki 51f983629b Fixed #932 (false positive: Dereferenced iterator 'i' has been erased) 2009-11-10 17:20:20 +01:00
Daniel Marjamäki d85fb9dd3d unit testing: minor syntax updates 2009-11-09 20:40:30 +01:00
Daniel Marjamäki 1fe94d74b8 unit testing: minor syntax fixes 2009-11-09 20:34:36 +01:00
Daniel Marjamäki 41e59d8348 Fixed #832 (Exception Safety: deallocating member pointer and then throwing exception) 2009-11-08 09:54:08 +01:00
Daniel Marjamäki 4b04ed9ad9 Fixed #910 (false positive: uninitialized variable for array) 2009-11-08 07:31:01 +01:00
Daniel Marjamäki 52eb32eb5b testbufferoverrun.cpp: fixed unit test error 2009-11-07 19:59:03 +01:00
Daniel Marjamäki 3b9b3b241e testbufferoverrun.cpp: minor updates to make it work better as extracted code 2009-11-07 19:51:18 +01:00
Daniel Marjamäki 3bd36226d6 testbufferoverrun: minor updates to make the code more easily compilable 2009-11-07 18:03:33 +01:00
Daniel Marjamäki d88c236efe uninitialized data: minor fix to handle 'new char [' better 2009-11-07 14:54:12 +01:00
Daniel Marjamäki 60caefe069 uninitialized data: added more checking for allocated data 2009-11-07 09:10:15 +01:00
Daniel Marjamäki 0c8d327809 Fixed #907 (Tokenizer: known result of strlen) 2009-11-07 08:25:39 +01:00
Reijo Tomperi b222ef89be Fix #903 (false positive: buffer access out of bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/903
2009-11-07 00:58:33 +02:00
Daniel Marjamäki 77b676937d cleanup in testbufferoverrun.cpp 2009-11-06 19:15:59 +01:00
Daniel Marjamäki c561a36cc7 uninitialized variables: better checking of strncpy 2009-11-06 19:06:45 +01:00
Daniel Marjamäki 7397bfc765 Fixed #904 (false positive: uninitialized variable) 2009-11-06 16:50:02 +01:00
Daniel Marjamäki 53f7b12b4f Fixed #902 (false positive: uninitialized variable when variable is initialized in macro) 2009-11-06 16:02:13 +01:00
Daniel Marjamäki 58c54d2ed4 Fixed #898 (Tokenizer: remove unneeded const after *) 2009-11-05 21:30:05 +01:00
Daniel Marjamäki 442584151b Fixed #897 (false positive: uninitialized variable when assigning pointer to array to struct member) 2009-11-05 21:07:04 +01:00
Reijo Tomperi de4ca924b5 Fixed #896 (False positive with --all when return value of open() is positive in a loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/896
2009-11-05 00:58:15 +02:00
Daniel Marjamäki 141b91ae08 updated error message when memory leaks upon exception 2009-11-04 20:45:26 +01:00
Reijo Tomperi 9a55f4ca43 Add one more test case for #895 (false positive: Suspicious pointer subtraction) 2009-11-04 21:38:40 +02:00
Reijo Tomperi 80c66f8ebc Fix #895 (false positive: Suspicious pointer subtraction)
http://sourceforge.net/apps/trac/cppcheck/ticket/895
2009-11-04 21:36:27 +02:00
Reijo Tomperi 00b62442b6 Fix #894 (Invalid line number in "Invalid number of character")
http://sourceforge.net/apps/trac/cppcheck/ticket/894
2009-11-03 22:21:28 +02:00
Daniel Marjamäki c3dff9a6d3 Fixed #893 (False Positive: Uninitialized variable b in a[0] = b[0] = '\0';) 2009-11-03 21:02:16 +01:00
Daniel Marjamäki 68f63fdd75 Exception safety: added check for unsafe reallocation of member pointer 2009-11-03 20:26:52 +01:00
Daniel Marjamäki 616a760b6c Exception Safety: detect unsafe multiple new in a execution path (#831) 2009-11-03 19:43:51 +01:00
Daniel Marjamäki 797e9aeaf5 Fixed #890 (false positive: Uninitialized variable when pointer takes the address to array) 2009-11-03 17:03:53 +01:00
Reijo Tomperi 7fc72484ec Fix #881 (Tokenizer: Something seems to be wrong in Tokenizer::simplifyKnownVariables)
http://sourceforge.net/apps/trac/cppcheck/ticket/881
2009-11-03 00:07:15 +02:00
Daniel Marjamäki 87800185c4 STL: refactoring and fixing 2009-11-02 21:53:01 +01:00
Daniel Marjamäki 89d94895a4 Refactoring 2009-11-02 21:17:33 +01:00
Daniel Marjamäki bc3b12db72 astyle formatting 2009-11-02 20:25:08 +01:00
Daniel Marjamäki df3ffa2eda STL: added check for dangerous usage of std::find (#829) 2009-11-02 20:24:38 +01:00
Daniel Marjamäki 8d57cef7f9 Fixed #764 (usage of unitialized variable not detected) 2009-11-02 19:58:49 +01:00
Daniel Marjamäki 169bcfcff2 Fixed #882 (false positive: uninitialized variable) 2009-11-02 18:31:22 +01:00
Daniel Marjamäki 4abbe9ffd4 Fixed #889 (false positive: uninitialized variable) 2009-11-02 16:28:15 +01:00
Daniel Marjamäki 3e4dd22eed fixed todo testcase 2009-11-01 21:00:43 +01:00
Reijo Tomperi 618eed3d59 Fixed segmentation fault.
Had to change one test case to TODO for now.
2009-11-01 21:49:43 +02:00
Daniel Marjamäki 319cdc2b43 Fixed #880 (Tokenizer: The Tokenizer::simplifyTemplates doesn't handle recursive templates) 2009-11-01 19:03:52 +01:00
Daniel Marjamäki fec7acdc27 Templates: Better handling of recursive templates 2009-11-01 15:56:00 +01:00
Reijo Tomperi eebbc1b906 Fix #884 (False positive: Possible null pointer reference about a non-pointer)
http://sourceforge.net/apps/trac/cppcheck/ticket/884
2009-11-01 13:08:37 +02:00
Daniel Marjamäki 543d5cbf45 Fixed #831 (Exception safety: multiple new in a simple execution path) 2009-10-31 18:58:42 +01:00
Daniel Marjamäki c83d9cd786 Fixed #843 (new check: Passing uninitialized array to strlen/strdup/strcpy/strcat/etc) 2009-10-31 16:36:56 +01:00
Daniel Marjamäki 395ce30d81 Fixed #877 (False positive: After insert, iterator may be invalid) 2009-10-31 15:27:33 +01:00
Daniel Marjamäki a337708ae5 Fixed #430 (Tokenizer: handle templates with partial specialisation) 2009-10-31 12:34:52 +01:00
Daniel Marjamäki 266291baf4 Fixed #876 (false positive: uninitialized variable) 2009-10-31 10:30:32 +01:00
Daniel Marjamäki 45df223bfb Fixed #875 (Uninitialized variable: initialization in subfunction) 2009-10-30 18:28:01 +01:00
Daniel Marjamäki 7dbf22aa3f null pointer: fixed false positive when condition checks if pointer is ok 2009-10-30 15:14:24 +01:00
Daniel Marjamäki feb065abc8 Fixed #867 (unused member function warning) 2009-10-30 15:00:13 +01:00
Daniel Marjamäki 2cf849a9b8 uninitialized variables: fixed false positive when switch is used 2009-10-30 14:52:20 +01:00
Daniel Marjamäki 765c824c6f Uninitialized pointers: It's allowed to dereference uninitialized non-pointer variables 2009-10-30 14:31:37 +01:00
Daniel Marjamäki 44a9c9b458 Fixed #874 (false positive: uninitialized variable) 2009-10-30 14:06:40 +01:00
Daniel Marjamäki 768225bb1b uninitialized variables: fixed false positives for member variables 2009-10-30 13:43:00 +01:00
Daniel Marjamäki c424d4c8af uninitialized variables: Added TODO testcase for removing false positives 2009-10-29 22:51:08 +01:00
Daniel Marjamäki c6d7fad84f uninitialized variables: added check 2009-10-29 21:34:43 +01:00
Reijo Tomperi 4a61bd0432 Fix #870 (The CheckClass::getVarList method detects 'const' as a variable name.)
http://sourceforge.net/apps/trac/cppcheck/ticket/870
2009-10-29 21:54:51 +02:00
Reijo Tomperi 504ae8e22d Fix #868 (False positive - buffer access out of bounds in for loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/868
2009-10-29 16:04:23 +02:00
Reijo Tomperi 9db22d9b48 Modify CheckBufferOverrun::checkGlobalAndLocalVariable() to use varid only.
Also add some TODO test cases.
2009-10-28 22:42:54 +02:00
Daniel Marjamäki ffb5bbd4d1 Visual Studio: Manually edited the vcproj files. The absolute paths were replaced with relative paths 2009-10-28 20:15:56 +01:00
Daniel Marjamäki cba94feded Restructuring: Updated the Visual Studio project files. They are now generated by qmake 2009-10-28 17:37:38 +01:00
Daniel Marjamäki 0682db47a7 Memory leaks: Detect simple leak 2009-10-27 23:08:11 +01:00
Daniel Marjamäki 45b0758e71 Fixed #860 (Improve double delete detection) 2009-10-27 21:28:03 +01:00
Reijo Tomperi 0e695ea527 Test case for #863 (false positive memset array of pointers)
http://sourceforge.net/apps/trac/cppcheck/ticket/863
2009-10-27 20:54:35 +02:00
Reijo Tomperi 59acfbc4df Fix #863 (false positive memset array of pointers)
http://sourceforge.net/apps/trac/cppcheck/ticket/863
Also fix test cases for 64 bit systems.
2009-10-27 20:23:45 +02:00
Daniel Marjamäki 2525b0131a Restructuring: Updated test/test.pro 2009-10-26 22:20:25 +01:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00
Daniel Marjamäki 26a81e82cc Fixed #253 (MemoryLeakInClass: False positive when memory is released in function, which is called from destructor) 2009-10-24 15:07:14 +02:00
Daniel Marjamäki 2c8a418c7e Memory leaks: Added and fixed testcase TestMemleakInClass::class13 2009-10-23 20:04:47 +02:00
Daniel Marjamäki 88070b044b Fixed #851 (Tokenizer: sizeof(*a) returns incorrect result) 2009-10-22 23:00:27 +02:00
Daniel Marjamäki 701d622ff0 Fixed #428 (Memory leak not detected with class) 2009-10-22 21:51:58 +02:00
Daniel b80a954f55 Fixed #844 (Tokenizer: Simplify 'sizeof *ptr' correctly) 2009-10-21 21:08:00 +02:00
Reijo Tomperi 9d42194562 Fix #767 (Tokenizer: Known variable variable not simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/767
2009-10-20 23:58:46 +03:00
Daniel e5f13b4de2 Fixed #839 (False positive: possible null pointer dereference after new) 2009-10-20 20:57:38 +02:00
Reijo Tomperi 6fbf873d25 Improved countSprintfLength() to detect more errors with %d.
Fixed some errors from test cases.
Added more test cases.
2009-10-20 00:48:29 +03:00
Daniel Marjamäki a36c31628d Fixed by #828 (Exception Safety: No throwing in destructors) 2009-10-19 20:57:11 +02:00
Daniel Marjamäki 857c95e7b5 Null pointers: Detect code where the assignment is conditional 2009-10-19 17:32:43 +02:00
Daniel Marjamäki 0e56e4cd37 STL: checking that containers are matching 2009-10-18 18:42:01 +02:00
Daniel Marjamäki 50e542c183 Fixed #827 (Tokenizer: sizeof is incorrectly simplified) 2009-10-18 18:06:32 +02:00
Daniel Marjamäki 58790eda82 Fixed #449 (false postive:: resource leak when using errno) 2009-10-18 13:17:05 +02:00
Reijo Tomperi aca743c9ed Fix #826 (False positive: sprintf with "f%s")
http://sourceforge.net/apps/trac/cppcheck/ticket/826
2009-10-18 13:58:48 +03:00
Daniel Marjamäki cb76061118 unused struct member: bail out when casting 2009-10-17 19:31:14 +02:00
Daniel Marjamäki 2ec1b676ea Pointer Aliasing: Handle pointer aliasing through the Tokenizer::simplifyKnownVariables 2009-10-17 18:21:13 +02:00
Daniel Marjamäki 2e9f7755ee Unused struct members: bail out upon casting 2009-10-17 17:36:55 +02:00
Daniel Marjamäki ffbf8e38ac stl: after vector::insert, iterators may become invalid 2009-10-15 21:29:56 +02:00
Daniel Marjamäki 01af70cc88 Fixed #823 (Buffer overrun with memcpy) 2009-10-15 19:36:48 +02:00
Daniel Marjamäki 91de8f399b Fixed #821 (Preprocessor: Wrong stringification in macros) 2009-10-14 20:40:17 +02:00
Reijo Tomperi be90d34962 Buffer overrun errors behind function call should be possible errors. 2009-10-14 00:09:37 +03:00
Reijo Tomperi 3dc45903bc Move buffer overrun errors behind --all
Fix one possible error issue with arrayindexoutofbounds
Make sure that possible errors are not shown without --all
2009-10-13 23:33:41 +03:00
Reijo Tomperi a3a55547d8 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-10-13 22:41:21 +03:00
Reijo Tomperi 4036dd5eff arrayIndexOutOfBounds check is now done without --all
Errors with buf[1] are still listed only with --all due to false positive risk in them.
2009-10-13 22:39:51 +03:00
Daniel Marjamäki a33b4744a3 stl: better checking for invalid iterator after push_back 2009-10-13 20:55:33 +02:00
Daniel Marjamäki ed3860a0a7 Fixed #805 (False positive: Member functions not handled correctly) 2009-10-12 21:36:28 +02:00
Reijo Tomperi b6999d010f Fix #812 (False positive: sprintf with "%.4s" with --all)
http://sourceforge.net/apps/trac/cppcheck/ticket/812
2009-10-11 22:07:18 +03:00
Reijo Tomperi 59aad35137 Fix #694 (False (possible error) Buffer overrun with %-1s)
ashim2009 did most of the work
http://sourceforge.net/apps/trac/cppcheck/ticket/694
2009-10-11 21:36:22 +03:00
Reijo Tomperi 1401e3f668 Fix #810 (false positive: Division with signed and unsigned operators)
http://sourceforge.net/apps/trac/cppcheck/ticket/810
2009-10-11 17:52:35 +03:00
Reijo Tomperi ea36632ca3 Fix #808 (Segfault in Preprocessor)
http://sourceforge.net/apps/trac/cppcheck/ticket/808
2009-10-10 23:23:48 +03:00
Slava Semushin 237dcb9533 Fixed #809 (Tokenizer: don't replace sizeof() of unknown type to zero)
http://sourceforge.net/apps/trac/cppcheck/ticket/809
2009-10-10 19:26:03 +07:00
Daniel Marjamäki b67fe861b8 Added testcase for #807 (cppcheck crashes scanning ruby 1.9.1) 2009-10-10 10:13:56 +02:00
Daniel Marjamäki 67f53661a9 Fixed #806 (cppcheck crashes scanning openssl) 2009-10-09 21:11:29 +02:00
Reijo Tomperi a078c9353d More test cases for sprintf counter 2009-10-08 17:36:00 +03:00
Reijo Tomperi 5eee9af974 sprintf counter improvements 2009-10-08 16:27:46 +03:00
Reijo Tomperi ad5d87ee14 Fix #802 (possible null pointer dereference reported for reference)
http://sourceforge.net/apps/trac/cppcheck/ticket/802
2009-10-08 11:55:37 +03:00
Reijo Tomperi 014ad937cf Optimize speed and fix one false positive with stl checks. 2009-10-07 23:38:21 +03:00
Reijo Tomperi 52ca36a6ed Added more test cases for sprintf counter 2009-10-07 21:33:44 +03:00
Daniel Marjamäki 13e43b8710 Ashim Kapoor: updated the counter (#694) 2009-10-07 18:21:44 +02:00
Reijo Tomperi fcd269dbf7 Refactoring: Moved some code into a new function.
Renamed count->countSprintfLength.
Added code to collect sprintf parameters.
Added a few TODO test cases.
2009-10-07 15:37:20 +03:00
Reijo Tomperi 8fc21dda27 Fix #801 (Tokenizer: Simplify sizeof for function parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/801
2009-10-07 12:05:44 +03:00
Reijo Tomperi 06dd66bff4 Fix #487 (Tokenizer: Simplify sizeof for string array and string pointer)
http://sourceforge.net/apps/trac/cppcheck/ticket/487
2009-10-07 11:08:53 +03:00
Reijo Tomperi 8472e58413 Refactored sizeof simplification and fixed one TODO assert. 2009-10-07 10:54:34 +03:00
Reijo Tomperi d9ae2c171e Detect referenced by value errors for std::map also. 2009-10-07 00:04:54 +03:00
Reijo Tomperi ab762b1a00 Fix #388 (resource leak not detected, allocation through function call)
http://sourceforge.net/apps/trac/cppcheck/ticket/388
2009-10-06 23:14:32 +03:00
Reijo Tomperi 2e69d50458 Fix #796 (segmentation fault while scanning)
http://sourceforge.net/apps/trac/cppcheck/ticket/796
2009-10-06 21:03:15 +03:00
Daniel Marjamäki 36fb24b1a5 memory leaks: don't write errors for static member variables 2009-10-06 18:25:00 +02:00
Daniel Marjamäki c3d56c1d13 Fix #797 (false positive: variable scope when using function call) 2009-10-06 17:45:28 +02:00
Reijo Tomperi d598bed1c6 Fix #575 (Array index out of bounds check: get address of one-past-the-end array is legal)
http://sourceforge.net/apps/trac/cppcheck/ticket/575
2009-10-06 14:50:27 +03:00
Reijo Tomperi c55140d4cd Fix #580 (double free not found)
http://sourceforge.net/apps/trac/cppcheck/ticket/580
2009-10-06 12:44:53 +03:00
Reijo Tomperi 13fbd616da Moved some test cases from testtokenize into testsimplifytokens and added one TODO case. 2009-10-06 12:40:50 +03:00
Reijo Tomperi 272f0d3be5 Fix #795 (Preprocessor: Incorrect handling of #if (A) || (B))
http://sourceforge.net/apps/trac/cppcheck/ticket/795
2009-10-06 11:47:36 +03:00
Reijo Tomperi 0a7da96cb6 Fix #765 (divsion by zero not detected in std::cout stream)
http://sourceforge.net/apps/trac/cppcheck/ticket/765
2009-10-06 09:14:59 +03:00
Reijo Tomperi 1eba4b374f Fix #794 (Floating point exception on CheckBufferOverrun)
http://sourceforge.net/apps/trac/cppcheck/ticket/794
2009-10-05 23:19:44 +03:00
Reijo Tomperi edb28d2856 Fix #365 (Improve simplifyQuestionMark() in tokenize.cpp)
http://sourceforge.net/apps/trac/cppcheck/ticket/365
2009-10-05 17:34:38 +03:00
Reijo Tomperi 6901bcae79 Fix #771 (False positive. Null pointer dereference in a switch case)
http://sourceforge.net/apps/trac/cppcheck/ticket/771
2009-10-05 14:46:38 +03:00
Reijo Tomperi 036f3894f1 Fix simplifyRedundantParanthesis() to work after '}' 2009-10-05 14:30:05 +03:00
Reijo Tomperi 5a0a5422c3 Fix #776 (Tokenizer: remove useless brackets around variable assignment)
http://sourceforge.net/apps/trac/cppcheck/ticket/776
2009-10-05 14:22:35 +03:00
Reijo Tomperi fc684d7b5a Fix #778 (Tokenizer: impove simplification inside if())
http://sourceforge.net/apps/trac/cppcheck/ticket/778
2009-10-05 14:10:09 +03:00
Reijo Tomperi 1df8f38423 Fix #793 (Improve passedByValue check)
http://sourceforge.net/apps/trac/cppcheck/ticket/793
2009-10-05 11:59:28 +03:00
Reijo Tomperi 8bb812548c Fix #777 (Tokenizer: double casting simplified incorrectly)
http://sourceforge.net/apps/trac/cppcheck/ticket/777
2009-10-05 00:12:12 +03:00
Reijo Tomperi 498beb7d9a Fix #784 (Tokenizer: Simplify 2[a] -> a[2])
http://sourceforge.net/apps/trac/cppcheck/ticket/784
2009-10-04 23:33:41 +03:00
Daniel Marjamäki 23d8937661 Fixed #789 (false positive: resource leak reported when using for loop) 2009-10-04 19:58:41 +02:00
Daniel Marjamäki ab18f1bd3c Preprocessor: Minor fixes (#772) 2009-10-04 15:41:50 +02:00
Daniel Marjamäki 6b1fae75e5 Fixed #785 (False positive: resource leak of extern FILE*) 2009-10-04 14:24:41 +02:00
Daniel Marjamäki af5a695f82 Fixed #727 (False positive: Resource leak when release is done inside function call) 2009-10-04 13:10:08 +02:00
Slava Semushin 6b0d364f57 Fixed #782 (Checks are missing test cases)
http://sourceforge.net/apps/trac/cppcheck/ticket/782
2009-10-04 15:05:58 +07:00
Daniel Marjamäki ee1bcb728c use '<' comparisons instead of '>' (#610) 2009-10-04 07:51:12 +02:00
Daniel Marjamäki 1a48f869c8 Fixed #772 (Preprocessor: #if(A) is not seen equal to #if A) 2009-10-04 07:25:30 +02:00
Daniel Marjamäki 4387071eb1 Fixed #733 (New check: locking & unlocking mutex and semaphore variables) 2009-10-03 21:46:22 +02:00
Slava Semushin b0d8b6ca8b Fixed #780 (Tokenizer: replace typedef for pointers to struct)
http://sourceforge.net/apps/trac/cppcheck/ticket/780
2009-10-03 22:02:23 +07:00
Slava Semushin 9983066f62 Fixed #770 (Tokenizer: Var id not set for static variables in some cases)
http://sourceforge.net/apps/trac/cppcheck/ticket/770
2009-10-03 17:05:07 +07:00
Reijo Tomperi 107895e8cc TODO test cases TestTokenizer::vardec_static added 2009-10-02 17:28:30 +03:00
Daniel Marjamäki 57067f6627 memory leaks: refactoring unit tests 2009-10-01 22:25:59 +02:00
Daniel Marjamäki e894e37131 Fixed #679 (False positive: Unused private function produced by exception specification) 2009-10-01 19:45:48 +02:00
Reijo Tomperi b3ad712b61 Fix #421 (Memory leak not found when typeid() is used.)
http://sourceforge.net/apps/trac/cppcheck/ticket/421
2009-10-01 11:56:59 +03:00
Reijo Tomperi 4650e513e1 Fix #741 (False positive: Buffer overrun with -a when index increased in multiple locations)
http://sourceforge.net/apps/trac/cppcheck/ticket/741
2009-10-01 11:33:53 +03:00
Reijo Tomperi d4a97eb2b4 Fix #419 (missleading buffer overrun)
http://sourceforge.net/apps/trac/cppcheck/ticket/419
2009-10-01 10:59:27 +03:00
Reijo Tomperi 39092150e2 Fix #763 (Tokenizer: Goto incorrectly simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/763
2009-10-01 10:25:32 +03:00
Daniel Marjamäki e3e8224b4e memory leaks: fixed TODO_ASSERT_EQUALS 2009-09-30 22:27:00 +02:00
Reijo Tomperi f9871c2d54 Fix #745 (false positive: possible null pointer dereference , while)
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Reijo Tomperi ec44f8f6c7 Fix #744 (False positive: (possible error) Array index out of bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/744
2009-09-30 15:51:33 +03:00
Reijo Tomperi 6ed727564c Fix #759 (Tokenizer: Incorrect var id when two variables with same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/759
2009-09-30 14:40:10 +03:00
Reijo Tomperi 7852d38f54 Fix #761 (Tokenizer: typedef inside class is incorrectly simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/761
2009-09-30 14:35:00 +03:00
Reijo Tomperi bb1a9a07e4 Fix #760 (Tokenizer: Goto not simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/760
2009-09-30 14:30:53 +03:00
Reijo Tomperi 500dedb8a3 Added TODO test cases: simplifyTypedef, simplifyTypedef2, simplifyTypedef3 2009-09-30 10:11:09 +03:00
Reijo Tomperi 724c78fb4d Fix #750 (cppcheck wants variable outside do-loop to be only inside loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/750
Fix #758 (False positive on variable scope with boost foreach)
http://sourceforge.net/apps/trac/cppcheck/ticket/758
2009-09-30 00:56:43 +03:00
Daniel Marjamäki e5bc4a02ae added a TODO_ASSERT_EQUALS for the counter 2009-09-29 20:50:22 +02:00
Reijo Tomperi 1b1047a5e4 Fix #757 (Change message: (style) The class 'KClass' has no constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/757
2009-09-29 21:27:17 +03:00
Reijo Tomperi 77d677dd59 TODO test case for count() added 2009-09-29 18:51:29 +03:00
Daniel Marjamäki 12b29e35ad Ashim Kapoor: deal with backspace better (#694) 2009-09-29 17:02:19 +02:00
Reijo Tomperi ededbfb10e Fix comment in test case 2009-09-29 17:19:56 +03:00
Reijo Tomperi 63523316a2 Check nullpointer check is now executed without --style flag
Added TODO test case for nullpointer check
2009-09-29 16:38:05 +03:00
Reijo Tomperi 64f0f3b308 Fix #751 (if-condition considered redundant even with else-branch)
http://sourceforge.net/apps/trac/cppcheck/ticket/751
Fix also other issue with if(a.b) delete c.b;
Fix also other issue with if(a.b.c) delete a.b.c;
2009-09-29 00:18:40 +03:00
Daniel Marjamäki 311f6dc92e Fixed #746 (False positive, Memory leak when goto is used) 2009-09-28 22:58:06 +02:00
Daniel Marjamäki 1427f0a2c7 memory leaks: fixed a TODO_ASSERT_EQUALS for a false positive 2009-09-28 22:41:45 +02:00
Reijo Tomperi 2d4404f030 Fix #754 (Tokenizer: transform modifier "signed" to "int")
http://sourceforge.net/apps/trac/cppcheck/ticket/754
Also fix int unsigned -> unsigned int
2009-09-28 21:25:05 +03:00
Slava Semushin b9237db9a3 Fixed #753 (Tokenizer: don't simplify variables inside do {} while loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/753
2009-09-28 22:15:31 +07:00
Daniel Marjamäki a1e20290cd Refactoring the unit testing of format strings 2009-09-27 22:13:15 +02:00
Daniel Marjamäki a61abcbbc8 Fixed #728 (False positive, resource leak, when released in a loop) 2009-09-27 21:49:07 +02:00
Slava Semushin e8c83613e4 Fixed #740 (False positive, buffer overrun with --all)
Regression since 07f41f4563 commit.

http://sourceforge.net/apps/trac/cppcheck/ticket/740
2009-09-27 22:50:59 +07:00
Slava Semushin 661ce78b69 Fixed #738 (False Buffer overrun with -a when i is increased by more than 1 inside loop body)
http://sourceforge.net/apps/trac/cppcheck/ticket/738
2009-09-27 22:14:51 +07:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin 07f41f4563 Fixed #714 (False Buffer overrun with -a when i is increased by more than 1 in a loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/714
2009-09-27 21:12:46 +07:00
Reijo Tomperi d1f3953cce Fix #720 (String length for strings like this "\x61" is calculated wrong)
http://sourceforge.net/apps/trac/cppcheck/ticket/720
2009-09-27 17:04:10 +03:00
Slava Semushin 7e2208b5cc Detects invalid iterator inside for() when postfix form of increment used. 2009-09-27 15:10:21 +07:00
Slava Semushin 5285635354 Fixed #735 (Detects invalid iterator after push_back() when iterator declared inside for())
http://sourceforge.net/apps/trac/cppcheck/ticket/735
2009-09-27 14:59:19 +07:00
Slava Semushin acdbb20c99 Detect buffer overruns when ?: use as sprintf() argument. 2009-09-27 00:40:58 +07:00
Slava Semushin 19ed8e9311 Fixed #729 (False positive: Buffer overrun when ? is used to select parameter)
http://sourceforge.net/apps/trac/cppcheck/ticket/729
2009-09-27 00:06:54 +07:00
Slava Semushin 50a34b8a37 Fixed #731 (False positive, strcpy copying a buffer with a null character)
http://sourceforge.net/apps/trac/cppcheck/ticket/731
2009-09-26 22:58:14 +07:00
Daniel Marjamäki 3da779725d Ashim Kapoor: handle %i,%f,%d,%x,%X better (#694) 2009-09-26 16:19:18 +02:00
Slava Semushin a919f4541a Fixed #732 (Tokenizer: Incorrect simplification)
Regression since 58a9e05697 commit.

http://sourceforge.net/apps/trac/cppcheck/ticket/732
2009-09-26 17:02:13 +07:00
Daniel Marjamäki 0b3a139b3b Fixed #710 (False positive: invalid vector iterator after push_back) 2009-09-26 11:49:09 +02:00
Daniel Marjamäki 482a2f9d95 Fixed #718 (False positive, resource leak when break in a loop before exit) 2009-09-26 07:19:22 +02:00
Reijo Tomperi 6a63742dde Fix #730 (False positive, buffer overrun with strncpy)
http://sourceforge.net/apps/trac/cppcheck/ticket/730
2009-09-25 23:32:18 +03:00
Daniel Marjamäki 6db95cd01c Memory leaks: Added a TODO assertion for a false positive 2009-09-25 22:01:54 +02:00
Daniel Marjamäki fd311e3c72 Fixed #678 (False positive: Unused private function produced by inner class) 2009-09-25 20:42:22 +02:00
Daniel Marjamäki fe3c8cab9f Ashim Kapoor: Added function that returns minimum size of format strings (#694) 2009-09-25 18:23:44 +02:00
Reijo Tomperi 2594f9b63f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-09-24 23:47:28 +03:00
Reijo Tomperi 16e55f4f89 Improve C style pointer cast detection
http://sourceforge.net/apps/trac/cppcheck/ticket/724
2009-09-24 23:46:08 +03:00
Daniel Marjamäki cd94d50526 Memory leaks: fixed a TODO_ASSERT_EQUALS 2009-09-24 22:40:18 +02:00
Daniel Marjamäki fa4e0a617e Fixed #700 (False positive: Memory leak) 2009-09-23 22:42:07 +02:00
Reijo Tomperi 62ccda5677 Fix #713 (Tokenizer: Simplify 0L)
http://sourceforge.net/apps/trac/cppcheck/ticket/713
Use MathLib to handle other variations of 0.
2009-09-23 22:44:52 +03:00
Slava Semushin 313479cf8d Tokenizer::simplifySizeof(): use Token::getStrLength().
Fixed wrong result when string contains escaped quotes.

Correction for 0e729fedc0 commit.
2009-09-23 23:02:53 +07:00
Reijo Tomperi ef09f3475c Fix #713 (Tokenizer: Simplify 0L)
http://sourceforge.net/apps/trac/cppcheck/ticket/713
2009-09-23 00:23:11 +03:00
Daniel Marjamäki 0e729fedc0 Fixed #716 (segmentation fault: sizeof string) 2009-09-22 20:50:00 +02:00
Slava Semushin 9d65a1ebe8 test/testdivision.cpp: fixed syntax errors in TestDivision::division8
Before testrunner complains:
 ### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)
 ### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)
 ### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)

Broken since 36c7108a28 commit where
test case was added.
2009-09-22 23:53:26 +07:00
Daniel Marjamäki ad92aa4c20 Fixed #715 (False positive: Resource leak when exit() after if loop) 2009-09-22 18:09:29 +02:00
Daniel Marjamäki faac5bccd6 Fixed #702 (If you see this, there is a bug - varid was 0) 2009-09-22 17:49:13 +02:00
Reijo Tomperi 4d2a8608a8 Fix #706 (false positive: invalid number of character ((), can't process file)
http://sourceforge.net/apps/trac/cppcheck/ticket/706
2009-09-21 23:27:06 +03:00
Reijo Tomperi 0fff5a23bf Fix #701 (false positive: Invalid deallocation)
http://sourceforge.net/apps/trac/cppcheck/ticket/701
2009-09-20 23:38:32 +03:00
Reijo Tomperi 1c01dd64f3 Fix #703 (Tokenizer: Create links for [])
http://sourceforge.net/apps/trac/cppcheck/ticket/703
2009-09-20 23:13:06 +03:00
Slava Semushin 7236230228 Additional fix for better simplifying array declaration.
Pointed out by hyd_danmar@ in IRC.

Addressed to #696
2009-09-20 18:28:56 +07:00
Slava Semushin 5dee65048f Fixed #690 (False positive: (possible error) Buffer overrun)
http://sourceforge.net/apps/trac/cppcheck/ticket/690
2009-09-20 17:54:19 +07:00
Slava Semushin 58a9e05697 Fixed #696 (Tokenizer: Simplify array declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/696
2009-09-20 17:28:15 +07:00
Reijo Tomperi 003e27c10e Fix #667 (Preprocessor does not handle macro inside macro correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/667
2009-09-20 00:09:05 +03:00
Reijo Tomperi 661e4504cb astyle fix 2009-09-19 14:21:50 +03:00
Daniel Marjamäki 7f2ca357b0 Fixed #673 (False positive: null pointer dereference when dynamic cast is used) 2009-09-19 10:54:10 +02:00
Slava Semushin 7a07f9343f test/testtokenize.cpp: refactoring code.
- introduce and use simplifyKnownVariables() function
- don't append leading space to result string with tokens

No functional change.
2009-09-19 13:55:41 +07:00
Daniel Marjamäki 8f96c1992a Fixed #688 (False positive in error category when --all is used) 2009-09-19 08:23:10 +02:00
Daniel Marjamäki e4291a5966 Fixed #676 (The scope of variable can actually not be limited) 2009-09-17 21:05:12 +02:00
Daniel Marjamäki 1dc738b1ae Fixed #677 (False positive: Unused private function produced by class member initialization) 2009-09-16 23:04:13 +02:00
Daniel Marjamäki c5368581d9 Fixed by #675 (false positive: when operator is overloaded) 2009-09-16 20:07:03 +02:00
Reijo Tomperi 55fc473a00 Fix #684 (Tokenizer: (65536*72/100) incorrectly simplified to zero)
http://sourceforge.net/apps/trac/cppcheck/ticket/684
2009-09-15 23:38:54 +03:00
Daniel Marjamäki 5efedf85d6 Fixed #671 (False positive. Leak when loop is before exit) 2009-09-15 22:26:38 +02:00
Daniel Marjamäki 36c7108a28 Fixed #669 (possible style without --all + false positives) 2009-09-15 20:46:47 +02:00
Reijo Tomperi 92b8593f59 TODO test case for preprocessor macro handling 2009-09-14 22:53:57 +03:00
Daniel Marjamäki 020321769c Fixed #658 (Assertion 'begin != __null' failed) 2009-09-14 21:49:41 +02:00
Reijo Tomperi 2b6955dde5 Fix #670 (Tokenizer: Simplify '\0' into 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/670
2009-09-14 21:42:56 +03:00
Slava Semushin d16a0b7a80 TestSimplifyTokens::sizeof_(): don't append leading space.
No functional change.
2009-09-13 17:59:59 +07:00
Slava Semushin 0fb89f8afa Fixed #645 (Tokenizer::simplifyCasts() breaks link() if casts function)
http://sourceforge.net/apps/trac/cppcheck/ticket/645
2009-09-13 17:31:32 +07:00
Slava Semushin dade31b6d7 TestTOKEN::getStrLength(): allocate tok variable in stack (instead of in heap)
No functional change.
2009-09-13 15:08:43 +07:00
Daniel Marjamäki 1d974f7c05 memory leaks: added test assertion. simplify ';alloc;exit;' to ';exit;' 2009-09-13 07:20:42 +02:00
Reijo Tomperi 241f585d34 Fix #594 (division by zero not detected when using atol or atof)
http://sourceforge.net/apps/trac/cppcheck/ticket/594
Simplify atol("0") into 0 (and other atol() calls also)
2009-09-12 23:54:47 +03:00
Daniel Marjamäki 5df28c51c6 memory leaks: minor refactorings 2009-09-12 21:13:47 +02:00
Daniel Marjamäki f4b6c822d3 Fixed #375 (new check: Detect when using 'this-x') 2009-09-12 15:25:02 +02:00
Daniel Marjamäki ab4a7fdef2 Fixed #518 (False positive for leaks when function from err()-family used) 2009-09-12 14:11:17 +02:00
Daniel Marjamäki 7479b943cc Fixed #644 (Tokenizer::simplifyComma: Wrong simplification in cast) 2009-09-12 08:12:00 +02:00
Daniel Marjamäki 37dae83e06 More Fixing of #635 (Preprocessor: remove 'asm(...)') 2009-09-11 23:34:24 +02:00
Reijo Tomperi ed1c9bed49 Fix ticket #632 (Mathlib isInt() identifies "330L" as not int)
http://sourceforge.net/apps/trac/cppcheck/ticket/632
2009-09-11 23:46:59 +03:00
Daniel Marjamäki 8837e0dcff Simple fix for #635 (preprocessor: remove 'asm(...)') 2009-09-11 21:22:41 +02:00
Reijo Tomperi 908aaff1fa New test case in TestSimplifyTokens::template_default_parameter 2009-09-09 23:57:28 +03:00
Reijo Tomperi ed425158d9 astyle fix 2009-09-06 15:12:38 +03:00
Slava Semushin c1958054af Added test cases for #487. 2009-09-06 18:29:39 +07:00
Daniel Marjamäki 535fe17ffd Templates: Scaled up the handling of default values for template parameters (#638) 2009-09-06 08:22:45 +02:00
Reijo Tomperi 75a65a02a8 Fix another issue related to #647 (Crash during tokenizing (wrong) K&R function declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/647
2009-09-05 23:41:39 +03:00
Reijo Tomperi a3d9863725 Fix #647 (Crash during tokenizing (wrong) K&R function declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/647
Thanks to undingen for providing a patch
2009-09-05 22:21:25 +03:00
Reijo Tomperi 7af4ac4282 New command line argument added --template
Fix ticket #462 (Allow using template to customize output format)
http://sourceforge.net/apps/trac/cppcheck/ticket/462
2009-09-05 22:01:49 +03:00
Slava Semushin a9273c9d39 Fixed #629 (Tokenizer: expand nested strcat() calls)
http://sourceforge.net/apps/trac/cppcheck/ticket/629
2009-09-05 23:46:27 +07:00
Daniel Marjamäki d86a2505f3 Merge branch 'master' of git://github.com/AlekSi/cppcheck into aleksi 2009-09-05 11:03:53 +02:00
Aleksey Palazhchenko d9d2f53df6 Added top-level 'check' target.
Also refactored all. pro files by the way. :)
2009-09-04 22:59:25 +04:00
Daniel Marjamäki 333c6d9e0a memory leaks: Added a todo test case for the getcode function 2009-09-04 19:11:19 +02:00
Aleksey Palazhchenko e48664a3c9 Fixes in test.pro 2009-09-04 11:05:06 +04:00
Reijo Tomperi 23c07dd2b8 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-09-03 23:36:42 +03:00
Reijo Tomperi 7408674017 Fix #601 (Poor var initialization assumption when can't find function definition)
http://sourceforge.net/apps/trac/cppcheck/ticket/601
Fix #641 ((style) Member variable not initialized in the constructor: False Positive)
http://sourceforge.net/apps/trac/cppcheck/ticket/641

This fix will also cause us not to detect several potential issues, but as there are so many
false positives, any unknown function call should stop the error for now. New
ticket is created to handle regression caused by this:
http://sourceforge.net/apps/trac/cppcheck/ticket/643
2009-09-03 23:28:00 +03:00
Daniel Marjamäki 7a9e4a7bd4 templates: remove typename tokens 2009-09-03 22:19:44 +02:00
Daniel Marjamäki 2719724a97 templates: Quick fix for the problem with default value for a template argument 2009-09-03 21:46:07 +02:00
Daniel Marjamäki 401f8aaa96 Templates: Added todo testcase for handling default values for template arguments. Related with ticket #638 2009-09-02 22:54:50 +02:00
Reijo Tomperi 686ff425f9 Fix ticket #637 (False positive, Using 'memset' on struct that contains a 'std::string')
http://sourceforge.net/apps/trac/cppcheck/ticket/637
2009-09-02 23:51:07 +03:00
Reijo Tomperi 7569bda227 Added few memset test cases 2009-09-02 23:32:15 +03:00
Reijo Tomperi 8ab26e85cf Don't warn about division by zero if zero if floating point number.
Fix bug from mathlib isInt() and add test case from which few are false positives
2009-09-01 22:06:46 +03:00
Daniel Marjamäki 93659bbe08 memory leaks: fixed a todo testcase to find more leaks 2009-09-01 20:12:53 +02:00
Daniel Marjamäki 9a47b7110e memory leaks: fixed todo testcases to find more memory leaks 2009-09-01 20:02:28 +02:00
Slava Semushin 0ec848b1fa test/testmemleak.cpp(dofindleak): provide settings object with debug enabled.
This allows to print tokens when syntax error found in one of tests.
2009-09-02 00:38:35 +07:00
Daniel Marjamäki 7ba244cf45 Memory leaks: fixed a todo testcase 2009-09-01 19:33:17 +02:00
Daniel Marjamäki 59a4a36fe1 memory leaks: minor fix for testcase 2009-09-01 19:06:34 +02:00
Slava Semushin eebe7457c9 Fixed #631 (False positive matching iterator which is dereferenced)
http://sourceforge.net/apps/trac/cppcheck/ticket/631
2009-09-01 23:49:17 +07:00
Reijo Tomperi 0d468d97c7 Fix #630 (Division by zero check only looks at first character of divisor)
http://sourceforge.net/apps/trac/cppcheck/ticket/630
Thanks to liam_routt for finding this and providing fix for it.
2009-09-01 17:00:26 +03:00
Daniel Marjamäki c9449f9bd0 Preprocessor: Added a todo testcase 2009-08-31 20:36:25 +02:00
Daniel Marjamäki 03d7573208 Borland C++: Don't warn about uninitialized variables that are declared in the __published section. These are auto-initialized 2009-08-31 19:40:49 +02:00
Reijo Tomperi 67a8a3225c astyle fix 2009-08-30 23:07:37 +03:00
Daniel Marjamäki 960fb861da Refactoring: Refactoring of the unit testing for the CheckMemoryLeakInFunction 2009-08-30 21:11:15 +02:00
Reijo Tomperi 6fb44e733b Fix ticket #612 (Division by zero not detected when zero has type suffix)
http://sourceforge.net/apps/trac/cppcheck/ticket/612
2009-08-30 22:02:09 +03:00
Slava Semushin c50f7787f9 Fixed #569 (Buffer overrun not detected when strcat() called few times)
http://sourceforge.net/apps/trac/cppcheck/ticket/569
2009-08-30 18:44:23 +07:00
Slava Semushin 843ede94f3 Token::getStrLength(): introduce new static method.
No functional change.
2009-08-30 18:07:10 +07:00
Reijo Tomperi e1cdbf3c5a Fix ticket #611 (Preprocessor: the configurations "A;B" and "B;A" are the same)
http://sourceforge.net/apps/trac/cppcheck/ticket/611
2009-08-30 00:00:54 +03:00
Reijo Tomperi fc343b3e9e astyle fix 2009-08-29 23:33:12 +03:00
Daniel Marjamäki 9d7defad22 Fixed #615 (Memleak was detected in 1.32 but not in 1.33 and later) 2009-08-29 17:33:57 +02:00
Daniel Marjamäki 1dd2ec4757 Fixed #414 (memory leak in if-else construct not detected) 2009-08-29 16:55:43 +02:00
Daniel Marjamäki 270d2b2d4f memory leaks: improved the simplification of 'if* ;' 2009-08-29 16:27:16 +02:00
Daniel Marjamäki 8f1f89ae2b memory leaks: fixed todo test case. reduce exit better 2009-08-29 16:03:23 +02:00
Slava Semushin 085187b445 Tokenizer: enhance simplifyNot() and rename to simplifyLogicalOperators().
Don't replace "and" everything becuse it may be used as variable name.

Better fix for #620
Corrections for commit eb05cf904d
2009-08-29 20:42:14 +07:00
Slava Semushin eb05cf904d Fixed #620 (Tokenizer: replace "and" by "&&")
http://sourceforge.net/apps/trac/cppcheck/ticket/620
2009-08-29 19:26:01 +07:00
Slava Semushin ae413a1ef0 Fixed #618 (Tokenizer: Wrong handling of enum)
http://sourceforge.net/apps/trac/cppcheck/ticket/618
2009-08-29 16:42:42 +07:00
Daniel Marjamäki 6347d0e976 memory leaks: better handling of open/close 2009-08-29 09:18:21 +02:00
Daniel Marjamäki 88d0bd3908 astyle 2009-08-29 08:20:18 +02:00
Daniel Marjamäki ee5b2a43c7 Fixed #627 (False positive with --all, Resource leak with open()) 2009-08-29 07:43:44 +02:00
Daniel Marjamäki de9e62e90a Memory leaks: handling asprintf better 2009-08-29 07:26:32 +02:00
Daniel Marjamäki 406fdd3219 Memory leaks: Fixed two todo testcases (getcode handling of asprintf) 2009-08-29 07:02:36 +02:00
Daniel Marjamäki ab047c680c memory leaks: fixed a todo testcase 2009-08-29 06:42:24 +02:00
Daniel Marjamäki 74fd052fc0 Memory leaks: Testing that asprintf is handled correctly 2009-08-28 23:26:40 +02:00
Daniel Marjamki cbc237c37b fixed failed assertions when running the testrunner 2009-08-28 17:05:25 +02:00
danmar 4f6b79b761 Fixed #625 (cppcheck dumps core on valid code) 2009-08-28 12:57:29 +02:00
danmar bb2bda0be4 Fixed #622 (Tokenizer: Calculations are wrong) 2009-08-28 12:13:46 +02:00
Daniel Marjamäki 5d2c409e46 Fixed #623 (False positive: possible null pointer dereference when using the ?: operator) 2009-08-28 08:48:37 +02:00
Reijo Tomperi 929dbe92e4 Fix the last test case from ticket #613 (array members variables are not checked in constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/613
2009-08-26 23:33:23 +03:00
Daniel Marjamäki ff9ed1d7aa Preprocessor: better handling of pragma asm and pragma endasm 2009-08-26 21:54:43 +02:00
Slava Semushin 7c86a10a9d Fixed #617 (False positive "buffer overrun" when sprintf() doesn't have optional parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/617
2009-08-27 00:21:32 +07:00
Daniel Marjamäki 9bdd1def58 added testcase for the Tokenizer::simplifyGoto 2009-08-26 18:54:28 +02:00
Daniel Marjamäki f94aab35e7 Fixed #498 (Tokenizer: simplify 'goto') 2009-08-26 18:46:56 +02:00
Reijo Tomperi d778f67265 Fix sytax error in uninitVarArray(). This also causes the test to fail, so changing it as TODO.
See http://sourceforge.net/apps/trac/cppcheck/ticket/613
2009-08-26 00:42:07 +03:00
Reijo Tomperi e3c1e14bb0 astyle fix 2009-08-26 00:41:03 +03:00
Daniel Marjamäki d67e3fcc49 Refactoring the unit tests of TestMemleakInFunction 2009-08-25 22:18:22 +02:00
Daniel Marjamäki c25e1963b1 Fixed #498 (Tokenizer: simplify 'goto') 2009-08-24 23:10:12 +02:00
Daniel Marjamäki 0c479b8c9f TestClass: Added a testcase where a array member variable is initialized through strcpy 2009-08-24 17:15:29 +02:00
Reijo Tomperi c581753040 Fix ticket #613 (array members variables are not checked in constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/613
Patch from micres
2009-08-23 22:54:41 +03:00
Daniel Marjamäki 9da2ecf4f4 Refactoring the unit testing. Wrote special tests for CheckMemoryLeakInFunction::findleak 2009-08-23 15:48:25 +02:00
Daniel Marjamäki 0da25081d5 refactoring: began refactoring the unit testing for CheckMemoryLeakInFunction. More specific testing of the functions getcode, simplifycode, call_func, etc 2009-08-23 11:26:17 +02:00
Slava Semushin 8cafaf2960 Fixed #603 (Tokenizer: Incorrect simplification of < >)
http://sourceforge.net/apps/trac/cppcheck/ticket/603
2009-08-23 13:26:16 +07:00
Slava Semushin e6120a5725 Fixed #581 (Wrong usage of div-function)
http://sourceforge.net/apps/trac/cppcheck/ticket/581
2009-08-23 10:37:09 +07:00
Slava Semushin ec050d2563 TestOther::varScope5: fixed syntax error in test case.
Testrunner complains about "Unlogged error at Tokenizer::syntaxError"
since 74bbe945f6 commit.
2009-08-22 21:29:09 +07:00
Daniel Marjamäki 724d6bf53a Fixed #507 (Preprocessor: Incorrect expanding of inner macros) 2009-08-22 13:03:52 +02:00
Slava Semushin acc38a8bbf Fixed #592 (Tokenizer: improve the tokenization of do .. while)
http://sourceforge.net/apps/trac/cppcheck/ticket/592
2009-08-22 17:49:42 +07:00
Daniel Marjamäki 94c49bc34e Fixed #608 (Tokenizer: simplifyKnownVariables doesn't handle 'while (--i)' correctly) 2009-08-22 10:23:55 +02:00
Slava Semushin cbeb45566b Fixed #609 (Tokenizer: don't add {} after do-while();)
http://sourceforge.net/apps/trac/cppcheck/ticket/609
2009-08-22 14:49:45 +07:00
Daniel Marjamäki 439ff8b144 Fixed #599 (False positive: null pointer dereference) 2009-08-21 12:42:40 +02:00
Reijo Tomperi 9d1907be66 Fix ticket #600 (Tokenizer: if(!(fclose(fd) == 0)) is simplified incorrectly)
http://sourceforge.net/apps/trac/cppcheck/ticket/600
2009-08-20 22:37:05 +03:00
Reijo Tomperi 7d44ce7736 Fix ticket #598 (Preprocessor: Multiline comments add line change to wrong location)
http://sourceforge.net/apps/trac/cppcheck/ticket/598
2009-08-20 00:27:47 +03:00
Daniel Marjamäki 8b46172bcf Memory leaks: Use varid instead of varname 2009-08-19 19:42:07 +02:00
Daniel Marjamäki 85682ed429 Fixed #591 (False positive: Deallocating a deallocated pointer) 2009-08-18 20:49:08 +02:00
Slava Semushin 74bbe945f6 Fixed #272 ("The scope of the variable XXX can be limited" not detected when variable is initilialized during declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/272
2009-08-17 02:12:57 +07:00
Daniel Marjamäki 52856fcbeb ettlmartin: improved the MathLib::IsInt 2009-08-16 18:45:26 +02:00
Slava Semushin be89be8c30 Fixed #590 (False positive: Invalid deallocation when variables have same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/590
2009-08-16 15:27:40 +07:00
Reijo Tomperi c8da301f83 fix ticket #586 (Preprocessor: Lines like "#error don't" can cause "no pair for character" errors)
http://sourceforge.net/apps/trac/cppcheck/ticket/586
2009-08-14 00:22:51 +03:00
danmar 3de825c290 Borland C++ Builder: Fixed compilation and testrunner problems 2009-08-13 22:13:52 +02:00
Reijo Tomperi 4f8a06ed0d Initial work for class and member function/variable list in tokenizer. 2009-08-12 23:50:03 +03:00
Daniel Marjamäki bcab694a74 preprocessor: added todo testcase for detecting redundant preprocessor conditions 2009-08-12 20:28:43 +02:00
Daniel Marjamäki ad4ea01750 Fixed #583 (False positive: the nullpointer check doesn't handle goto properly) 2009-08-12 18:54:52 +02:00
Slava Semushin 4c32057180 Fixed ticket #541 (Wrong testcases produce unlogged error at Tokenizer::syntaxError)
http://sourceforge.net/apps/trac/cppcheck/ticket/541
2009-08-12 02:06:41 +07:00
Slava Semushin 6a7624054e Fixed ticket #584 (Tokenizer: don't set varId for class declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/584
2009-08-12 01:58:49 +07:00
Daniel Marjamäki e7feac506c Refactoring: updated the nullPointer message so it contains the name of the pointer 2009-08-11 17:18:01 +02:00
Daniel Marjamäki ecdbcbce3d Fixed #566 (False positive when assigning the return value of realloc(NULL,..) to a pointer variable holding a freed memory address) 2009-08-10 22:04:28 +02:00
Daniel Marjamäki 045b73c7ec Fixed #582 (Preprocessor: Remove assembler code inside pragmas) 2009-08-10 20:07:55 +02:00
Reijo Tomperi 93604dd344 Fixed ticket #578 (missing virtual destructor not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/578
2009-08-10 17:58:13 +03:00
Daniel Marjamäki 3331cb834f Hoangtuansu: Fixed #537 (false positive::operator= should return something) 2009-08-09 19:57:48 +02:00
Gianluca Scacco ba4754a784 Added new test for invalid deallocation 2009-08-09 15:43:00 +02:00
Slava Semushin c66103f7bc Fixed ticket #574 (Tokenizer: not assign varId when variable first afer keyword and has long type)
http://sourceforge.net/apps/trac/cppcheck/ticket/574
2009-08-09 15:41:31 +07:00
Slava Semushin 1fd2c0ff28 Fixed ticket #572 (Tokenizer: improve detection of arrays)
http://sourceforge.net/apps/trac/cppcheck/ticket/572
2009-08-09 15:16:37 +07:00
Slava Semushin 5f3baba178 Fixed ticket #573 (False positive of set range check when we dereferencing iterator)
http://sourceforge.net/apps/trac/cppcheck/ticket/573
2009-08-09 02:07:33 +07:00
Slava Semushin 0f96299d87 Fixed ticket #570 (Buffer overrun not detected when sprintf() format string greater then buffer size)
http://sourceforge.net/apps/trac/cppcheck/ticket/570
2009-08-08 21:52:35 +07:00
Slava Semushin 92d4c086ce Fixed ticket #571 (Buffer overrun for sprintf() not detected after first ')' symbol)
http://sourceforge.net/apps/trac/cppcheck/ticket/571
2009-08-08 21:03:10 +07:00
Slava Semushin 50f7fa5828 Fixed ticket #565 (Tokenizer: simplify variable declaraion like 'int z = x >> 16')
http://sourceforge.net/apps/trac/cppcheck/ticket/565
2009-08-08 17:33:07 +07:00
Daniel Marjamäki a0a4008e17 Fixed #525 (false positive: vector range checking with <) 2009-08-07 16:23:28 +02:00
Reijo Tomperi d719606201 Fixed ticket #564 (set variable id for "struct ABC **p")
http://sourceforge.net/apps/trac/cppcheck/ticket/564
2009-08-07 00:31:39 +03:00
Reijo Tomperi 80953633ee Fix ticket #563 (set variable id for **p)
http://sourceforge.net/apps/trac/cppcheck/ticket/563
2009-08-06 23:11:29 +03:00
Daniel Marjamäki ce8c5b0236 Fixed #555 (False positive: [CuTest.c:25]: (error) Memory leak: len) 2009-08-05 21:18:16 +02:00
Daniel Marjamäki e1beb70f80 Fixed #558 (Tokenizer: Bad simplification of 'for(unsigned i = 0; i < 100; ++i)') 2009-08-05 20:15:48 +02:00
Daniel Marjamäki 1c59e4a51b Fixed #528 (Tokenizer: Simplify: 'if(!(a->x=b()))') 2009-08-05 19:45:05 +02:00
Daniel Marjamäki 9e348ca739 Fixed #554 (resource leak false positive) 2009-08-04 21:34:14 +02:00
Daniel Marjamäki 706ba34a6d Refactoring the unit testing 2009-08-04 21:32:14 +02:00
Reijo Tomperi 975e7778ab Fix ticket #531 (false positive about missing virtual destructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/531
2009-08-04 22:23:22 +03:00
Reijo Tomperi 769119c725 Fix ticket #552 (False positive with --all when realloc is used with two variables.)
http://sourceforge.net/apps/trac/cppcheck/ticket/552
2009-08-02 23:30:43 +03:00
Reijo Tomperi 10f6678cf9 TODO test case realloc5 added and "Checkmemoryleak: simplifycode result for" debug info added. 2009-08-02 22:23:47 +03:00
Slava Semushin 822fb93cda Improved "index out of bounds" check.
Corrected 342acaaaf2 commit.
2009-08-02 19:29:45 +07:00
Slava Semushin f38530fb31 test/testbufferoverrun.cpp: improve test cases. 2009-08-02 19:29:37 +07:00
Slava Semushin ed86eda07d Fixed ticket #549 (Tokenizer: improve calculation simplification)
http://sourceforge.net/apps/trac/cppcheck/ticket/549
2009-08-02 15:45:33 +07:00
Slava Semushin 342acaaaf2 Fixed #547 (index out of bounds not detected when addition used as array index)
http://sourceforge.net/apps/trac/cppcheck/ticket/547
2009-08-02 14:59:02 +07:00
Slava Semushin 0445edf6fe Fixed #542 (Tokenizer: allow numbers in templates parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/542
2009-08-01 23:17:35 +07:00
Slava Semushin 0e2273833e Fixed ticket #539 (Tokenizer: don't replace constants variables with varid 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/539
2009-08-01 20:57:54 +07:00
Daniel Marjamäki b5d172b6e9 preprocessor: fixed problem in Preprocessor::expandMacros when macro argument is for example 'unsigned long' 2009-08-01 14:55:45 +02:00
Daniel Marjamäki e6713e9774 null pointers: fixed a false positive 2009-08-01 11:30:37 +02:00
Daniel Marjamäki b7ffcf53ba Fixed #511 (false positive, memory leak when using 'var = ({});') 2009-07-31 23:42:21 +02:00
Slava Semushin 8588012df7 Fixed #521 (Tokenizer: improve static variable detection)
Also change cppcheck default behavior to don't show "If you see this,
there is a bug" message for each variable without varId. This feature
was very helpful for developers but may annoying users.

http://sourceforge.net/apps/trac/cppcheck/ticket/521
2009-08-01 00:40:36 +07:00
Daniel Marjamäki 2b26a320f0 astyle formatting 2009-07-31 14:01:50 +02:00
Daniel Marjamäki 2d9e4e1a73 null pointers: detect when there are possible null pointer dereferencing when looping through a linked list both in inner and outer loops at the same time 2009-07-31 10:49:43 +02:00
Daniel Marjamäki 228e926654 null pointers: Added a todo testcase 2009-07-30 21:57:23 +02:00
Slava Semushin 347802f819 Fixed ticket #503 (Dereferencing after erase() not work if we try to get access to member)
http://sourceforge.net/apps/trac/cppcheck/ticket/503
2009-07-31 00:49:38 +07:00
Slava Semushin 5db677bc30 Fixed ticket #523 (Tokenizer: set varId for types with long namespaces)
FIXME: skip namespaces by the best way.

http://sourceforge.net/apps/trac/cppcheck/ticket/533
2009-07-31 00:40:41 +07:00
Slava Semushin 681b836389 Fixed ticket #532 (Tokenizer: set varId for types which have comma in template parameter)
http://sourceforge.net/apps/trac/cppcheck/ticket/532
2009-07-31 00:25:26 +07:00
Daniel Marjamäki d06e669017 Preprocessor: Speedup of the match_cfg_def function 2009-07-30 10:10:34 +02:00
Reijo Tomperi 2fa3b4ce60 Added more tests to test case TestSimplifyTokens::ifassign1 2009-07-30 01:39:28 +03:00
Reijo Tomperi b56fdb83da Fixed ticket #529 (Tokenizer: simplify if((x==0)))
http://sourceforge.net/apps/trac/cppcheck/ticket/529
2009-07-30 00:37:01 +03:00
Daniel Marjamäki 050b85c5eb memory leak for struct member: fixed false positive when the struct pointer is stored away 2009-07-29 11:38:20 +02:00
Daniel Marjamäki 4e66dc105e null pointers: Fixed false positive when 'do' are used 2009-07-29 11:17:22 +02:00
Slava Semushin 367efe31ea Fixed ticket #524 (Containers range check shouldn't stop at first founded error)
http://sourceforge.net/apps/trac/cppcheck/ticket/524
2009-07-29 03:55:23 +07:00
Slava Semushin 8b0c1daf98 Fixed ticket #522 (Tokenizer: recognize comma in container with STL type declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/522
2009-07-29 02:46:33 +07:00
Slava Semushin f50aa1e188 Fixed ticket #520 (Tokenizer: properly set varId for containers with STL types)
http://sourceforge.net/apps/trac/cppcheck/ticket/520
2009-07-29 00:54:13 +07:00
Slava Semushin c8caefa94c Fixed ticket #519 (Tokenizer converts commas in for-loops)
http://sourceforge.net/apps/trac/cppcheck/ticket/519
2009-07-28 23:40:15 +07:00
Slava Semushin 600f3a834d Fixed ticket #514 (false positive:: memory leak when using comma near delete[])
http://sourceforge.net/apps/trac/cppcheck/ticket/514
2009-07-28 02:13:08 +07:00
Slava Semushin 37fe631639 test/testautovariables.cpp: renamed some testcases.
Make it readable.

No functional change.
2009-07-28 00:36:56 +07:00
Slava Semushin 82ae0e305b checkautovariables: added newlines to make code more readable.
No code change.
2009-07-28 00:34:17 +07:00
Slava Semushin bb4b2b707c Fixed ticket #517 (False positive for extern variables: return of the address of an auto-variable)
http://sourceforge.net/apps/trac/cppcheck/ticket/517
2009-07-28 00:32:01 +07:00
Reijo Tomperi 358aa5be8d Improve test case TestSimplifyTokens::comma_keyword 2009-07-27 00:08:18 +03:00
Daniel Marjamäki b4a6d74e42 astyle formatting 2009-07-26 22:13:08 +02:00
Slava Semushin 6c022798ea Fixed ticket #499 (buffer overflow not detected when using macros)
sprintf() buffer overrun detection works wrong due to typo (since time
when it was added in commit a604f56f19).

Also reports buffer overrun when sprintf() writes bytes equal to
buffer size -- in this case off-by-one error appears.

http://sourceforge.net/apps/trac/cppcheck/ticket/499
2009-07-26 19:29:46 +07:00
Slava Semushin a73346e889 Fixed ticket #496 (Tokenizer: simplify statements with "," better)
https://sourceforge.net/apps/trac/cppcheck/ticket/496
2009-07-26 18:03:11 +07:00
Reijo Tomperi a07b7635c0 Fix ticket #265 (Log a warning when an include file is not found)
http://sourceforge.net/apps/trac/cppcheck/ticket/265
2009-07-25 22:10:30 +03:00
Daniel Marjamäki a6d696bf40 Fixed #504 (false positive: null pointer dereference) 2009-07-25 20:36:02 +02:00
Daniel Marjamäki b172d62cae Added more tests to the TestPreprocessor::match_cfg_def (#505) 2009-07-25 17:04:13 +02:00
Daniel Marjamäki f877cd2db1 Preprocessor: Added todo test case for better evaluation of #if conditions 2009-07-25 16:22:42 +02:00
Daniel Marjamäki dacaff824c Fixed #501 (Preprocessor should read open configurations that are defined within the file) 2009-07-25 13:58:34 +02:00
Slava Semushin 8643936e0c Fixed ticket #500 (Tokenizer: simplify the "(p != NULL)" conditions)
Also teach simplifyIfNot() to handle variables like Foo::var.

https://sourceforge.net/apps/trac/cppcheck/ticket/500
2009-07-25 18:23:03 +07:00
Slava Semushin 88d7c598e3 test/testtokenize.cpp: use tokenizeAndStringify() function.
Instead of self-written code.

No functional change.
2009-07-25 16:41:16 +07:00
booga 9fa8c0ee9c astyle FTW (should have read about that sooner) 2009-07-24 19:23:30 -04:00
booga 52e2e775b2 Fix #476 STL Container checks.
Fix #473 Add post increment check for STL objects and Classes.
2009-07-24 18:36:15 -04:00
Daniel Marjamäki 9136d8cf80 Tokenizer: simplify return statements - remove redundant parantheses 2009-07-24 21:55:35 +02:00
Daniel Marjamäki 6bb85703f6 memory leaks: fixed false positive for struct members - better handling of if/else 2009-07-24 09:05:40 +02:00
Daniel Marjamäki 73c028bdb7 memory leaks: added a todo test case for struct members when using if-else 2009-07-23 22:29:31 +02:00
Daniel Marjamäki 5b81c92a14 null pointers: fixed false positives when checking if pointer is null at many locations (#485) 2009-07-23 19:59:29 +02:00
Daniel Marjamäki 06c8ff9d0d null pointers: fixed false positives (#49) 2009-07-23 19:02:14 +02:00
Daniel Marjamäki 565ac2fca6 Fixed #493 (Memory leak: False positive when using the exit(0)) 2009-07-23 16:30:30 +02:00
Daniel Marjamäki d0f1d885ed null pointers: dereferencing a pointer and then checking if it's null (#49) 2009-07-23 14:13:46 +02:00
Daniel Marjamäki 024778d6eb tokenizer: simplify '?:' better when the condition is always true 2009-07-23 10:12:02 +02:00
Daniel Marjamäki 9b2dd8c7eb Preprocessor: Better evaluation of conditions such as '#if defined A || defined B' (#469) 2009-07-22 20:11:27 +02:00
Daniel Marjamäki e36994f54b astyle formatting 2009-07-22 18:48:42 +02:00
Daniel Marjamäki 6fecd858e3 Fixed #469 (Preprocessor should read open configurations that are defined within the file) 2009-07-22 18:47:50 +02:00
Daniel Marjamäki 1d514e1afe Fixed #497 (Templates are not expanded correctly) 2009-07-22 13:29:42 +02:00
Daniel Marjamäki 3243933c90 Fixed #494 (False positives of checking leaks struct members)
Better handling of function calls
2009-07-22 08:30:51 +02:00
Daniel Marjamäki ba36c9426b null pointers: better checking when dereferencing pointer and then checking if it is null (#485) 2009-07-21 17:00:11 +02:00
Daniel Marjamäki 6f646246ee dereferencing deallocated memory: it is ok to take the address to deallocated memory but it is not ok to dereference the address 2009-07-21 13:04:13 +02:00
Daniel Marjamäki 45f8560537 invalid pointer usage: broke out CheckOther::invalidPointer from the CheckOther::nullPointer (#485) 2009-07-21 12:09:58 +02:00
Daniel Marjamäki ce595dd5c7 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-07-21 07:41:43 +02:00
Reijo Tomperi 973bb164ea Fix ticket #486 (C-style pointer casting misses const pointers)
http://sourceforge.net/apps/trac/cppcheck/ticket/486
2009-07-20 22:52:27 +03:00
Daniel Marjamäki 0e208eb52f null pointer dereferencing: fixed another false positive (#485) 2009-07-20 19:59:55 +02:00
Daniel Marjamäki 05a1c50ff2 null pointer dereferencing: removed a few false positives in the new check that I added (#485) 2009-07-20 19:30:33 +02:00
Daniel Marjamäki b7ba49114c Fixed #485 (detect when code is checking for null after dereferencing) 2009-07-20 18:53:41 +02:00
Daniel Marjamäki 74699cab66 memory leak for struct member: made the checking more sensitive. Skip bail-out execution paths were the member is properly deallocated 2009-07-20 14:39:24 +02:00
Daniel Marjamäki ddaea3244d memleak: implemented simple checking for leaking struct members 2009-07-19 16:51:31 +02:00
Slava Semushin d961e4b5c1 test/testrunner.cpp: fixed exit code when count of fails tests equals to 256.
When 256 tests fails return code was 0 and it was wrong. Now exit code
may be only 0 or 1 and not show how many tests fails.

Thanks to aggro80@ for pointing to this!
2009-07-19 03:12:55 +07:00
Daniel Marjamäki ffac9281c4 astyle formatting 2009-07-18 20:35:22 +02:00
Slava Semushin 2ba0897ecb src/checkmemoryleak.cpp: added fchmod() function to white list. 2009-07-18 23:48:48 +07:00
Slava Semushin d3490abd64 Finally fixed ticket #284 (style check: redundant condition improvement)
http://sourceforge.net/apps/trac/cppcheck/ticket/284
2009-07-18 21:42:08 +07:00
Slava Semushin d04eeb4fd4 Fixed ticket #481 (testrunner should exit with non-zero status if one of tests fails)
http://sourceforge.net/apps/trac/cppcheck/ticket/481
2009-07-18 19:08:10 +07:00
Slava Semushin a0a526a205 Fixed ticket #464 (resource leak not detected when getc is used on the file handle)
http://sourceforge.net/apps/trac/cppcheck/ticket/464
2009-07-18 18:32:55 +07:00
Slava Semushin 53c120c701 Fixed ticket #479 (varId not assigned to reference to standart container)
http://sourceforge.net/apps/trac/cppcheck/ticket/479
2009-07-18 17:41:46 +07:00
Slava Semushin aab06eaeab Fixed ticket #477 (Bug in Token::Match() during process TestStl::pushback3)
http://sourceforge.net/apps/trac/cppcheck/ticket/477
2009-07-18 17:06:51 +07:00
Daniel Marjamäki 2ccc01f5ed tokenizer: improved the Tokenizer::simplifyIfNot 2009-07-18 10:18:46 +02:00
Slava Semushin 5dea30519c Fixed ticket #459 (false positive::Member variable not initialized in constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/459
2009-07-17 23:50:49 +07:00
Kimmo Varis 40ccd4d1ac Add QMake project files for core and tests.
Ticket #472 (QMake project file to build cppcheck core).
2009-07-14 14:36:05 +03:00
Daniel Marjamäki 456c20b705 fixed todo test case - detect iterator usage after push_front|push_back 2009-07-14 12:40:47 +02:00
Daniel Marjamäki 69b1df3bb8 tokenizer: simplify the '?:' operator 2009-07-14 12:06:38 +02:00
Daniel Marjamäki f4de77cefc simplify tokens: simplify test cases 2009-07-14 11:37:26 +02:00
Daniel Marjamäki 17008879ac minor refactoring: header cleanup. use forward declarations instead of includes 2009-07-13 19:11:31 +02:00
Daniel Marjamäki 18f9e05f5a refactoring: Renamed checking classes 2009-07-13 16:00:15 +02:00
Kimmo Varis 6393498966 Astyle fixes. 2009-07-13 16:51:35 +03:00
Daniel Marjamäki 7d35447d80 refactoring: renamed the severity "all" to "possible error" 2009-07-13 10:16:31 +02:00
Daniel Marjamäki 03f3ee62a0 cleanup: removed deprecated files. security checking and errmsg 2009-07-12 19:18:38 +02:00
Daniel Marjamäki b86b07827a unused private functions: don't check classes declared in header files unless it is known that their whole implementation is seen 2009-07-12 14:23:01 +02:00
Daniel Marjamäki 36896e1ca0 better description for the message with id strncatUsage 2009-07-11 12:16:38 +02:00
Daniel Marjamäki 59372199e3 Revert "cppcheck: Now it's possible to change the output format, for example to a visual studio compliant format"
This reverts commit 91a8dbd7b9.
2009-07-10 22:38:26 +02:00
Daniel Marjamäki 91a8dbd7b9 cppcheck: Now it's possible to change the output format, for example to a visual studio compliant format 2009-07-08 14:38:13 +02:00
Daniel Marjamäki 0ea09b1cb6 templates: simplified a todo test case by removing a redundant function from the code 2009-07-08 09:38:59 +02:00
Daniel Marjamäki 2a02041fd8 memleak: fixed todo test case 2009-07-07 15:22:37 +02:00
Daniel Marjamäki ddc1ad7d4d Fixed #431 (Unused private function, wrong line when two functions with same name) 2009-07-07 08:55:14 +02:00
Daniel Marjamäki 9d1d7ebf8d Fixed #382 (False positive: public function flagged as 'Unused private function') 2009-07-07 08:30:23 +02:00
Daniel Marjamäki 7b2f6b6173 addon to previous commit - changed ASSERT_EQUALS to TODO_ASSERT_EQUALS for the todo test case 2009-07-06 12:38:04 +02:00
Daniel Marjamäki 5efb834f36 Memory leaks: Added a simple todo test case 2009-07-06 12:33:31 +02:00
Daniel Marjamäki 9beb73824b Fixed #446 (memory leak false positive when variable is static) 2009-07-06 12:20:13 +02:00
Daniel Marjamäki a6ac747830 tokenizer: Don't simplify declarations of static variables 2009-07-06 11:45:14 +02:00
Reijo Tomperi 8b0e481d46 Refactoring: Rename member functions to follow naming guidelines. 2009-07-05 23:16:43 +03:00
Reijo Tomperi f676deb208 Test case improvement, unused function removed from tokenizer. 2009-07-05 22:37:53 +03:00
Reijo Tomperi e858ab2f0d Fix ticket #457 (False positive: Member variable not assigned a value in copy constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/457
Simplify "a = 0, b = 0;" into "a = 0; b = 0;"
2009-07-05 21:29:09 +03:00
Reijo Tomperi 290aefaa3d TODO Test case TestSimplifyTokens::remove_comma added 2009-07-04 18:06:25 +03:00
Reijo Tomperi 26358debcf Fix ticket #448 (false positive:: resource leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/448
Tokenizer improved to simplify "if( (p)==-1 )"
2009-07-03 21:57:44 +03:00
Reijo Tomperi b2474fd980 Fix ticket #452 (Failure to detect "member var not initialized in constructor" if class inherits)
http://sourceforge.net/apps/trac/cppcheck/ticket/452
2009-07-03 21:22:14 +03:00
Reijo Tomperi 751a31ed91 Fix ticket #445 (simple to avoid false positive for buffer overflow)
http://sourceforge.net/apps/trac/cppcheck/ticket/445
Simple bailout in case "if" is found inside the for-loop.
2009-06-30 00:42:46 +03:00
Daniel Marjamäki 7ec8e2396f Fix ticket #267 (Glued define and define name in output text)
The handling of ifdef configurations where rewritten. Either a
configuration is handled properly or it is not handled at all.
2009-06-26 13:19:55 +02:00
Daniel Marjamäki 13ca5f89be added test case 2009-06-23 18:29:43 +02:00
Reijo Tomperi bdf1987cc4 Fix ticket #435 (False positive: Invalid number of character when ({}) is used in code)
http://sourceforge.net/apps/trac/cppcheck/ticket/435
2009-06-22 23:54:11 +03:00
Slava Semushin 13e805f332 Fixed ticket #399 (Add detection for resource leaks after open() usage)
http://sourceforge.net/apps/trac/cppcheck/ticket/399
2009-06-21 22:01:43 +07:00
Daniel Marjamäki 8715ba1458 CheckMemoryLeakInFunction: More sensitive checking when the code calls an unknown function 2009-06-21 14:12:59 +02:00
Daniel Marjamäki f28dec1f5a detect memory leak when all is given when calling an unknown function 2009-06-21 13:48:39 +02:00
Daniel Marjamäki a0ba52ccf1 Preprocessor: Replace "#if !defined(A)" with "#ifndef A" 2009-06-21 08:03:42 +02:00
Reijo Tomperi ac6e7b40e5 Fix ticket #426 (Problem with include)
http://sourceforge.net/apps/trac/cppcheck/ticket/426
2009-06-20 23:13:19 +03:00
Daniel Marjamäki 8a3ec4549b Fixed #425 (False positive: usage of char variable.. c = c & 0x03)
Using char variables in bit operations are ok if:
 * the result is stored in a char
 * the variable is and'ed with a number that is less than 0x100
2009-06-20 19:24:58 +02:00
Daniel Marjamäki 453a5cdd47 Fixed ticket #411 (false positive: resource leak in while loop) 2009-06-20 13:58:30 +02:00
Daniel Marjamäki 13b8f10906 refactoring testcases for Tokenizer::simplifyAddBraces 2009-06-20 13:20:51 +02:00
Daniel Marjamäki 03944f1b96 Tokenizer: Fixed problem when simplifying casts 2009-06-19 19:25:56 +02:00
Reijo Tomperi 5f7d88b36c Fix ticket #416 (False positive: Redundant code)
http://sourceforge.net/apps/trac/cppcheck/ticket/416
2009-06-19 19:03:09 +03:00
Daniel Marjamäki 6e1281ec34 Preprocessor: Better handling of macros that has parantheses but not parameters such as "#define AAA( ) aaa" 2009-06-19 16:42:47 +02:00
Daniel Marjamäki 58c7414ce0 Fixed ticket #417 (Crashes in windows because of invalid char value)
negative char values are allowed in strings and comments. but not in other code.
2009-06-19 15:43:46 +02:00
Daniel Marjamäki 12c9f09780 Fixed #420 (WarningOldStylePointerCast() needs a test case) 2009-06-19 12:01:27 +02:00
Kimmo Varis 3da3c74f6f Revert "Fix ticket #417 (Crashes in Windows because of invalid char value)"
This reverts commit 70db2562f4.

See the ticket - the fix was not correct fix.
2009-06-19 10:20:15 +03:00
Kimmo Varis 1619b6cb0f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-19 00:11:17 +03:00
Daniel Marjamäki d5d96d2535 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-18 23:10:16 +02:00
Kimmo Varis 48ac595ae0 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-19 00:09:37 +03:00
Daniel Marjamäki 12f3ac5a2f Preprocessor: better handling of "..." and "__VA_ARGS__" in macros 2009-06-18 23:09:11 +02:00
Kimmo Varis 70db2562f4 Fix ticket #417 (Crashes in Windows because of invalid char value)
8-bit characters and UTF-8 characters are now converted to spaces. They can only appear in the code files in comments or string/char constants. So we cannot just ignore them as that would change length.
2009-06-19 00:09:05 +03:00
Reijo Tomperi e8d1905e6d Fix ticket #418 (delete a,b; not tokenized correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/418
2009-06-19 00:00:16 +03:00
Reijo Tomperi b7171c3cd2 Fix ticket #413 (false positive: C-style pointer casting for pure virtual function)
http://sourceforge.net/apps/trac/cppcheck/ticket/413
2009-06-18 23:26:21 +03:00
Reijo Tomperi c28cd3f82e astyle fix 2009-06-18 21:05:42 +03:00
Slava Semushin fafc261611 Fixed ticket #278 (variable id: references are not handled correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/278
2009-06-18 23:30:04 +07:00
Daniel Marjamäki 5d0d21d668 Fixed a false positive (memory leak)
This false positive was first discovered in the VLC sourcecode. The TestMemoryLeakInFunction::simple11 test case is a simplified test code of that code.
2009-06-17 21:42:49 +02:00
Reijo Tomperi f8b3a57682 Fix ticket #309 (false positive::is not assigned a value in 'A::operator=')
http://sourceforge.net/apps/trac/cppcheck/ticket/309
2009-06-17 00:58:16 +03:00
Daniel Marjamäki b7c9a4ed8c Created a new class for detecting leaks (forgetting to free struct members) 2009-06-16 22:01:04 +02:00
Daniel Marjamäki ed98f1b367 Fixed #131 (Regression: leak reported by 1.27 is not reported by 1.29)
The leak will be reported as a definite bug again. Not just a possible bug.
cppcheck don't know if the execution path is possible, but it knows that if the execution path is taken the memory leak will be certain.
2009-06-16 19:05:05 +02:00
Daniel Marjamäki a81b6487bf Improved the "CheckMemoryLeak::functionReturnType" 2009-06-15 21:13:39 +02:00
Daniel Marjamäki 433ff048a4 Fixed #264 (Memory Leak: alloc by assigning to a return value)
The fix was inspired by the previous patch submitted by hoangtuansu
2009-06-15 17:44:59 +02:00
Reijo Tomperi 7c4423889c Fixed ticket #405 (#ifdef A and #if defined A should be handled as same configuration)
http://sourceforge.net/apps/trac/cppcheck/ticket/405
2009-06-14 23:37:18 +03:00
Slava Semushin 8c327f82b3 Fixed ticket #346 (adding a "const" token prevents detection of memory leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/346
2009-06-15 00:32:34 +07:00
Daniel Marjamäki af7c63155e Fixed #387 (Templates: template functions that return a pointer are not simplified correctly)
* Fixed so that the tokenizer handle variable declarations better when the variable is assigned the return value of a template function
 * Fixed so that the simplifyTemplates detect that a template function is used when its return value is taken
2009-06-14 14:57:47 +02:00
Daniel Marjamäki c56c913635 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-14 11:30:22 +02:00
Daniel Marjamäki be52e573f3 Fixed ticket #387 (Templates: template functions that return a pointer are not simplified correctly) 2009-06-14 11:28:25 +02:00
Slava Semushin bc32d04efa Replace tok->previous()->previous() call to tok->tokAt(-2).
Done by command:
git grep -l 'previous()->previous()' | xargs sed -i 's|previous()->previous()|tokAt(-2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin 4245047674 Replace tok->next()->next() call to tok->tokAt(2).
Done by command:
git grep -l 'next()->next()' | xargs sed -i 's|next()->next()|tokAt(2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin 4dd3835617 Embed errout.str() into ASSERT_EQUALS() call.
Get rid of useless variables.

No functional change.
2009-06-14 13:33:44 +07:00
Daniel Marjamäki 2307395d6e Fixed ticket #373 (False unused functions)
Skip template functions when checking for unused functions
2009-06-14 07:58:36 +02:00
Slava Semushin 084b3c002f Fixed ticket #403 (false positive::Array index out of range)
http://sourceforge.net/apps/trac/cppcheck/ticket/403
2009-06-14 11:21:20 +07:00
Daniel Marjamäki 777790ebc7 Fixed ticket #367 (Deallocating a deallocated pointer false positive when va_list used)
The overall matching of functions when calls are made were improved.
2009-06-12 17:31:29 +02:00
Daniel Marjamäki 35b6b2588e Fixed ticket #374 (False positive: The scope of variable can be limited)
A few refactorings and fixes were made
2009-06-12 16:17:51 +02:00
Slava Semushin cba0d9e130 Fixed ticket #392 (false positive and wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/392
2009-06-12 21:14:01 +07:00
Slava Semushin 7bee0cd2df Fixed ticket #390 (wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/390
2009-06-12 20:04:58 +07:00
Reijo Tomperi 092bd79ec4 Fix ticket #386 (False positive (memory leak) with comma)
http://apps.sourceforge.net/trac/cppcheck/ticket/386
2009-06-11 00:12:26 +03:00
Daniel Marjamäki d8f95f68c3 Fixed ticket #377 (False positive with "char a[]")
Updated the tokenizer so "char a[]" is tokenized into "char *a"
2009-06-10 19:36:00 +02:00
Slava Semushin fe5d0c56ba Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-10 01:56:26 +07:00
Slava Semushin d9f2dd385b test/testrunner.cpp: removed unused headers.
No functional change.
2009-06-10 01:52:42 +07:00
Daniel Marjamäki a71d260308 Refactoring: Moved CheckOther::returnPointerToLocalVariable to CheckAutoVariables 2009-06-09 19:45:58 +02:00