Commit Graph

1138 Commits

Author SHA1 Message Date
PKEuS 452f95cea0 More robust template detection in clarifyCondition check based on Token::link. (#3818)
Create links between < and > only on non-C code.
AStyle fix
2012-08-02 04:03:01 -07: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
Ettl Martin 98d608231d spelling fixes 2012-07-31 23:35:56 +02:00
PKEuS 1ec3c9f634 Fixed hang in libreoffice code (simplification of K&R style function declaration tried to simplify a function with parameters without name whose implementation contained "; {".
Test cases of this simplification only need basic simplifications done in Tokenizer::tokenize
2012-07-29 06:11:48 -07:00
Daniel Marjamäki 1a6f7ea9a0 Fixed #3998 (Tokenizer::simplifyEnum: wrong handling of expressions => crash) 2012-07-26 11:12:28 +02:00
Ville Skyttä 7ab2f6a9fa Spelling fixes. 2012-07-21 18:11:20 +02:00
Daniel Marjamäki a96ec0ad46 Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers)) 2012-07-16 07:28:59 +02: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
Edoardo Prezioso fae40c4782 Change every C version of 'size_t' to C++ 'std::size_t'. 2012-07-09 13:30:18 +02:00
Daniel Marjamäki bf98e952c1 Fixed #3927 (false positive: (error) Uninitialized variable: new) 2012-07-08 13:59:00 +02:00
Daniel Marjamäki 49198f52c4 Fixed #3934 (False positive for logical conjunction with enum and define) 2012-07-07 15:34:26 +02:00
Daniel Marjamäki 543ccdd4c0 Removed simplifyEnum timer that I didn't intend to include in the previous commit. 2012-07-06 15:48:51 +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
Thomas Sondergaard f72ddbb2e9 Fixed #3912 (Analysis failed) 2012-07-03 06:34:14 +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
Daniel Marjamäki edea4ef131 Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName 2012-06-21 19:00:53 +02:00
Daniel Marjamäki 974225626d Fixed #3901 (false positive: (error) Uninitialized variable: temp) 2012-06-19 20:07:39 +02:00
Daniel Marjamäki 4b6e1c6946 Fixed #3855 (false positive: (error) Instance of 'locale' object destroyed immediately) 2012-06-13 19:21:20 +02:00
August Sodora 90f92250dd Fixed #3618 (segmentation fault of cppcheck) 2012-06-12 21:07:17 +02:00
Daniel Marjamäki 54a66391d8 Fixed #3750 (false positive: C-style pointer casting) 2012-06-12 18:45:31 +02:00
seb777 5b763a9f0a Fixed #3579 (object destroyed immediately:False positive & negative) 2012-06-10 21:52:32 +02:00
August Sodora e146591b5d Fixed #3544 (segmentation fault of cppcheck) 2012-06-02 16:15:12 +02:00
PKEuS 9dc8123151 Refactorizations:
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
Daniel Marjamäki 5b0551054a varid: better templates handling 2012-05-22 18:58:13 +02: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
Daniel Marjamäki 505aa6e4cc TestSimplifyTokens::enum29: Fixed crash 2012-05-16 21:39:26 +02:00
Daniel Marjamäki 0bb0fdedc2 Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums) 2012-05-16 18:48:33 +02:00
PKEuS 0157f937bf Fixed #3760: Added explicit to C++ keyword list in setVarId
Made some constant arrays static
2012-05-16 01:59:52 -07:00
Daniel Marjamäki 4ae8e4f382 Tokenizer::setVarId: Minor fix of sizeof handling 2012-05-15 18:40:24 +02:00
Daniel Marjamäki a0e5fad6a9 Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration) 2012-05-15 07:17:31 +02:00
Daniel Marjamäki 62f9875f90 Fixed #3799 (Bug: Function gets varId) 2012-05-13 07:55:35 +02:00
Daniel Marjamäki 8236cd4d50 Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used) 2012-05-08 12:04:54 -07:00
Daniel Marjamäki 99a29eafc9 Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch) 2012-05-07 12:11:23 -07:00
PKEuS 28f6e2f4a9 Resolved cyclic dependency between Tokenizer and TemplateSimplifier 2012-05-06 01:38:55 -07:00
PKEuS f105bf75a6 Refactorizations in ErrorLogger:
- Implemented constructor for ErrorLogger::ErrorMessage that takes a callstack of tokens -> replaced duplicate code in Check and Tokenizer
- Implemented strigify() for ErrorLogger::ErrorMessage::FileLocation to replace two identical implementations of it.
2012-05-06 01:17:15 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
Daniel Marjamäki 11614021e8 Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string') 2012-05-05 09:59:43 +02:00
Daniel Marjamäki 119b24e363 Fixed #3756 (False positive: uninitvar in malloc) 2012-05-03 19:10:51 +02:00
Edoardo Prezioso 5d6a257c86 Fixed #3770 (Segmentation fault in K&R function parameters simplification) 2012-04-29 12:58:52 +02:00
Daniel Marjamäki df6f88b4fe Fixed #3755 (Tokenizer::setVarId: improve varid inside class for struct/class variables) 2012-04-26 18:38:47 +02:00
PKEuS 1e708e10d0 Fixed #2875 2012-04-26 10:35:40 +02:00
Daniel Marjamäki f84a4344ae Fixed #3754 (Tokenizer::simplifyKnownVariables: wrong for loop simplification) 2012-04-25 19:23:17 +02:00
Edoardo Prezioso 08ae15e42d Fixed the grammar in some reportError messages in the Tokenizer class, thanks to kimmov's suggestion. 2012-04-25 15:09:46 +02:00
PKEuS dd5e9aa454 Make use of recently implemented Token::type() functionality 2012-04-25 09:56:07 +02:00
PKEuS e0a3ca0845 Refactorizations in class Token: changed handling of different types of tokens.
- Replace _isNumber, _isName, _isBoolean attributes by a single _type attribute (enum Token::Type), because not two of the old booleans could be true at the same time.
-> Add support for lots of different other kinds of tokens. (More precise checking of token type possible)
-> Replaced instant checking of type for Operators, etc. by a value calculated at creation time. (Faster checking)
2012-04-23 21:05:26 +02: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 6ae135124e Tokenizer::setVarId: better handling of initializer lists 2012-04-23 18:26:27 +02:00
Daniel Marjamäki 706631f527 Fixed #3748 (False positive out of bounds with postincrement) 2012-04-22 12:22:49 +02:00