Commit Graph

377 Commits

Author SHA1 Message Date
Daniel Marjamäki 0203a4a6f5 Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see 2014-01-17 17:36:45 +01:00
Daniel Marjamäki 4eb746d7cc Tokenizer: Removed simplifyComparisonOrder 2014-01-17 17:25:56 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki 47b98470eb Tokenizer: Simplify float casts of integer constants 2013-11-19 18:07:12 +01:00
Daniel Marjamäki 5f0cfa0ee4 Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0]) 2013-11-02 23:56:10 +01:00
Daniel Marjamäki f0a621a952 Tokenizer: Added MAXTIME so cppcheck can be compiled with a hard max time. Will be used for the daca2. 2013-11-02 17:31:14 +01:00
Martin Ettl f8bd33f2bc Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made. 2013-10-03 20:52:07 +02:00
Martin Ettl 548e2f3fbf Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities. 2013-10-03 15:41:12 +02:00
Martin Ettl fa5ee8fd13 Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions. 2013-10-01 20:30:59 +02:00
Ettl Martin 9ab6655d85 Fixed #5007 (Same include guard naming) 2013-09-04 20:59:49 +02:00
Lucas Manuel Rodriguez 09f4d3732a Fixed #4911 (segfault, assignment in do ... while, 1.61dev) 2013-07-28 11:58:14 +02:00
Daniel Marjamäki b2f6e9e3eb library: improved handling of noreturn. The Tokenizer::isScopeNoReturn will now try to use the library to determine if scope is noreturn. 2013-07-14 10:10:11 +02:00
Daniel Marjamäki ca632bd771 Fixed Cppcheck warning. Made method const 2013-06-01 14:35:21 +02:00
Frank Zingsheim 511f8a4c1f More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized) 2013-05-12 10:19:43 +02:00
Zachary Blair de8ee5b042 Fixed #4554 (false negative: buffer access out of bounds) 2013-05-02 21:50:48 -07:00
Daniel Marjamäki 1b18bfc93c Fixed #3585 (errors not recognized when class has extra specification) 2013-03-18 19:09:04 +01:00
PKEuS d49f4a611a Reduced code duplication in tokenizer 2013-03-02 09:19:53 -08:00
Alexander Mai 4ae65ea454 Fixed doxygen warnings 2013-02-27 21:05:18 +01:00
Frank Zingsheim 5144307642 Raise syntax error for if-condition without parentheses according to #2518 #4171 2013-02-05 21:13:57 +01:00
Frank Zingsheim 89560564ed Refactoring: Add braces to an if-block, for-block, etc. in tokenizer.
Fixed #4521 (Tokenizer: Wrong braces for triple if else)
2013-02-02 16:01:34 +01:00
Daniel Marjamäki 4391f0880f Tokenizer: Add special tokenize method for the Preprocessor with only basic simplifications 2013-01-27 17:58:54 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Erik Lax 723d95597b Fixed #4481 (Simplify %str% [ %num% ]) 2013-01-13 20:52:38 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Edoardo Prezioso f3782935c2 Tokenizer: improve code and change name of +- concatenation function. 2012-12-01 00:43:23 +01:00
Edoardo Prezioso 3d1d983251 Tokenizer: simplify also __FILE__ together with __LINE__. 2012-12-01 00:37:10 +01:00
Daniel Marjamäki 509721d6d0 Fixed #4304 (False positive during an array declaration) 2012-11-29 08:44:12 +01:00
Edoardo Prezioso c9e0089546 Change Tokenizer member function name.
From 'simplifyQuestionMark' to 'simplifyConstTernaryOp' (the older name was not clear). Adjusted the doxy comment.
2012-11-02 14:57:12 +01:00
Edoardo Prezioso e62e03ab31 Fixed #4267 (segmentation fault of cppcheck (invalid code)). 2012-10-09 20:44:30 +02:00
Daniel Marjamäki 2f069f550f Removed Java/C# handling 2012-10-02 18:44:36 +02:00
Daniel Marjamäki ff4f8b58f3 Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617 2012-09-28 18:51:10 +02:00
Mohit Mate 9e297c95f2 Fixed #2617 (improve check: comparing boolean with '<') 2012-09-26 18:18:36 +02:00
Daniel Marjamäki 2e3a7db4eb Fixed #4115 (Incorrect uninitialized variable error message with realloc macro) 2012-09-22 18:41:33 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
Daniel Marjamäki 853c6522dc Tokenizer::simplifyEnum: Readded refactorings. Tickets 3949,3950,4025,4053 has been solved as far as I see. 2012-09-08 12:42:24 +02:00
PKEuS 489df29346 Moved Tokenizer::typeConstToConstType() to Tokenizer::simplifyConst() 2012-09-07 11:41:41 +02:00
anuraggarg011 bf11248a09 Fixed #1620 (tokenizer: simplify well known math functions) 2012-09-03 18:51:15 +02:00
Edoardo Prezioso 0d26a79f2c Tokenizer::simplifyEmptyNamespaces: new function.
It removes from the token list, if found, the following tokens: 'namespace %var% { }'. It won't involve C code.
2012-08-28 22:40:25 +02:00
PKEuS 4bab7f0ee2 Removed unused and obsolete functions Tokenizer::getParameterName() and Tokenizer::getNameForFunctionParams() 2012-08-26 16:53:40 +02:00
Daniel Marjamäki 985ac662ee Fixed #4035 (False positive: Memory leak: pTempFile) 2012-08-25 12:00:25 +02:00
Daniel Marjamäki 5051837c1a Reverted last commit. I pushed it by mistake. 2012-08-25 11:00:51 +02:00
Daniel Marjamäki 5e1ccfaf90 Fixed #4035 (False positive: Memory leak: pTempFile) 2012-08-25 10:55:20 +02:00
PKEuS f238f3fad5 Support sizeof in preprocessor directives
Applied "patch" provided by michaeln123 in #4071
2012-08-22 17:28:06 +02:00
PKEuS 35d94c26d5 Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness

