Commit Graph

529 Commits

Author SHA1 Message Date
Daniel Marjamäki 53fc0ca5e6 Tokenizer: Refactoring. Merged two patterns into one pattern. 2010-11-06 15:55:37 +01:00
Daniel Marjamäki afcc28e9ee Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables 2010-11-06 15:42:41 +01:00
Robert Reif 8a379d4826 Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug) 2010-11-06 15:15:50 +01:00
Robert Reif c49a8a99a3 Fixed #2175 (Tokenizer::simplifyTypedef : wrong simplification of 'typedef float vec_t[3];') 2010-11-06 13:28:44 +01:00
Daniel Marjamäki c39fbb86db Tokenizer::simplifyKnownVariables : Fixed TODO test case when simplifying pointer alias in function call 2010-11-06 13:24:33 +01:00
Daniel Marjamäki 13c2a73d3f Tokenizer::simplifyKnownVariables: Fixed TODO test case. 2010-11-06 11:38:58 +01:00
Daniel Marjamäki 314e5b838b Tokenizer: removed redundant assignments such as 'x+=0;'. Ticket: #2173 2010-11-06 07:23:35 +01:00
Robert Reif 431201dd67 Fixed #2174 (Tokenizer::simplifyFunctionReturn bug) 2010-11-06 06:53:09 +01:00
Daniel Marjamäki 52faadda89 Tokenizer: simplify calculations with zero better 2010-11-05 20:35:31 +01:00
Daniel Marjamäki 4fdb420454 Tokenizer: simplifyknownvariables, improved handling of string constant 2010-11-05 20:05:57 +01:00
Daniel Marjamäki d21974777c Fixed #2161 (false positive: assigned a value that is never used) 2010-11-04 20:16:17 +01:00
Daniel Marjamäki 0984a0be47 Tokenizer: Fixed 'a[b-1]+=1' 2010-11-04 19:38:19 +01:00
Daniel Marjamäki fce6f11ed8 Tokenizer: simplify 'a[b-1]+=1' better 2010-11-04 19:02:54 +01:00
Daniel Marjamäki 1323cbdb6d Fixed #2160 (#2160 (Invalid unused variable report (style))) 2010-11-03 19:30:00 +01:00
Daniel Marjamäki dd4b2b8b46 Tokenizer: simplify 'x[0] += 1;' 2010-11-02 19:22:48 +01:00
Daniel Marjamäki c4452effa3 Tokenizer: simplify 'x.y += 1;' 2010-11-01 20:33:55 +01:00
Daniel Marjamäki 1b9de20f9b Tokenizer: simplify 'case 0: x += y;' 2010-11-01 19:31:30 +01:00
Daniel Marjamäki 3fb17baa12 Fixed #2158 (False positive: value is not unused when using +=) 2010-11-01 17:36:54 +01:00
Daniel Marjamäki 6c19ea7b53 Tokenizer: Added a few comments 2010-10-31 09:58:44 +01:00
Daniel Marjamäki 23d3fd3a5a Fixed #2147 (uninitialized variable: false negative for 'x += y;') 2010-10-31 08:47:13 +01:00
Kimmo Varis 9627b667a1 Move simplifyPath method from FileLister to Path class.
simplifyPath() "fits" better to Path class conceptually. It handles
paths, not lists them. Also this way we get rid of few unneeded
dependencies to FileLister class.
2010-10-29 22:21:27 +03:00
Daniel Marjamäki 9435fde551 Tokenizer: Added function for checking if code is Java/C# 2010-10-28 18:51:55 +02:00
Pete Johns 8022baec2a Removed unnecessary code duplication. 2010-10-27 19:34:06 +11:00
Daniel Marjamäki a38b14d582 Tokenizer: Remove redundant semi colons 2010-10-26 21:05:20 +02:00
Daniel Marjamäki 6200d4505a Fixed #2118 (Invalid syntax error report.) 2010-10-26 19:39:48 +02:00
Daniel Marjamäki 6a66d32871 JAVA: better handling of java code 2010-10-20 22:15:35 +02:00
Daniel Marjamäki 8b866178ff Fixed #2103 (false positive when variable is checked to NULL and not freed) 2010-10-20 20:38:37 +02:00
Daniel Marjamäki 02ba2b202e Fixed #2110 (Tokenizer::simplifyTypedef: regression - wrong simplification of 'typedef char TString[256];') 2010-10-20 06:09:29 +02:00
Daniel Marjamäki f8c02718a5 Activated checking of .java and .cs files 2010-10-19 21:54:15 +02:00
Robert Reif 267d1f273e Fixed #2082 (Tokenizer::simplifyTypedef: wrong handling of array) 2010-10-13 20:02:37 +02:00
Daniel Marjamäki 2334192bff Fixed #2087 (False positive: Array 'str[1]' index 1 out of bounds) 2010-10-12 21:52:02 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Daniel Marjamäki 81aed3fbd7 Tokenize: Fixed bug in Tokenize::simplifyKnownVariables 2010-10-10 19:27:42 +02:00
Daniel Marjamäki e0ba626351 ClassInfo: Removed unused functionality 2010-10-08 19:43:41 +02:00
Robert Reif 02027eb750 Fixed #2074 ('Internal error in Cppcheck' on complex function typedef (even 2 typedefs!)) 2010-10-06 05:43:07 +02:00
Daniel Marjamäki e4c3b390cc Fixed #2069 (cppcheck fails to scan OpenBSDs ftp source code) 2010-10-02 13:28:44 +02:00
Pete Johns 9a9302cba1 Prevent Tokenizer::simplifyCalculations() from removing parantheses from calls to Functors. 2010-10-02 21:19:05 +10:00
Daniel Marjamäki 6eeed00888 Fixed #2067 (Template methods do not 'use' private ones) 2010-09-30 21:22:49 +02:00
Daniel Marjamäki cdecbe29d0 Optimisation: Made Tokenizer::simplifyInitVar faster 2010-09-26 15:54:41 +02:00
Daniel Marjamäki ff7a99ad37 Revert "Optimisation: small speedups in the Tokenizer::simplifyTokenList handling"
This reverts commit 056037feed.
2010-09-24 22:18:51 +02:00
Daniel Marjamäki 056037feed Optimisation: small speedups in the Tokenizer::simplifyTokenList handling 2010-09-24 22:14:18 +02:00
Daniel Marjamäki 416f093fc3 Tokenizer: fixed variable declaration simplification 2010-09-15 19:53:47 +02:00
Daniel Marjamäki 38b35feaa8 Tokenizer: the 'failed to parse typedef' messages should not be shown unless --debug-warnings are given 2010-09-14 20:59:09 +02:00
Daniel Marjamäki 0afd19c59b Fixed #2039 (unions not handled properly, false positive about initialization) 2010-09-09 20:15:00 +02:00
Daniel Marjamäki 929a54e1b0 Fixed #2038 (memleak false positive with assignment expression in arguments) 2010-09-09 19:40:36 +02:00
Daniel Marjamäki 5af0d65aef Fixed #2025 (iso646 c++ operators are not handled correctly) 2010-09-09 17:43:09 +02:00
Robert Reif 2fc2859b68 Fixed #2035 (Enum 'qboolean' hides typedef with same name) 2010-09-08 06:45:57 +02:00
Daniel Marjamäki 3a4cda0f0d Fixed #2034 (false positive: unused private function (Borland C++ __property)) 2010-09-07 18:37:43 +02:00
Daniel Marjamäki cfe694330f Fixed #2024 (Internal Error on multiple append calls on same string object) 2010-09-06 21:34:51 +02:00
Daniel Marjamäki 0f8bc429ad Fixed #2021 (false positive: syntax error with -std=gnu++0x code) 2010-09-05 08:16:19 +02:00
Daniel Marjamäki 7d3ccb064b Fixed #2020 (false positive: (error) Uninitialized variable, used in asm statement) 2010-09-05 08:06:37 +02:00
Daniel Marjamäki 51bc784537 Tokenizer: Fixed problem in Tokenizer::simplifyRedundantParanthesis when simplifying 'void delete(double num);' 2010-09-05 07:53:43 +02:00
Daniel Marjamäki 75fb99cee7 Fixed #2015 (### Internal error in Cppcheck. Please report it.) 2010-09-04 11:49:56 +02:00
Daniel Marjamäki 1938b8a423 Fixed #1976 (False Positives with unions) 2010-09-03 08:10:29 +02:00
Daniel Marjamäki 427c0f4bfd Fixed #1975 (segmentation fault of cppcheck) 2010-09-02 23:01:12 +02:00
Daniel Marjamäki 01b05618e5 Tokenizer: Fixed Cppcheck warnings 2010-09-02 20:51:01 +02:00
Robert Reif fbffaade2e Fixed #2011 (Parser error in template function) 2010-09-02 19:09:06 +02:00
Daniel Marjamäki eb74bfc15a Fixed #2007 (False positive: member variable not initialized (Borland C++ property)) 2010-09-01 18:10:12 +02:00
Daniel Marjamäki 55e0e435bd Fixed #1959 (Do you support the oracle Pro*C ?) 2010-08-31 23:25:41 +03:00
Daniel Marjamäki 688b2aefe9 Tokenizer: Fixed warnings about unsigned / signed conversion 2010-08-31 21:04:17 +02:00
Daniel Marjamäki 513826d8c2 Tokenizer::setVarId : don't give operator function variable id 'operator new []('. Ticket: #1997 2010-08-31 20:15:24 +02:00
Daniel Marjamäki fbe11b9bb9 Fixed #1999 (False positive: uninitialized variable (__published variables)) 2010-08-31 19:48:04 +02:00
Robert Reif 16efc9be26 Fixed #1887 (internal error in GLee) 2010-08-31 17:48:19 +02:00
Daniel Marjamäki 7ec3c72a19 Fixed #1997 (operator new [] simplified wrong) 2010-08-30 21:06:22 +02:00
Robert Reif 0d530711f6 Fixed #1988 (segmentation fault of cppcheck with wrong syntax of -std=c++0x) 2010-08-30 07:25:17 +02:00
Daniel Marjamäki 71453871d4 Fixed #1989 (false positive: Variable 'Aux13' is assigned a value that is never used) 2010-08-28 13:32:43 +02:00
Daniel Marjamäki 83a8879f11 Tokenizer::simplifyInitVar : Refactorings and fixes related to ticket #1989 2010-08-27 22:58:21 +02:00
Daniel Marjamäki d45186d645 Added --debug-warnings that we can use to enable various debug warnings 2010-08-27 20:28:00 +02:00
Daniel Marjamäki 8eee4cf2e8 Fixed #1984 (false positive: syntax error in for loop (< -operator)) 2010-08-26 23:24:01 +02:00
Daniel Marjamäki 57523574ef Fixed #1985 (false positive: syntax error in try catch-block with for()-loop inside) 2010-08-26 23:19:18 +02:00
Robert Reif 499a12c896 Tokenizer::simplifyTypedef: Report about unhandled typedefs. Ticket: #1821 2010-08-26 20:44:13 +02:00
Daniel Marjamäki 8b18aaff25 Fixed #1981 (false positive: syntax error on template operator <) 2010-08-26 07:43:00 +02:00
Robert Reif 5c3ecc31da Code cleanup 2010-08-26 07:32:48 +02:00
Daniel Marjamäki ca9cdf5bf5 Tokenizer: If syntax errors are found then don't return a token list. Ticket: #1961 2010-08-25 22:10:21 +02:00
Daniel Marjamäki 6c8287913c Tokenizer: Detect some syntax errors when trying to use templates. Ticket: #1961 2010-08-25 21:57:57 +02:00
Robert Reif 4a6070d2af fix 2 problems related to ticket 1976:
1. nested unnamed anonymous structures and unions were not supported.
 2. declaration split up in class had bug if proceeded by access specifier.
2010-08-25 20:17:31 +02:00
Robert Reif ff4ebbede3 Fixed gcc compiler warning about uninitialized variable tok1. Ticket: #1965 2010-08-25 07:38:53 +02:00
Robert Reif d961a6ec9e Tokenizer: Fixed cppcheck and compiler warnings 2010-08-24 07:28:56 +02:00
Daniel Marjamäki 39a69b0871 Fixed #1970 (Internal error. CheckClass::SpaceInfo::getVarList found variable '_root' with varid 0.) 2010-08-23 21:22:11 +02:00
Daniel Marjamäki f7063bed7c Fixed #1967 (Tokenizer::setVarid doesn't set variable value (list of function pointers)) 2010-08-23 20:15:02 +02:00
Daniel Marjamäki 3b716dfcc9 Tokenizer: Simplified the bitfields handling. This patch just looks for the bitfield signature but doesn't care about the type. I don't think any other code would have this same signature so it should be OK. We could add code to only look in structures and classes but I don't think that is necessary. Ticket: #1956 2010-08-23 07:29:05 +02:00
Robert Reif 807269b5e9 Refactoring handling of microsoft types. Ticket: #1956 2010-08-22 21:53:45 +02:00
Robert Reif cb7b508f77 Tokenizer::simplifyBitfields: fixed more issues. Ticket #1956 2010-08-22 13:25:47 +02:00
Robert Reif 3fcca23b53 Tokenizer: better handling of bitfields. Ticket: #1956 2010-08-22 09:41:22 +02:00
Robert Reif 77d634127c Tokenizer: simplify DECLARE_DYNAMIC and DECLARE_DYNCREATE 2010-08-22 09:38:05 +02:00
Robert Reif ac9078857e Tokenizer: simplify bitfields. Ticket: #1956 2010-08-21 16:34:41 +02:00
Robert Reif 9c594684db Tokenizer: handle DECLARE_DYNAMIC. Ticket: #1956 2010-08-21 07:55:14 +02:00
Robert Reif 7173e01926 Fixed #1965 (tokenizer::simplifyEnum add support for C++0x enums) 2010-08-21 07:44:56 +02:00
Daniel Marjamäki 741ce40e3d Tokenizer::setVarId : fixed problem for class members 2010-08-20 19:28:10 +02:00
Robert Reif f123e951ec Fixed #1963 (typedef array incorrectly simplified) 2010-08-20 07:11:02 +02:00
Daniel Marjamäki cfa7b4906e Symbol database: bug fixes. Ticket: #1895 2010-08-18 22:42:04 +02:00
Daniel Marjamäki 0934035fcf Fixed #1955 (cppcheck hangs with 100% cpu load) 2010-08-18 22:22:14 +02:00
Daniel Marjamäki 1fd773b245 Fixed #1944 (segfault in Tokenizer::simplifyLogicalOperator) 2010-08-17 20:06:20 +02:00
Daniel Marjamäki aa00587fed #1943 (segmentation fault of cppcheck (= default)) 2010-08-17 19:50:21 +02:00
Daniel Marjamäki 64cdee62ef Fixed #1942 (false positive: uninitialized variable in __asm__ statement) 2010-08-16 19:38:47 +02:00
Daniel Marjamäki 85acb005a2 Fixed #1941 (Internal error::Space Info::getVarList found variable with varid 0) 2010-08-16 18:51:25 +02:00
Daniel Marjamäki fe482785aa Variable Id: Fixed various bugs related to templates and bitfields. Ticket: #1928 2010-08-15 11:54:28 +02:00
Daniel Marjamäki 4949869f5f removed unused variable 'dot' 2010-08-15 09:03:16 +02:00
Daniel Marjamäki 4ff9a1ac94 Fixed #1928 (missing varId for template class variable) 2010-08-14 20:50:49 +02:00
Daniel Marjamäki cb72f21994 Optimisation in Tokenizer::tokenize 2010-08-11 17:29:33 +02:00
Daniel Marjamäki 0ea9e98680 Optimisation: Made inner loop in Tokenizer::setVarId faster 2010-08-10 19:06:45 +02:00
Daniel Marjamäki a1f288d088 Tokenizer::setVarId : Fixed a problem when using static class members 2010-08-10 18:22:58 +02:00
Daniel Marjamäki 6a3befa720 Optimising: Tokenizer::setVarId when setting variable ids for struct/class members 2010-08-08 19:14:23 +02:00
Daniel Marjamäki 5a8181d425 Tokenizer: 'simplifyCalculations();' should have the same results as 'while (simplifyCalculations());' 2010-08-08 09:25:09 +02:00
Daniel Marjamäki 1555901077 Refactoring: Made Tokenizer::simplifyCalculations a little faster 2010-08-08 08:28:28 +02:00
Daniel Marjamäki 7911626aed gcc: fixed some more -Wsign-conversion warnings 2010-08-06 22:43:06 +02:00
Daniel Marjamäki 12217461a2 gcc: fixed some more -Wsign-conversion warnings 2010-08-06 22:37:48 +02:00
Daniel Marjamäki 146465a6ad gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 18:42:55 +02:00
Daniel Marjamäki 7fb44d1995 gcc: fixed some compiler warnings when using -Wsign-conversion 2010-08-06 18:32:31 +02:00
Daniel Marjamäki 6346e1aa90 Borland C++: Fixed compiler errors 2010-08-06 17:44:26 +02:00
Daniel Marjamäki 9edecd4a3f Added ErrorLogger::reportProgress and removed ErrorLogger::ReportProgress. This will make it easier for GUI and other clients to display progress information. 2010-08-03 16:36:21 +02:00
Daniel Marjamäki 2e2baa23a6 Fixed #1909 (### Internal error in Cppcheck. Please report it) 2010-07-28 21:03:15 +02:00
Daniel Marjamäki 2fd2ab1712 Fixed a vs compiler warning. Ticket: #1901 2010-07-27 17:48:22 +02:00
Daniel Marjamäki bb7484945a Fixed #1887 (internal error in GLee) 2010-07-25 18:20:30 +02:00
Daniel Marjamäki e358af9018 Refactoring: Report progress when checking takes a long time. Ticket: #1868 2010-07-25 18:19:37 +02:00
Daniel Marjamäki 0c65796984 Refactoring: Cleanup headers using checkheaders 2010-07-24 22:12:56 +02:00
Daniel Marjamäki b8146271a2 Report progress when checking a file takes a long time. Ticket: #1868 2010-07-24 18:58:52 +02:00
Daniel Marjamäki 9b49202da8 Refactoring Tokenizer::syntaxError 2010-07-24 10:39:01 +02:00
Daniel Marjamäki dd07d82c34 Refactoring MathLib: Report errors through the tokenizer. Ticket: #1839 2010-07-24 10:25:03 +02:00
Daniel Marjamäki 84e576de04 Refactoring: use MathLib add/sub instead of calculate 2010-07-24 10:13:45 +02:00
Daniel Marjamäki 8a0d989190 Refactoring: Don't throw exceptions in the tokenizer upon errors. Ticket: #1866 2010-07-23 14:02:29 +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
Daniel Marjamäki 3c376047ba pulled changes from kimmov (filelocation-refactor) 2010-07-19 18:06:49 +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 e7690836fd fixed the mistake I made when applying patch 2010-07-18 20:56:19 +02:00
Robert Reif 689de10abf uninitialized class members: better handling of nested classes 2010-07-18 20:43:51 +02:00
Daniel Marjamäki 020a8a965c use cppcheckError to report Tokenizer/Preprocessor error instead of std::cerr 2010-07-18 12:57:29 +02:00
Daniel Marjamäki a4b887f21a Fixed #1843 (Tokenizer::createTokens() calls std::exit(0)) 2010-07-18 12:44:55 +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
Kimmo Varis ad0394939a Refactor ErrorMessage constructor to take Severity::SeverityType.
This removes lots of unneeded casting as everybody now uses the
Severity::SeverityType.
2010-07-14 23:11:32 +03:00
Robert Reif c572e6af87 Fixed #1846 (False positive with -s: Variable hides typedef with same name) 2010-07-13 08:08:12 +02:00
Daniel Marjamäki 61150498c4 Variable Id: fixed issue with function call. Ticket: #1848 2010-07-12 20:18:03 +02:00
Kimmo Varis c9215e9e44 Change the "information" error to "debug" error.
There was one debugging error sent with "information" severity. That
confused the GUI that didn't know such severity. Change the severity
to "debug" so the meaning of the error is more clear.
2010-07-12 00:56:52 +03:00
Robert Reif b0f1d5669b Fixed #1829 (### Internal error in Cppcheck. Please report it.) 2010-07-07 07:40:11 +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 b173d5f117 Fixed #1817 (False positive: Resource leak (casting)) 2010-07-05 13:16:33 +02:00
Robert Reif 28c265b20c Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-02 15:22:29 +02:00
Robert Reif b33fb48618 Fixed #1816 (Tokenizer: remove restrict keyword) 2010-06-30 08:10:39 +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
Robert Reif 38f90dae09 Fixed #1813 (false negative: Member variable not assigned a value in operator=) 2010-06-25 07:52:12 +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
Daniel Marjamäki 26e167fd5b Refactoring: Removed redundant checks 2010-06-20 20:51:36 +02: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
Robert Reif ec61c6fa26 Fixed #1801 (simplifyTypedef: duplicate typedefs not handled properly) 2010-06-18 07:16:05 +02:00