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
Matthias Krüger
87891b4128
CheckCondition::checkIncorrectLogicOperator put conditions in single quotes
2015-07-31 15:28:48 +02:00
Matthias Krüger
21ed807f8d
CheckCondition::alwaysTrueFalseError: put condition in single quotes.
2015-07-31 15:28:37 +02:00
Daniel Marjamäki
251f6d2a15
Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented)
2015-07-31 07:03:52 +02:00
amai2012
249a05126b
#6895 segmentation fault (invalid code) in CheckCondition::isOppositeCond
2015-07-30 17:19:19 +02:00
Daniel Marjamäki
503fb485cf
Removed hardcoding of functions from checkZeroDivision
2015-07-30 13:48:51 +02:00
Daniel Marjamäki
1752c4f4f0
Avoid 'Condition always true/false' FP when part of the condition is an expanded macro
2015-07-30 13:30:16 +02:00
amai2012
c5673612e2
#6069 False positive incorrectLogicOperator due to dynamic_cast. Run CheckCondition::checkIncorrectLogicOperator on non-simplified tokenlist.
2015-07-30 10:30:30 +02:00
Daniel Marjamäki
9085fdc156
Fixed #6887 (False positive eraseDereference - container is member of member variable)
2015-07-30 10:13:49 +02:00
Daniel Marjamäki
594d30f7ae
Fix Cppcheck warning about unused variable
2015-07-29 20:26:00 +02:00
Daniel Marjamäki
6790d91fbb
Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884 .
2015-07-29 19:54:57 +02:00
PKEuS
738057229c
Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
...
Handle sizeof in isSameExpression() (#6851 )
2015-07-29 14:28:24 +02:00
Daniel Marjamäki
120f3072eb
alwaysTrueFalse: Dont write warning when comparison is made in macro
2015-07-29 12:51:00 +02:00
Daniel Marjamäki
fc25ed8c86
Fixed #6879 (valueflow in do-while(++i))
2015-07-29 11:55:07 +02:00
Daniel Marjamäki
bf75ee9aed
Fixed #6885 (valueflow ignores assignment of variable via function call)
2015-07-29 10:49:17 +02:00
amai2012
1f43550688
#6880 , 6881 Crashes on invalid code. Fix null pointer access
2015-07-28 18:41:50 +02:00
Dmitry-Me
544932734f
VS: Disable 4482 warning
2015-07-28 18:33:45 +02:00
Daniel Marjamäki
0e82730ee4
addons/naming.py: fixed error report for function name
2015-07-28 14:34:37 +02:00
Daniel Marjamäki
5a57e4030a
dump: Add Function name attribute
2015-07-28 14:18:58 +02:00
Daniel Marjamäki
a1dfd6cf73
astyle formatting
2015-07-28 12:47:08 +02:00
Daniel Marjamäki
a17f4d0a2d
CLI: Added --debug-normal option that will show --debug output after 1st simplifications. This output is relevant for the 'normal' checkers.
2015-07-28 12:46:32 +02:00
Daniel Marjamäki
e759710198
Fixed #6743 (valueFlowAfterCondition: wrong value when variable is changed in conditional code)
2015-07-28 08:58:05 +02:00
Daniel Marjamäki
c5bbea2994
Fixed #6816 (FP: buffer overflow, checkminsizes of array with string value)
2015-07-27 16:39:41 +02:00
Daniel Marjamäki
f449e91d43
made valueFlowSwitchVariable faster when there are many 'case %num%:'
2015-07-27 14:57:02 +02:00
Daniel Marjamäki
05a21d45eb
Fixed #6670 (Analysis failed when there are {} in LHS in compound assignment)
2015-07-27 13:44:35 +02:00
Daniel Marjamäki
35eb1a393d
AST: handle concatening of strings better. this is not ideal but better.
2015-07-27 13:13:30 +02:00
Daniel Marjamäki
64b72bd6e5
Fixed #6227 (False positive (oppositeInnerCondition) - if (!dynamic_cast<>))
2015-07-27 10:43:52 +02:00
Daniel Marjamäki
5cc744b941
Fixed #6872 (Major performance regression - valueFlowSwitchVariable)
2015-07-27 06:45:06 +02:00
Daniel Marjamäki
389aec51ae
Fixed #6598 (False positive zerodivcond - cast to double ignored)
2015-07-26 22:08:36 +02:00
Daniel Marjamäki
ed1c6e41d9
Fixed #6876 (valueFlowForward: lambda function)
2015-07-26 19:28:42 +02:00