Dmitry-Me
70d98c7176
Get rid of set object
2015-09-10 17:59:20 +03:00
Dmitry-Me
78ed37ca86
Explicit continue, break loop early
2015-09-10 12:54:35 +03:00
Dmitry-Me
b2cd0aabf5
Simplify overengineered search-replace code
2015-09-09 18:43:32 +03:00
PKEuS
fbbdfa85ca
Revert "Fixed false negative #5815 "
...
This reverts commit dc6c278d83
.
2015-09-09 14:46:47 +02:00
Dmitry-Me
fdfddde496
Reuse cached value
2015-09-09 15:29:06 +03:00
Daniel Marjamäki
47f64df8aa
minor refactoring
2015-09-09 10:08:37 +02:00
Matthias Krüger
49e2573b5c
fix -Wodr warning/violation putting struct 'VarInfo' into anonyous namespace
...
Was:
lib/checkclass.cpp:1994:8: warning: type ‘struct VarInfo’ violates one definition rule [-Wodr]
struct VarInfo {
^
lib/checkleakautovar.h:32:7: note: a different type is defined in another translation unit
class CPPCHECKLIB VarInfo {
^
lib/checkclass.cpp:1998:21: note: the first difference of corresponding definitions is field ‘var’
const Variable *var;
^
lib/checkleakautovar.h:40:39: note: a field with different name is defined in another translation unit
std::map<unsigned int, AllocInfo> alloctype;
2015-09-08 16:57:28 +02:00
orbitcowboy
7d229f082c
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-08 11:45:13 +02:00
Dmitry-Me
662e3c8b8c
Omit unneeded match checks
2015-09-07 18:35:15 +03:00
Daniel Marjamäki
d88dc3ed3e
Reverted 00c54df07c
(don't remove enum declarations) because it caused unexpected false positives
2015-09-06 18:37:22 +02:00
Daniel Marjamäki
00c54df07c
Tokenizer: Don't remove enum declarations
2015-09-06 17:44:49 +02:00
PKEuS
5c348890b2
Preserve varId in simplifyArrayAccessSyntax ( #6523 )
2015-09-05 13:14:08 +02:00
Philipp Kloke
687bde8af5
Set version to 1.70.99/1.71 dev
2015-09-04 21:10:05 +02:00
Daniel Marjamäki
dafba604ff
1.70: Set versions
2015-09-04 19:36:34 +02:00
Dmitry-Me
e9cb3d8c97
Consistent variable name
2015-09-04 17:00:44 +03:00
orbitcowboy
c1120c1df4
Merge pull request #672 from Dmitry-Me/fixSpelling
...
Fix spelling
2015-09-04 15:39:03 +02:00
Dmitry-Me
e377a2e9b2
Fix spelling
2015-09-04 16:12:40 +03:00
Dmitry-Me
31014fe334
Omit unneded action
2015-09-04 16:06:20 +03:00
PKEuS
1aa958d60c
Updated VS solution with VS2015 as default. Added flags /Zc:inline and /Zc:throwingNew.
2015-09-04 14:30:54 +02:00
orbitcowboy
117bdef19c
Merge pull request #668 from Dmitry-Me/makeChecksMutuallyExclusive
...
Treat checks as mutually exclusive
2015-09-04 11:17:42 +02:00
orbitcowboy
d97d5d8691
Merge pull request #669 from Dmitry-Me/fixIncompleteComment
...
Comment omitted one of the items listed
2015-09-04 11:16:33 +02:00
Dmitry-Me
a87990901a
Better variable name
2015-09-04 11:38:46 +03:00
Dmitry-Me
e082264677
Comment omitted one of the items listed
2015-09-04 11:19:03 +03:00
Dmitry-Me
cd4f3cf8db
Treat checks as mutually exclusive
2015-09-04 10:42:26 +03:00
PKEuS
b49c5d7193
Merge pull request #665 from simartin/todo_condition
...
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 22:53:33 +02:00
Simon Martin
f273323cd0
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 21:07:03 +02:00
Dmitry-Me
7287b1a251
Avoid unneeded match checks
2015-09-03 18:30:05 +03:00
Dmitry-Me
0f073ad27e
Quick check to omit useless heavy matches
2015-09-03 13:09:57 +03:00
Dmitry-Me
cdf1521258
Further fix search replace
2015-09-02 17:06:19 +03:00
Dmitry-Me
139ead15ef
Merge overlapping patterns
2015-09-01 16:17:17 +03:00
amai2012
e683d31e71
Re-enable okenizer::removeMacroInClassDef for C code
2015-09-01 07:10:12 +02:00
PKEuS
04209c08cf
Merge pull request #644 from Dmitry-Me/fixSearchReplace
...
Fix search-replace
2015-08-31 21:14:58 +02:00
Dmitry-Me
969b1bfbe9
Fix search-replace
2015-08-31 17:44:33 +03:00
PKEuS
dc6c278d83
Fixed false negative #5815
2015-08-31 14:12:19 +02:00
Alexander Mai
b90b751b54
Cure some doxygen warnings
2015-08-30 20:12:02 +02:00
PKEuS
c5a8ecb6f9
New check: Detect unused 'goto' labels ( #5124 )
2015-08-30 16:45:47 +02:00
PKEuS
f12f16cb4a
Handle anonymous structs (which can appear inside unions) like anonymous unions ( #2039 )
2015-08-30 15:41:54 +02:00
Philipp Kloke
56698dd844
Fixed #6919 : Support initializer list in duplicateEnumError check
2015-08-29 22:20:09 +02:00
PKEuS
d7853b9963
Fixed simplification of fma(a, b, c) ( #6958 )
2015-08-29 20:52:03 +02:00
Alexander Mai
8d2c4453ad
Small optimizations for C code in Tokenizer. Add some regression tests for recently fixed results
2015-08-29 19:00:09 +02:00
Daniel Marjamäki
e31ee26b6c
Merge pull request #662 from simartin/ticket_6959
...
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors
2015-08-29 13:22:10 +02:00
Daniel Marjamäki
6ddd0a953f
Fixed #6917 (False positive uninitvar - unused array declaration and ternary expression)
2015-08-29 13:19:28 +02:00
Simon Martin
b4b636b6a2
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-29 13:11:00 +02:00
PKEuS
70368a2e3a
Made ctor of triplet explicit, because cppcheck demands it.
2015-08-29 11:13:03 +02:00
PKEuS
d5bc3285b9
Move "extern" to the beginning of a declaration like "static" and "const"
2015-08-29 10:57:52 +02:00
PKEuS
f89205064a
Several small optimizations in tokenize.cpp
2015-08-29 10:46:51 +02:00
Martin Ettl
08413f0112
test/cfg: Improved testing of std.cfg.
2015-08-29 00:09:33 +02:00
Simon Martin
101cebbde1
Ticket #6957 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-28 23:06:39 +02:00
Simon Martin
59abb04042
Ticket #6596 : Address of local variables can also be assigned to pointer-pointer arguments using the ptr[] syntax.
2015-08-28 20:29:51 +02:00
Daniel Marjamäki
498c920180
addons/cert.py: better handling of structs. read pragmas in the file.
2015-08-28 18:07:12 +02:00
amai2012
45bb7d5adb
Merge pull request #647 from Dmitry-Me/continueOnRuleMatch
...
Treat matches as mutually exclusive
2015-08-28 16:00:53 +02:00
orbitcowboy
b0f2351649
Merge pull request #658 from Dmitry-Me/omitMatchCall
...
Replace match call with explicit comparison
2015-08-28 14:56:35 +02:00
Dmitry-Me
962f0ee584
Treat matches as mutually exclusive
2015-08-28 15:27:56 +03:00
Dmitry-Me
0cef076f10
Prefer previous() to tokAt(-1)
2015-08-28 15:19:24 +03:00
Dmitry-Me
81613d958a
Replace match call with explicit comparison
2015-08-28 15:16:10 +03:00
amai2012
2b17a5bcee
Merge pull request #656 from simartin/ticket_6953
...
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-28 06:01:13 +02:00
Simon Martin
c78d99dc07
Ticket #6954 : Properly handle pointers to arrays in CheckUnunsedVar.
2015-08-27 23:56:26 +02:00
Simon Martin
2e2f9facf5
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-27 23:35:22 +02:00
Daniel Marjamäki
436d7b6d59
Merge pull request #655 from Dmitry-Me/explicitConstCastBetterNames
...
Use const_cast to add const, better variable name
2015-08-27 17:04:07 +02:00
Dmitry-Me
c760ccee13
Use const_cast to add const, better variable name
2015-08-27 17:14:33 +03:00
PKEuS
72b918e704
Merge pull request #654 from Dmitry-Me/eliminateDuplicateCheck
...
Eliminate duplicate find() calls
2015-08-27 14:40:33 +02:00
PKEuS
2ace3d3144
Rewritten handling of declaration specifiers:
...
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
Dmitry-Me
ca75096141
Eliminate duplicate find() calls
2015-08-27 11:19:51 +03:00
PKEuS
39dd71e49b
Merge pull request #653 from Dmitry-Me/reduceVariableScope
...
Reduce variable scope
2015-08-26 14:08:10 +02:00
Dmitry-Me
346f04098c
Reduce variable scope
2015-08-26 14:48:19 +03:00
PKEuS
7bb79562e9
Skip inner classes in CheckAutoVariables::returnReference() ( #6951 )
2015-08-26 13:31:51 +02:00
PKEuS
37aec52399
Simplify complex/_Complex types ( #6939 )
2015-08-26 13:13:45 +02:00
PKEuS
c8c59aa92b
Removed Tokenizer::simplifyIfSameInnerCondition(). It covered only very simple patterns and is unlikely to have an impact on real-world code.
2015-08-26 13:04:00 +02:00
PKEuS
6b4a0a5ed7
Merge pull request #652 from Dmitry-Me/mergeIdenticalMAtches
...
Merge identical matches
2015-08-26 11:38:50 +02:00
Dmitry-Me
77317c3373
Merge identical matches
2015-08-26 10:43:15 +03:00
Simon Martin
6fb19b02d0
Properly differentiate arrays of pointers and pointers to arrays.
2015-08-25 21:19:19 +02:00
Simon Martin
8beb95e179
Fix CheckClass::checkMemset for arrays of pointers.
2015-08-23 19:57:58 +02:00
amai2012
873861df4a
#6948 cash: daca: mgetty (garbage code)
2015-08-21 10:40:43 +02:00
PKEuS
8d926d7328
Moved some simple WinAPI/MFC-specific simplifications to windows.cfg
2015-08-20 15:59:59 +02:00
PKEuS
ebae879cf9
Some small refactorizations to tokenize.cpp
2015-08-19 20:06:49 +02:00
PKEuS
11be2f79a6
Refactorization: Removed some redundant conditions and an unused syntax check from tokenize.cpp
2015-08-19 19:29:49 +02:00
PKEuS
a720153e1e
Refactorization: Removed redundant code for syntax error handling in templatesimplifier.cpp and symboldatabase.cpp
2015-08-19 19:29:48 +02:00
PKEuS
4e2d56242c
Refactorization: Removed unreachable and duplicate code in tokenize.cpp
2015-08-19 19:29:48 +02:00
Daniel Marjamäki
13cf6be40b
dump: use toxml for function names to handle operator& etc
2015-08-18 15:39:15 +02:00
Dmitry-Me
a8135d9bd8
Merge overlapping patterns
2015-08-17 17:25:19 +03:00
PKEuS
ab8afec3eb
Refactorizations:
...
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS
1627b19dd6
Refactorizations:
...
- Call std::string::find() with char instead of char* where possible
- Avoid string copying
- Optimized several Token::tokAt/strAt calls
2015-08-16 10:33:51 +02:00
PKEuS
ee4a5843bb
Some small refactorizations
2015-08-15 19:46:31 +02:00
PKEuS
1a266315f1
Removed some unused code
2015-08-15 19:17:25 +02:00
Daniel Marjamäki
7bb9d2d2f3
minor tweak. use isNotLibraryFunction in Library to prevent false matches
2015-08-15 16:48:30 +02:00
PKEuS
b77912a0b5
Support namespaces in CheckOther::checkIgnoredReturnValue()
2015-08-15 12:19:14 +02:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Daniel Marjamäki
7ede9de502
Removed unused code. The isVariableUsed is used instead.
2015-08-15 07:43:39 +02:00
Alexander Mai
8b433fa053
Add regression test for #6299 . Fix clang compiler warning due to doxygen comment
2015-08-14 18:27:03 +02:00
PKEuS
a297a03b64
Fixed false positive #6787 : Skip over lambdas in CheckAutoVariables::returnReference()
2015-08-14 13:03:07 +02:00
PKEuS
b0bf69bae7
Fixed false positive #6763 and reordered conditions
...
Ran AStyle
2015-08-14 12:50:45 +02:00
PKEuS
3cf67014ad
Fixed parsing of template in enum
2015-08-14 11:08:03 +02:00
Daniel Marjamäki
e578988832
invalidScanf: removed the checking for 'scanf crash with huge input data for old glibc'. new systems are not vulnerable to this bug anymore.
2015-08-14 08:03:46 +02:00
Dmitry-Me
769d8e713d
Eliminate repeated lookup, better variable names
2015-08-13 16:10:23 +03:00
Malcolm Parsons
daf633ef78
Fixed #5028 Fix parsing of C++11 raw string literals
2015-08-12 13:11:55 +01:00
Daniel Marjamäki
6865724c4e
Fixed #6914 (Token::expressionString: parenthesis missing in expression (*it)->stats.corpse_ticks)
2015-08-12 10:55:25 +02:00
Dmitry-Me
f0aa9e31de
Cache and reuse value
2015-08-12 10:57:36 +03:00
Dmitry-Me
50fb9cea66
Reduce variables scope
2015-08-11 17:20:30 +03:00
PKEuS
002b606a9c
Refactorized CheckObsoleteFunctions:
...
- Mention all checked functions in getErrorMessages() and classInfo(), not only posix ones
- Made members static and initialize them only once only once
- Better support for global namespace
2015-08-11 14:57:23 +02:00
PKEuS
c96f85e2a2
Refactorization: Implemented rValue-reference- and "const char*"-overload to make_container::operator<<
2015-08-11 14:05:01 +02:00
PKEuS
ebfdacb0d3
Introduced .cfg file format version to 2 (to prevent older cppcheck versions from failing silently when reading them), because 5b287fc849
introduced a backward-incompatible feature.
...
Increased format version of std.cfg, which is the only cfg file that makes use of the new backward incompatible feature.
Refactorization: Avoid a redundant std::string::find()-call
2015-08-11 14:05:01 +02:00
Matthias Krüger
7a90b36cca
CheckVaarg::va_start_subsequentCallsError: fix spelling "inbetween" -> "in between"
2015-08-11 14:03:00 +02:00
Matthias Krüger
391194579c
CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates"
2015-08-11 13:27:55 +02:00
Daniel Marjamäki
501ab0b6da
CheckLeakAutoVar: updated handling of unknown types in C++
2015-08-11 12:41:42 +02:00
PKEuS
b0b01d3962
Merge pull request #637 from Dmitry-Me/mergeOverlappingPatterns5
...
Merge overlapping patterns
2015-08-11 12:24:52 +02:00
Daniel Marjamäki
2e78d21480
Fixed #6730 (ValueFlow: inner scope does not return (continue,throw))
2015-08-11 11:21:03 +02:00
Dmitry-Me
51ee9b0e06
Merge overlapping patterns
2015-08-11 12:19:59 +03:00
Matthias Krüger
72b00b35f8
Tokenizer::simplifyNamespaceStd() check condition only once instead of potentially 3 times
2015-08-10 23:33:58 +02:00
PKEuS
bce45fb328
Merge pull request #635 from Dmitry-Me/removeUnimplementedMethod
...
Remove unimplemented method
2015-08-10 23:00:22 +02:00
Alexander Mai
a5aba110a4
Replace Tokenizer::simplifyBuiltinExpect by a suitable addition to gnu.cfg
2015-08-10 20:21:30 +02:00
Daniel Marjamäki
57aec12f34
Fixed #5622 (Allow class methods to be referenced in library XML configuration files)
2015-08-10 18:51:51 +02:00
Daniel Marjamäki
a70c57daa2
Library: move Library::alloc and Library::dealloc from header to cpp file and use the functionName utility function
2015-08-10 18:36:09 +02:00
Dmitry-Me
eec5e1722b
Remove unimplemented method
2015-08-10 18:02:49 +03:00
Daniel Marjamäki
3a1a34751f
Library: Initial handling of method calls
2015-08-10 09:41:06 +02:00
Daniel Marjamäki
5b287fc849
Library: The <function> name attribute can now have a comma separated list of names
2015-08-09 21:27:57 +02:00
Daniel Marjamäki
06110689a6
Replace Token::Match with Token::simpleMatch
2015-08-09 20:07:38 +02:00
Daniel Marjamäki
b70fe4c609
Fixed #6711 (Add namespace support to library files)
2015-08-09 19:55:33 +02:00
Daniel Marjamäki
9627fccdc5
assignFunctionArg: don't warn when there is self assignment. There is a separate warning for self assignments.
2015-08-09 14:51:23 +02:00
Matthias Krüger
4e4a1cfe3a
Tokenizer::combineOperators: prevent duplicate checking of same condition
2015-08-09 14:35:17 +02:00
Alexander Mai
66676b8e55
Warning selfAssignment was only issued if style was enabled.
2015-08-09 13:45:35 +02:00
Alexander Mai
95658030bc
Avoid UB in Tokenizer::printDebugOutput in case of empty tokenlist (see #6913 )
2015-08-09 07:49:34 +02:00
Daniel Marjamäki
e71ab70356
Fixed #6871 (False positive uninitvar - pointer to uninitialized char[])
2015-08-08 14:52:46 +02:00
Daniel Marjamäki
72706cd0b8
Fixed #6868 (Tokenizer: wrong simplification of the unlikely keyword)
2015-08-08 12:49:42 +02:00
Daniel Marjamäki
7ec8adeb93
Fixed #6701 (Uninitialized variable warning when header could not be found)
2015-08-08 08:53:08 +02:00
Daniel Marjamäki
c9e239afbf
Fixed #6908 (False positive: Same expression on both sides of '+='.)
2015-08-07 20:28:25 +02:00
Daniel Marjamäki
ec3d76be5e
astyle formatting
2015-08-07 20:27:32 +02:00
PKEuS
48c6b30d1a
Merge pull request #634 from Dmitry-Me/avoidDeepCopy
...
Avoid deep copying std::string
2015-08-07 19:38:38 +02:00
Dmitry-Me
d81776b8c8
Avoid deep copying std::string
2015-08-07 17:16:41 +03:00
Dmitry-Me
ce96a5e84f
Run cheaper checks first
2015-08-07 16:25:47 +03:00
Dmitry-Me
c85112bdad
Break list traversal once first match is found
2015-08-06 17:10:43 +03:00
amai2012
53feb88614
Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
...
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Daniel Marjamäki
07a064aab0
Fixed #6910 (ValueFlow: variable incremented as macro argument is not known)
2015-08-05 14:08:57 +02:00
Daniel Marjamäki
a51acc8abd
minor tweak of 'Redundant condition' error message
2015-08-05 11:30:58 +02:00
Dmitry-Me
43800a9419
Detect non-interlocked check after InterlockedDecrement()
2015-08-05 12:20:28 +03:00
Daniel Marjamäki
eda5272dfd
Fixed #6875 (Improve 'Redundant condition' error message)
2015-08-05 11:15:54 +02:00
Daniel Marjamäki
4bebb80300
Fixed #6869 (False positive: uninitvar, array passed to function)
2015-08-05 10:19:17 +02:00
Daniel Marjamäki
e598b07a6d
Moved functions to astutils
2015-08-03 09:20:50 +02:00
amai2012
b8bb939e32
Add new files to VS project
2015-08-03 08:38:38 +02:00
Alexander Mai
4dc8e89327
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-08-02 21:57:42 +02:00
Alexander Mai
96c3c111fc
Refactoring: Move some AST related functions to distinct source file
2015-08-02 21:57:32 +02:00
Daniel Marjamäki
8d3f7e36e9
Fixed #6911 (valueflow: comparison of string and NULL)
2015-08-02 18:12:03 +02:00
Frank Zingsheim
7021cb2c6b
Fixed #6284 (Token::Match called with varid 0. Constants)
2015-08-02 09:11:51 +02:00
Alexander Mai
965a034afd
Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral
2015-08-01 18:42:17 +02:00
Alexander Mai
f91ad9bbf6
5402 false positive: (error) Division by zero -- with boost::format
2015-08-01 17:28:54 +02:00
Martin Ettl
b7ea311123
Running astyle. No functional changes.
2015-08-01 12:31:16 +02:00
amai2012
b182edddda
#6909 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-08-01 12:24:22 +02:00
Alexander Mai
acf050793e
#6907 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-08-01 07:39:56 +02:00
Alexander Mai
4400f2ac85
#6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks.
2015-07-31 20:24:06 +02:00
Matthias Krüger
8bfbb5d09c
CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes
2015-07-31 15:29:07 +02:00
Matthias Krüger
83ee640977
Tokenizer::syntaxError: put the character that we have an invalid number of into singlequotes instead of parentheses.
2015-07-31 15:28:59 +02:00