The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS 2ab33ef21b Added Pointer to enclosing scope to class Token (Only available when symboldatabase is created). 2012-08-11 11:47:11 -07:00
Daniel Marjamäki 0254344df5 Tokenizer::simplifyEnum: Reverted refactorings/optimisations as there were regressions (#3949, #3950, #4025) 2012-08-10 14:06:24 +02:00
PKEuS c8e40773f1 Fixed cppcheck messagesa about functions that can be const/static:
- Made Tokenizer::getErrorMessages static - Avoids creation of unnecessary instance of Tokenizer
- Changed Tokenizer::removeExceptionSpecifications to common style for simplification functions. In contrast to the comment, this function doesn't call itself recursivly - fixed comment.
- Made Tokenizer::IsScopeNoReturn static.
2012-08-01 12:04:47 -07:00
PKEuS e9182f1fcc Implemented support for 'using namespace std;': Add std:: prefix to names that are known to be in std namespace. Simplify namespace (std::)tr1:: if C++11 flag is set. 2012-07-15 02:05:19 -07:00
Daniel Marjamäki 42e68550fc fixed doxygen errors 2012-07-08 19:32:33 +02:00
Daniel Marjamäki 6ad5fc8456 Refactoring Tokenizer::simplifyEnum. The enum handling is now somewhat faster since all enum values of a enum are simplified at the same time. 2012-07-06 15:43:50 +02:00
Daniel Marjamäki bb9f114d84 Fixed #3924 (False positive: Uninitialized variable (const pointer)) 2012-06-30 12:12:36 +02:00
Daniel Marjamäki 8af044255d Tokenizer: Added new function isFunctionParameterPassedByValue that check if a parameter is passed by value 2012-06-24 13:40:09 +02:00
PKEuS 4b80e91145 Implemented support for building cppcheck lib into a dll
Updated VS9 solution
New VS10 solution that builds cppcheck into a dll used by cli and testrunner.
Functional changes and advantages of new solution:
- Share code between testrunner and cli; ability to share code with gui as well (not yet implemented)
- Files of /lib are no longer compiled twice (should improve build time on single core machines)
- Added configuration for building with PCRE support
- Executables are build into /bin (/bin/debug in debug mode) folder (Should no longer require rebuild when switching between debug and release)
- Completely x64 compatible (contains also x64-debug configuration now)
2012-06-10 05:19:09 -07:00
PKEuS a9cfe2814a Made some functions const according to cppcheck results 2012-05-17 02:54:17 -07:00
PKEuS 4bb2a1b27b Made some functions static or const according to cppcheck results 2012-05-17 01:33:24 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
PKEuS 8cbed66089 Changed relationship between templatesimplifier and tokenizer:
- Pass a tokenizer to templatesimplifier to reduce code duplication (Make use of Tokenizer::reportError; remove redundant TemplateSimplifier::addtoken2) and amount of arguments passed to functions

Removed ctor and dtor implementation from TemplateSimplifier: This class shouldn't be instanciated.
2012-04-23 20:45:36 +02:00
Daniel Marjamäki d5f6cfcfa8 Tokenizer: Use new setVarId function. Removed the old one. 2012-04-22 11:36:31 +02:00
PKEuS 3d2b5a30fe Implemented generic reportError functions in tokenizer (similar to Check::reportError) to reduce code duplication 2012-04-22 11:28:46 +02:00
PKEuS 1c3c94dc67 New simplification: Remove 'extern "C"' from C++ code.
Refactorization in cppcheck.cpp: Catch exception as const reference instead of non-const reference.
2012-04-16 16:25:04 +02:00
Daniel Marjamäki 7669abb170 Tokenizer::setVarId : Starting to rewrite Tokenizer::setVarId. The purpose of the rewrite is to make this function faster. 2012-04-15 11:47:22 +02:00
Daniel Marjamäki c7093ca5d6 Tokenizer: allow that time is measured for certain slow simplifications 2012-04-10 13:45:34 +02:00
Daniel Marjamäki d6c8de104c Revert "Fixed #3648 (Internal error: Token::Match called with varid 0)"
This reverts commit 1fa1ddccba.
2012-03-20 19:00:16 +01:00
Daniel Marjamäki 1fa1ddccba Fixed #3648 (Internal error: Token::Match called with varid 0) 2012-03-20 18:58:27 +01:00
PKEuS cb2a754983 Implemented support for C++11 right angle brackets (>>)
Implemented support for linkage between < and > (Information: It is possible that under certain circumstances comparision operators are linked, since its sometimes difficult to separate between them.)
2012-03-19 18:45:47 +01:00
PKEuS 3af32b0da2 Refactorizations in tokenizer:
- getSourceFilePath returns a const reference now
- Replaced some simple patterns by string comparisions/direct function calls
- Replaced a few indendation counters by easier code
- Replaced one offset variable by token pointer to avoid subsequent calls to tokAt with the same number
2012-03-17 11:48:40 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
PKEuS 9431fb1b7e Improved STL checks:
- Added performance checking for .c_str() for return values and function parameters (#1079)
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS 9a5f66030c Improved unused private function check:
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS b1ff900aaa Some refactorizations 2012-02-18 23:43:51 +01:00
Daniel Marjamäki 9df6088ddd Revert "really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)"
This reverts commit a37031944e.

I don't want this hard coding of macro names. Feel free to come with a more generic solution if you want.
2012-01-30 06:15:41 +01:00
Robert Reif a37031944e really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers) 2012-01-28 20:58:51 -05:00
Edoardo Prezioso ca8e8d26c7 Tokenizer: extract realloc simplification and simplify also when each argument is done by more than one token.
Restyling of a comment in tokenize.h.
2012-01-27 13:56:06 +01:00
Edoardo Prezioso 6e164ae7ed Fixed ticket #3557 (Tokenizer: simplification of '[]' doesn't work well):
extract undefined size array simplification and handle multiple arrays and combos between pointers and arrays, don't handle the definitions as arguments of function.
2012-01-26 17:25:52 +01:00
Edoardo Prezioso b6a0896ce6 Change 'simplifyReturn' to 'simplifyReturnStrncat' because it's not clear what this function does. 2012-01-26 11:49:08 +01:00
Edoardo Prezioso 5953ed7318 Fixed ticket #3528 (Tokenizer: improve simplifyFunctionParameters to take count of square brackets) 2012-01-23 16:10:15 +01:00
Edoardo Prezioso b0dac2fa2e Tokenizer::copyTokens: add optional parameter which preserve the line number differences between tokens to be copied. 2012-01-21 17:18:16 +01:00
Reijo Tomperi be7691c7b4 Refactoring: Move rest of the template simplification into TemplateSimplifier
simplifyCalculations() was temporarily moved into TemplateSimplifier also, it should be moved to a better place.
2012-01-09 21:33:11 +02:00
Reijo Tomperi e91d239ea5 Refactor: Move file extension checks from Tokenizer to Path class. This has also functional change as now also file.JAVA is considered a Java file. 2012-01-06 21:56:28 +02:00
Daniel Marjamäki de4a64332e Refactoring: Copy FileLister::acceptFile to Path::acceptFile. Use Path::getFilenameExtension and Path::acceptFile in Tokenizer. Use Path::acceptFile in CppCheck::processFile instead of hardcoded handling. 2012-01-06 17:31:10 +01:00
Reijo Tomperi eda04ad906 Refactoring: Move template code into templatesimplifier: simplifyTemplatesExpandTemplate() 2012-01-05 22:45:19 +02:00
Edoardo Prezioso 75fbe310ff Extract various functions inside the Tokenizer class and fix tokenization of 'return __LINE__ ;'. 2012-01-04 12:57:58 +01:00
Reijo Tomperi 0369681a2c Refactoring: Move template code into templatesimplifier: simplifyTemplatesGetTemplateNamePosition() 2012-01-03 23:49:50 +02:00
Reijo Tomperi ac290b1a8a Refactoring: Move template code into templatesimplifier: simplifyTemplatesUseDefaultArgumentValues(), simplifyTemplatesInstantiateMatch() 2012-01-03 23:35:06 +02:00
Reijo Tomperi 16fb1801e1 Refactoring: Move template code into templatesimplifier: simplifyTemplatesGetTemplateDeclarations(), simplifyTemplatesGetTemplateInstantiations() 2012-01-02 23:05:27 +02:00
Reijo Tomperi 37269d0c28 Refactoring: Move template code into templatesimplifier: simplifyTemplatesExpandSpecialized() 2012-01-02 22:53:13 +02:00
Reijo Tomperi aa927d5aa3 Refactoring: Add new file lib/templatesimplifier.cpp
The plan is to move template simplification into this new class to take some lines from 10 000 line tokenizer.
2012-01-01 22:55:05 +02:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Reijo Tomperi 90e1a397a2 Refactoring: Remove duplicate function from tokenizer: code_is_c() -> isC() 2011-12-29 00:36:16 +02:00
Edoardo Prezioso ec0badb651 By pressing request, extract method: simplifyJavaAndCSharp. 2011-12-28 22:44:53 +01:00
Jonathan Neuschäfer 7a5627029f tokenizer: proper checks for Java and C# 2011-12-27 18:01:39 +01:00
Jonathan Neuschäfer 103588c5bc Refactoring: tokenizer: factor out fileExtension 2011-12-27 18:01:39 +01:00
Daniel Marjamäki 91874214d8 Refactoring: Added utility function that determine if scope ends with a call to a noreturn function 2011-12-27 18:00:12 +01:00
Daniel Marjamäki 385afffb14 Null pointers: show inconclusive errors if functions are called. Assume they won't assign the pointer. Ticket: #3443 2011-12-26 07:13:10 +01:00
Reijo Tomperi e112bfdd47 Refactoring: Rename some variables and funtions in tokenizer.
Small logic change also for count variable to make new name more logical.
2011-12-26 00:06:27 +02:00
Reijo Tomperi 347982a347 Refactoring: Extract several methods from tokenize() 2011-12-24 23:23:08 +02:00
Reijo Tomperi 8e6ebd4a22 Refactoring: Extract method: simplifyDoublePlusAndDoubleMinus() 2011-12-24 22:51:55 +02:00
Reijo Tomperi 00cbf02d84 Refactoring: Rename variable used -> templateInstantiations 2011-12-24 00:03:03 +02:00
Reijo Tomperi 70c4bb54b4 Refactoring: Split long function in tokenizer.
simplifyTemplatesInstantiate()
2011-12-22 23:13:45 +02:00
Reijo Tomperi 1c12d04d0d Refactoring: Make a 300 line function a little smaller.
simplifyTemplatesInstantiate()
2011-12-22 22:39:15 +02:00
Edoardo Prezioso 52620e6493 Tokenizer::simplifyDoWhileAddBraces:
1)rewrite fix for ticket #988 (just don't simplify inside macro parenthesis);
2)use a different organization of the code: start from last token and proceed backwards. This way 'simplifyDoWhileAddBracesHelper' can be called just once, hence the 'Helper' code can be improved and moved in the main function.
2011-12-12 00:20:46 +01:00
Edoardo Prezioso bf815ac1e4 Improve labels simplification code, remove redundant checking. 2011-12-10 14:13:48 +01:00
Edoardo Prezioso 7d12951da0 1)Fixed ticket #3184 (Improve Tokenizer: improve simplifyMulAnd to simplify weirder code);
2)Fix a test case inside TestSimplifyTokens::flowControl.
2011-12-09 20:47:51 +01:00
PKEuS 1bef8d1247 Tokenizer: Code cleanups 2011-12-08 17:42:26 +01:00
Edoardo Prezioso 00bae586e9 Add 'throw' to the flow control statements list for simplification of dead code. 2011-12-03 02:04:29 +01:00
Edoardo Prezioso 6889a28d31 1) Run runastyle;
2) Clarify some comments in 'Tokenizer::simplifyFlowControl' and in 'Tokenizer::eraseDeadCode';
3) Add some 'const' variables inside 'Tokenizer::eraseDeadCode'.
2011-11-20 19:06:55 +01:00
Edoardo Prezioso d0d5a2fcd8 Completed ticket #3230 (Refactoring: add function to remove tokens when a label is found.) and fixed ticket #3264 (False positive: Variable is assigned a value that is never used). 2011-11-20 18:37:00 +01:00
Daniel Marjamaki b96ab6ba26 Fixed #3188 (Function parser false positive) 2011-11-05 12:23:05 +01:00
PKEuS 845e5d259a Improved isJavaOrCSharp, isC and isCPP. Fixed isC for files with includes. 2011-10-27 19:18:54 +02:00
seb777 aa74761e8d fix isC method (.C files are C code files) 2011-10-26 22:54:00 +02:00
Thomas Jarosch 84a763d3b0 Run astyle 2011-10-26 21:15:44 +02:00
seb777 de71c41379 Fixed Ticket 2144 (false negatives: Old Style Pointer Cast apply only on .cpp files) 2011-10-26 21:17:27 +02:00
Edoardo Prezioso df5d26901c Add new warning option to check for dead code and change the order of some struct members to reduce structure padding. 2011-10-24 03:02:00 +02:00
Benjamin Goose 7d6b76e1d1 Include <iosfwd> for std::istream. 2011-10-20 08:46:29 +02:00
Edoardo Prezioso c3caade3ca - Fixed mispelled function name;
changed variable name inside simplifyFlowControl for consistency;
improved simplifyFlowControl to handle better this kind of code:
"return; { { } { label : ; ok ( ) ; } }"->"return ; { { label: ok ( ) ; } }".
2011-10-17 02:16:49 +02:00
Thomas Jarosch a52b73f9f9 Fix #3208 (Simplify pointer to standard type, C only)
The symbol database is unavailable during token simplification
and &data[0] might return something completely different for C++.

