anuraggarg011
913670d254
Fixed #3304 (simple cases)
2012-09-04 13:41:14 +02:00
Edoardo Prezioso
6fd60eebb0
Tokenizer: added a workaround for #3690 (Support MSVC's 'for each').
2012-09-03 20:23:53 +02:00
Edoardo Prezioso
6100776847
Tokenizer: remove unneeded initialization of strings explicitely with "".
2012-09-03 20:22:27 +02:00
anuraggarg011
bf11248a09
Fixed #1620 (tokenizer: simplify well known math functions)
2012-09-03 18:51:15 +02:00
Edoardo Prezioso
804fbe3f8f
Tokenizer::simplifyEmptyNamespaces: remove useless condition.
...
Token::deleteThis handles the !tok->next situation well.
2012-09-03 14:22:31 +02:00
PKEuS
c20adf91bf
Moved simplification of wide character string literals (L"foo") to tokenize(). Token::isLong flag used to indicate that string is a wchar_t literal.
2012-09-01 13:12:47 +02:00
Daniel Marjamäki
15bc552b37
Tokenizer: Fixed possible NULL pointer dereference
2012-09-01 10:11:18 +02:00
Daniel Marjamäki
a8d419820b
Tokenizer: removed unused variable
2012-09-01 09:57:48 +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
bbce79d7b3
Small refactorization: Handle std::map more efficient in setVarIdStructMembers()
2012-08-28 12:57:11 +02:00
PKEuS
ea85dd305a
Fixed #4086 : Set varId in initialization list.
2012-08-28 12:44:40 +02:00
PKEuS
4bab7f0ee2
Removed unused and obsolete functions Tokenizer::getParameterName() and Tokenizer::getNameForFunctionParams()
2012-08-26 16:53:40 +02:00
PKEuS
662b0d2dbe
Simplify 0[foo] to *(foo) ( fixes #4083 )
2012-08-26 10:03:05 +02:00
Daniel Marjamäki
f127728582
Enable --std=c11 and --std=c++11 by default
2012-08-25 21:57:45 +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
43e01a2b1a
Ran AStyle, removed redundant tokAt(0)
2012-08-22 16:51:44 +02:00
SAndeep
0600b0be8f
sprintf changes
2012-08-22 16:46:14 +02:00
Daniel Marjamäki
9ffc7f4c2d
Fixed #3964 (False positive: Expressions in array declarations are not simplified 'char mac[17+1];')
2012-08-20 18:10:32 +02:00
Daniel Marjamäki
7786e12ba2
Fixed #3922 (false positive: (error) null pointer dereference)
2012-08-18 22:11:48 +02:00
Daniel Marjamäki
6a5cc4727d
Fixed #4019 (false positive: (style) Variable 'dest' is assigned a value that is never used)
2012-08-17 16:37:25 +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
PKEuS
45bad7d1b2
Refactorized tokenizer:
...
- Don't run setVarId() twice, keep old varId's while/after simplifyTokenList
-> Modified two test cases in testmemleak.cpp. I consider this to be safe. Feel free to investigate this.
- Fixed two nullpointer issues shown by cppcheck
Ran Astyle on teststl.cpp
2012-08-10 09:31:22 -07:00
Edoardo Prezioso
1d8240356b
Really fixed #4024 . Now the simplification won't be done on non-executive scopes.
2012-08-10 17:43:09 +02: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
Edoardo Prezioso
d68d035e22
Tokenizer::simplifyFlowControl: separated the 'throw' case because it's not a reserved keyword in C, hence the function shouldn't simplify in C source files.
2012-08-07 19:38:51 +02:00
Daniel Marjamäki
735c0f5f6b
Fixed #3963 (segmentation fault of cppcheck (invalid typedef code))
2012-08-07 16:39:41 +02:00
Edoardo Prezioso
9e916eec66
Fixed #4024 (Tokenizer::simplifyFlowControl removes pieces of code inside a class if 'exit' is a member function).
2012-08-07 10:59:27 +02:00
Daniel Marjamäki
5ee7758a83
Fixed #4015 (segmentation fault of cppcheck (enum))
2012-08-06 16:21:21 +02:00
Daniel Marjamäki
25fd841b5d
Tokenizer: removed redundant include
2012-08-05 16:06:20 +02:00
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