Robert Reif
6b8e83a181
speed up checks by caching commonly looked up stuff in the symbol database (checkother, checkstl, checkunusedvar). Ticket: #4266
2012-11-16 06:50:49 +01:00
Daniel Marjamäki
a2febc49d6
Fixed #4318 (False positive: 'unreadVariable')
2012-11-15 08:36:43 +01:00
Daniel Marjamäki
79cd601ae7
Fixed #4356 (False positive at variable initialization)
2012-11-15 07:48:45 +01:00
Robert Reif
09eed80938
speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket: #4266
2012-11-15 07:11:45 +01:00
Robert Reif
04d04c33c2
speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket #4266
2012-11-14 18:12:33 +01:00
Robert Reif
6578b78077
speed up checks by caching commonly looked up stuff in the symbol database (checkIncorrectLogicOperator). Ticket: #4266 .
2012-11-13 18:30:33 +01:00
Robert Reif
f82eff6589
speedup checkpostfixoperator.cpp by caching commonly looked up stuff in the symbol database. Ticket: #4266
2012-11-12 06:16:38 +01:00
PKEuS
e5ebb49312
Added support for sizeof(wchar_t). Improved <Windows.h> type testing for Win64 platform.
2012-11-11 16:16:17 +01:00
PKEuS
5555e055f1
Refactorized <Windows.h> type support:
...
- Changed some more Win32 simplifications of wide-character/string types to use wchar_t
- Added support for LPWSTR
- Fixed test case to ensure that simplifications also work for Win32W
2012-11-11 15:40:06 +01:00
PKEuS
4ea2df8671
Changed handling of type wchar_t:
...
- Don't simplify wchar_t to unsigned short on Win32 platforms to ensure that checking of strings and nullpointer dereferences works.
- Added it as standard type
2012-11-11 14:47:16 +01:00
PKEuS
17b720ef7d
Refactorization: Removed unnecessary code. Variable::typeStartToken() and Variable::typeEndToken() never point to "const".
...
Ran AStyle
2012-11-11 13:32:19 +01:00
PKEuS
704f285c90
Refactorized CheckStl::pushback():
...
- insert(), reserve() and clear() also invalidate iterators
- Properly support return and throw statements: Bailout after semicolon
- "." is also bad usage of invalid iterator.
2012-11-11 13:03:58 +01:00
Jose Roquette
e8d3a4300d
Fixed #4197 - False negative: invalidIterator2 not detected
2012-11-11 12:01:52 +01:00
PKEuS
4ee955fc8c
Improved CheckNullPointer::isPointerDeRef():
...
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +01:00
PKEuS
3e03838025
Fixed verbose messages in CheckOther::incorrectLogicOperatorError which didn't contain all information of the short message.
2012-11-10 11:31:36 +01:00
PKEuS
f75826c3e2
Added wstring to pattern where I forgot in bbe06c65c0
2012-11-09 20:25:50 +01:00
PKEuS
58fe7105f4
Remove C++11 keywords "override", "final" and "constexpr"
2012-11-09 19:53:10 +01:00
PKEuS
ce961578c2
New checks (inconclusive): Suspicious calculation with sizeof()
...
- Check for sizeof(ptr)/something: This indicates that programmer was trying to calculate array size, but sizeof(ptr) doesn't return the length of the memory area, but size of a pointer.
- Check for sizeof()*sizeof(): This indicates that programmer misunderstood what sizeof() does: It does return the length in bytes of the given variable, not e.g. the number of elements in an array.
2012-11-09 18:08:20 +01:00
Edoardo Prezioso
119ab519a4
Support GNU extension of '?:' operator:
...
"x ? : y" is equivalent to "x ? x : y". I found a lot of code with this extension, probably we should warn a user to not use this.
2012-11-08 17:49:43 +01:00
Edoardo Prezioso
9556634ee7
Revert 1c0617c504
.
2012-11-07 18:34:25 +01:00
Edoardo Prezioso
061a5e1ad7
Run astyle.
2012-11-07 02:24:46 +01:00
Edoardo Prezioso
1c0617c504
change some Token::Match patterns used in code:
...
replace '||' with '%oror%', where possible.
2012-11-07 02:23:09 +01:00
PKEuS
aa2ad41629
Print message "Found calculation inside sizeof()" also for increment/decrement operator.
2012-11-06 11:39:47 -08:00
PKEuS
bbe06c65c0
Added support for wide-strings (wcs* functions, std::wstring, std::*wstringstream) at many places.
2012-11-06 10:54:52 -08:00
Zachary Blair
51d128c918
Fixed #2029 (free invalid address) by reporting previously-unreported errors as "inconclusive"
2012-11-05 21:02:51 -08:00
Edoardo Prezioso
ca2a6e6054
Add '%char%' as a CheckInternal known pattern.
2012-11-05 17:25:36 +01:00
Edoardo Prezioso
63307c5db2
Remove the now useless fix for #4245 .
...
The fix for #4276 made completely useless that branch, so remove it until someone shows a testcase which breaks this commit.
2012-11-05 00:13:04 +01:00
Edoardo Prezioso
7293fcfa9b
Remove redundant code in simplifyVarDecl:
...
TokenList::insertTokens adds the missing braces links when needed. The function does not add links to '<>', though, hence the TODO.
2012-11-05 00:12:22 +01:00
Edoardo Prezioso
4e25ffa948
Remove unexecuted branch in duplicateTypedef:
...
If the code is intended to be used, please revert + provide a valid testcase.
2012-11-04 23:03:14 +01:00
Edoardo Prezioso
333711ae4f
Remove dead branch in simplifySizeof:
...
the code in that branch won't ever be executed because simplifySizeOf is called after arraySize, which adds the string length inside the '[]' parenthesis.
2012-11-04 22:41:38 +01:00
Edoardo Prezioso
24bf6f99e1
More simplifyRedundantParenthesis changes:
...
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
Edoardo Prezioso
b6b359d1c6
Tokenizer::simplifyRedundantParenthesis refactor:
...
Change useless 'while' to 'if' where possible; unify duplicate 'delete [| ]| var' handling code.
2012-11-04 20:51:40 +01:00
Edoardo Prezioso
93f1fed205
Tokenizer '?:' handling code refactorization:
...
move '=|,|(|[|{|}|;|case|return (%bool%) ?' code handling from simplifyConditionOperator in simplifyConstTernaryOp in order to use a more efficient code, thus to remove code duplication.
2012-11-04 19:18:11 +01:00
Edoardo Prezioso
18e1eb7c70
Add missing hunks in the previous commit.
2012-11-04 19:08:54 +01:00
Edoardo Prezioso
c54eafdf69
Use '%char%' matching in the tokenizer file.
2012-11-04 17:22:38 +01:00
Edoardo Prezioso
87c931b74b
Add '%char%' as pattern to match in Token::Match.
...
All and only those single characters enclosed in "'" are accepted.
2012-11-04 16:58:18 +01:00
Andrew Martin
7c370ec873
Fixed #4305 (improve check: 'vector.size() < 1' should result in 'inefficient checking for '...' emptiness.')
2012-11-04 16:15:26 +01:00
PKEuS
dc3eba964b
Incremented version to "1.58 dev" (1.57.99)
2012-11-04 15:49:18 +01:00
Daniel Marjamäki
3a44a5ca3c
1.57: Setting version
2012-11-04 13:50:23 +01:00
PKEuS
4cd96158ae
Fixed parsing of "__asm__ volatile {""};"
2012-11-04 12:21:34 +01:00
PKEuS
b0c1c2c819
Don't suggest using initialization list for static variables ( #4332 )
2012-11-04 11:59:09 +01:00
PKEuS
e44ee280bc
Fixed handling of pointers to functions in namespace as template parameters ( #4172 )
2012-11-04 11:15:03 +01:00
PKEuS
9cb9388e49
Fixed handling of pointers in templates ( #4319 )
2012-11-04 10:49:25 +01:00
PKEuS
6122819832
Message refactorization: Changed expression "0-terminate" to "null-terminate" as discussed on 24b98feadb
2012-11-03 21:21:19 +01:00
PKEuS
1c399c86ca
Improved fix for #4311 ; Added back support for "this." (fixes again #4291 )
...
Added TODO unit test for missing varid.
2012-11-03 21:16:05 +01:00
PKEuS
c84857fc7e
Fixed compilation as shared lib with PCRE: Ensure that sizeof(Settings) is the same with and without HAVE_RULES
...
Fixed VS10 solution when TinyXml is included (define TIXML_USE_STL).
2012-11-03 20:37:23 +01:00
Daniel Marjamäki
6c2563c467
Fixed #4311 (False positive: warning (selfAssignment): Redundant assignment of 'm_bar' to itself.
2012-11-03 13:18:43 +01:00
Daniel Marjamäki
24e71c479c
Fixed #4301 (htmlreport broken)
2012-11-03 11:25:40 +01:00
PKEuS
a36e008967
Fixed #4314 : Using CheckNullPointer::isPointerDeRef() here is overkill and doesn't work as intended, since this function is designed to return 'false' if it isn't sure.
2012-11-03 10:25:32 +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