Moved code_is_c() from checkOther to Tokenizer.
2011-10-16 08:09:57 +02:00
Edoardo Prezioso 8afc1b6f2d Changed the name of the removal of dead code after flow control statements for consistency (simplifyDeadCode is too generalized as name) 2011-10-15 12:45:48 +02:00
Edoardo Prezioso f95b692a69 Fixed ticket #3113 (complete simplification of dead code after control flow statements) 2011-10-15 01:34:07 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Robert Reif 7dd001c9a9 run astyle 2011-10-06 21:10:20 -04:00
Edoardo Prezioso fe4ce594ce Renamed the function 'removeRedundantCodeAfterReturn' with 'simplifyDeadCode'.
This is a preparation in order to add new features to this function (see the @todo in the tokenize header file, ticket #3113 and #3175 for details).
2011-10-06 22:40:39 +02:00
Robert Reif 9994218aa2 refactor last commit to move unknown type output to seperate function 2011-09-28 07:36:48 -04:00
Robert Reif f97424b242 start adding Windows ASCII TCHAR conversion support 2011-09-24 14:51:03 -04:00
Robert Reif 97d4277854 add Microsoft memory function conversions to standard cstring functions 2011-09-22 19:59:56 -04:00
Robert Reif 66eb37c135 convert size_t to standard type 2011-09-18 10:31:31 -04:00
Edoardo Prezioso 1ff7410f4f Fixed #3075 (False positive => Improve tokenizer: remove redundant code after a 'return' state) 2011-09-13 07:55:47 +02:00
Daniel Marjamäki 46b5d5bd00 Fixed #3069 (False positive: Memory leak: data) 2011-09-03 20:45:48 +02:00
Robert Reif 389ab80b63 fix #2999 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-14 18:06:05 -04:00
Robert Reif 1286898fa0 fix #2864 (--errorlist missing errors: variableHidingTypedef and Extra qualification) 2011-06-28 21:46:54 -04:00
Reijo Tomperi 918b4d859f Fixed #2860, False positive: Returning value of strncat() reported as memory leak
http://sourceforge.net/apps/trac/cppcheck/ticket/2860
2011-06-26 23:53:16 +03:00
Robert Reif 5e3263235b fix #2739 (segmentation fault of cppcheck ( if()x )) 2011-06-11 15:51:12 -04:00
WenChung Chiu 1ea52cfa02 Fixed #2784 (Pointer issue: *&f=open()) 2011-05-18 07:25:30 +02:00
Daniel Marjamäki 739b6a93e2 Fixed #2713 (False positive (Redundant assignment)) 2011-04-16 12:07:56 +02:00
Stefan Weil 675e63b6a7 Spell checks 2011-03-30 16:45:31 +02:00
Robert Reif 3529014924 expose number of variables found by Tokenizer 2011-02-26 08:42:19 -05:00
Daniel Marjamäki 63c003f92e Tokenizer: fixed so that 'p=&x; if(p)' is simplified to 'p=&x;if(&x)'. Ticket: #2596 2011-02-20 18:18:27 +01:00
Daniel Marjamäki de75bdfed5 Tokenizer: comments/refactorings 2011-02-12 21:11:20 +01:00
Daniel Marjamäki 4d1aae5859 Tokenizer::simplifyTemplates: Broke out the functionality that instantiates a template 2011-02-12 20:58:45 +01:00
Daniel Marjamäki 9021f0f180 Tokenizer::simplifyTemplates: Broke out the functionality that handles default template arguments 2011-02-12 20:27:44 +01:00
Daniel Marjamäki 00bdf618f2 Tokenizer::simplifyTemplates: Broke out the functionality that extract a list of template instantiations 2011-02-12 20:17:58 +01:00
Daniel Marjamäki 25d6bfe3c4 Tokenizer::simplifyTemplates: broke out the functionality that extract a list of template declarations 2011-02-12 20:12:07 +01:00
Daniel Marjamäki 654116af61 Tokenizer::simplifyTemplates: Broke out handling for 'template<>..' 2011-02-12 19:43:33 +01:00
Daniel Marjamäki 63ade3e4f6 Tokenizer::simplifyKnownVariables: Split up the function into smaller functions. Broke out ..GetData function that extracts info about assigned variable before the simplification is made. 2011-02-12 09:24:20 +01:00
Robert Reif 78b5361ec8 fix #2568 (False positive: (style) Union 'A_t' hides typedef with same name (forward declaration)) 2011-02-11 19:09:24 -05:00
Daniel Marjamäki 951a81d0d2 Tokenizer::simplifyKnownVariables: Broke out the simplification into a separate function 2011-02-11 20:12:51 +01:00
Robert Reif e6848aef98 Tokenizer: refactor duplicated token copy code info function 2011-02-09 22:02:17 -05:00
Robert Reif 8eb92001b3 Fixed #2530 (Tokenizer: Remove redundant 'MyClass::' inside MyClass class declaration) 2011-02-02 07:40:08 +01:00
Daniel Marjamäki 49fc53165c Tokenizer: remove some unhandled macros in the global scope. ticket: #2523 2011-01-30 08:34:58 +01:00
Daniel Marjamäki 524498e439 Tokenizer: collapse operator function names into a single token. ticket: #2519 2011-01-27 18:44:20 +01:00
Robert Reif d341b42b0c Symbol database: increased constness. ticket: #2468 2011-01-16 18:13:54 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Robert Reif 63208e87d3 typedef: delete unhandled typedefs. ticket: #2348 2011-01-04 07:43:40 +01:00
Daniel Marjamäki e385323b65 Tokenizer: Added doxygen comments 2011-01-01 11:26:48 +01:00
Daniel Marjamäki 71acf78c64 Tokenizer: added doxygen comments 2011-01-01 09:26:24 +01:00
Daniel Marjamäki d005245188 fixed doxygen warnings 2010-12-30 22:13:31 +01:00
Daniel Marjamäki 38e7209d26 Fixed #2373 (Using XML2 in --errorlist output) 2010-12-29 12:43:29 +01:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Robert Reif b6acfa809b Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it 2010-12-07 07:08:49 +01:00
Daniel Marjamäki ab336b9088 Tokenizer: Added a few comments 2010-12-04 15:49:25 +01:00
Robert Reif eda4bcae29 Fixed #2271 (Tokenizer: simplify Qt signals and slots) 2010-12-02 17:41:49 +01:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Robert Reif 1842a122da reuse symbol database in checkmemoryleak.cpp. ticket: #2219 2010-11-23 18:41:07 +01:00
Daniel Marjamäki 23d3fd3a5a Fixed #2147 (uninitialized variable: false negative for 'x += y;') 2010-10-31 08:47:13 +01: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 e0ba626351 ClassInfo: Removed unused functionality 2010-10-08 19:43:41 +02: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 929a54e1b0 Fixed #2038 (memleak false positive with assignment expression in arguments) 2010-09-09 19:40:36 +02:00
Daniel Marjamäki 427c0f4bfd Fixed #1975 (segmentation fault of cppcheck) 2010-09-02 23:01:12 +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
Robert Reif 499a12c896 Tokenizer::simplifyTypedef: Report about unhandled typedefs. Ticket: #1821 2010-08-26 20:44:13 +02:00
Daniel Marjamäki cfa7b4906e Symbol database: bug fixes. Ticket: #1895 2010-08-18 22:42:04 +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 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 a274cb1015 cleanup headers 2010-07-31 08:52:28 +02:00
Daniel Marjamäki 0c65796984 Refactoring: Cleanup headers using checkheaders 2010-07-24 22:12:56 +02:00
Daniel Marjamäki f69109fbf6 Fixed #1828 (### Internal error in Cppcheck. Please report it.) 2010-07-22 19:57:48 +02:00
Robert Reif b33fb48618 Fixed #1816 (Tokenizer: remove restrict keyword) 2010-06-30 08:10:39 +02:00
Daniel Marjamäki 83c62eca9c Tokenizer: simplify loops that continue while errno is EINTR 2010-05-30 12:49:39 +02:00
Robert Reif dc34a1b3ff Fixed #1711 (Wrong typedef name shown when struct declared with __attribute__) 2010-05-27 18:15:42 +02:00
Daniel Marjamäki 78255fdfc5 Tokenizer: Removed the Tokenizer::simplifyNamespaces. Ticket: #1700 2010-05-23 13:51:41 +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
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
Robert Reif 99a7755218 tokenizer improvements: remove calling convention (#1619) 2010-04-24 09:40:05 +02:00
Robert Reif 90541386da Fixed #1619 (tokenizer: remove calling convention) 2010-04-21 21:08:47 +02:00
Robert Reif 3bbb2e1d7f Fixed #1601 (change simplifyInitVar to split declaration from initialization) 2010-04-14 19:04:16 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Robert Reif 67fafd4028 Fixed #1588 (typedef struct incorrectly simplified) 2010-04-12 19:05:31 +02:00
Daniel Marjamäki 8a8547e6b7 astyle formatting 2010-04-03 14:28:32 +02:00
Daniel Marjamäki a4144b9d18 Refactoring: Moved copy/paste code in Tokenizer 2010-04-03 09:54:10 +02:00
Daniel Marjamäki ff38bbf468 Cleanup: The Tokenizer doesn't need to handle UTF in code nor multiline string. That is handled in the Preprocessor. 2010-04-02 20:48:32 +02:00
Robert Reif ef57d01f7a Fixed #1492 (false negatives: array index out of bounds) 2010-03-31 17:14:49 +02:00
Robert Reif 62d2845014 Fixed #1492 (false negatives: array index out of bounds) 2010-03-28 15:56:13 +02: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 e911d1f1df doxygen updates 2010-03-17 22:16:18 +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 12c45a1aba Fixed #1476 (false positive: Uninitialized variable) 2010-03-16 19:53:09 +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
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