Daniel Marjamäki
e837bad01d
Fixed false positive in new stringLiteralWrite checker
2015-05-03 12:34:27 +02:00
Matthias Krüger
6b80e61934
fix internal warning; was
...
[lib/checkstring.cpp:43]: (warning) Found simple pattern inside Token::Match() call: "] ="
2015-05-03 10:59:58 +02:00
Daniel Marjamäki
666377da1c
Updated error message for stringLiteralWrite
2015-05-03 10:48:28 +02:00
Daniel Marjamäki
9d31afb663
Fixed #1748 (Undefined Behavior: Modification of string literal)
2015-05-03 10:44:40 +02:00
PKEuS
70a1e11ada
Set version to 1.69.99/1.70 dev
2015-05-03 08:15:13 +02:00
Daniel Marjamäki
ca1f19b6d4
Fixed #6378 (valueFlowForward: decrement not handled)
2015-05-02 17:30:09 +02:00
Daniel Marjamäki
aab1d83075
Updated error message. write variable name.
2015-05-02 16:55:17 +02:00
PKEuS
4cbbd44d49
Fixed false positive #6663 : Better support for loops in CheckStl::readingEmptyStlContainer()
2015-05-02 14:09:48 +02:00
Daniel Marjamäki
dc54676289
Reverted my changes I made by mistake in previous commit
2015-05-02 14:01:31 +02:00
Daniel Marjamäki
28985d1baa
manual: Document the cwe attribute
2015-05-02 11:43:42 +02:00
Daniel Marjamäki
a79791cb81
1.69: Set versions
2015-05-01 18:51:33 +02:00
Frank Zingsheim
9bea7bec92
Fixed #6659 (heap user after free: kernel: sm750_accel.c)
2015-05-01 18:28:00 +02:00
Frank Zingsheim
4ceed51bfb
Fixed #6607 (Crash triggered by TemplateSimplifier::useDefaultArgumentValues)
2015-05-01 17:13:02 +02:00
Alexander Mai
fa42f554a8
cppcheck compilation fails with g++4.6.3 ( #5929 ). Patch supplied by mavik1
2015-05-01 16:25:27 +02:00
orbitcowboy
785df82513
#6660 : Fixed crash in Tokenize::SetVarid().
2015-04-29 09:18:54 +02:00
Daniel Marjamäki
88f59ad7e8
Partial fix for #6656 (Allow that CWE is mapped for error message)
2015-04-25 17:48:11 +02:00
Daniel Marjamäki
ad6db2ba81
Reverted 105de8e917
, new checker had FPs that need to be fixed.
2015-04-25 15:35:31 +02:00
Daniel Marjamäki
bdc024bd7c
Fixed 6634 (false positive: dereferencing null pointer in a sizeof operation)
2015-04-20 13:46:02 +02:00
amai2012
8d8fffb20f
#6651 Don't call member function on NULL pointer - even if call is "safe"
2015-04-17 08:47:59 +02:00
PKEuS
ac867b4220
Handle pointers to const member functions in Tokenizer::simplifyFunctionPointers() ( #6603 )
2015-04-13 21:21:57 +02:00
PKEuS
c4ceb97cea
Fixed #6629 : Don't simplify sinf(0) if sinf is a variable
2015-04-13 20:37:07 +02:00
PKEuS
708a379fd2
Refactorized simplification of sizeof without parantheses:
...
- Moved sizeofAddParentheses() behind combineOperators()
- Improved sizeofAddParentheses() to handle all code from unit tests at simplifyTokenList1()
- Removed simplification from simplifyTokenList2()
2015-04-13 20:18:21 +02:00
PKEuS
4c40664861
Fixed #6639 : Calculate sizeof() of multidimensional arrays
2015-04-13 20:18:21 +02:00
PKEuS
19bba94282
Merge pull request #589 from simartin/restore_libcpp_build
...
Restore build with libc++ and revert PR#228 and PR#562.
2015-04-13 17:12:00 +02:00
PKEuS
b6709294a8
Fixed ...... in template instantiations (similar to constconst from #6604 )
2015-04-13 17:03:06 +02:00
Simon Martin
e5745d7d4a
Restore build with libc++ and revert PR#228 and PR#562.
2015-04-12 20:29:49 +02:00
PKEuS
c2ccd7d9e4
Simplify _declspec like __declspec
2015-04-11 11:02:52 +02:00
Matthias Krüger
42f0955e3f
Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
...
Follow up to eedcb6abcb
.
2015-04-10 14:31:19 +02:00
Frank Zingsheim
84830638a2
Improved fix #6636 : (False positive unreadVariable - scope analysis seems to fail to False positive unreadVariable)
2015-04-09 21:09:31 +02:00
Robert Reif
4ceb24630d
Fixed #6568 : Scope for template class member function missing in symboldatabase
2015-04-09 21:01:47 +02:00
PKEuS
d5ad1def40
Removed two unused functions
2015-04-09 20:54:07 +02:00
PKEuS
4e5c5eb238
Fixed #5665 : Recognize free() with more than one parameter
2015-04-09 20:50:19 +02:00
Frank Zingsheim
d52b031301
Fixed #6638 : (varid for loop in for statement)
2015-04-09 19:58:12 +02:00
Frank Zingsheim
648ee95f31
Fixed #6636 : (False positive unreadVariable - scope analysis seems to fail to False positive unreadVariable)
...
Bug was introduced by 1f5265c1bd
2015-04-08 20:30:41 +02:00
Daniel Marjamäki
d563bd73f4
Fixed #6583 (False positive uninitvar - exit() ignored?!)
2015-04-08 15:35:04 +02:00
Gustav Palmqvist
105de8e917
#220 uninitialized variable: using variable in ctor before it has been initialized. Implement new check usageBeforeInitialization
2015-04-07 22:01:13 +02:00
orbitcowboy
8596794ce7
MathLib:mod: Declared local variable as const. No functional change.
2015-04-07 17:21:28 +02:00
Matthias Krüger
eedcb6abcb
move setting flags checks out of for loops, make them const.
2015-04-07 07:23:28 +02:00
Frank Zingsheim
1f5265c1bd
Fixed #6253 ([False Positive] Variable not initialized in the constructor)
2015-04-06 19:47:21 +02:00
Alexander Mai
9876cf2312
#6626 crash: Token::astOperand2() const ( do while ). Fix two segmentation faults on invalid code.
2015-04-06 17:23:48 +02:00
Matthias Krüger
7fdbb91694
don't print warning message if --enable=warning is not specified.
...
message was of type:
(warning) Possible null pointer dereference: previous - otherwise it is redundant to check it against null.
2015-04-06 15:05:34 +02:00
Matthias Krüger
22d97fdbd6
don't print style message if --enable=style is not specified.
...
message was of type:
(style) Redundant checking of STL container element existence before removing it.
2015-04-06 14:26:15 +02:00
Matthias Krüger
988acf11b4
don't print warning message if --enable=warning is not given.
...
message was of type:
(warning) Passing value 0 to foo() leads to implementation-defined result.
2015-04-06 13:37:27 +02:00
Matthias Krüger
592177200a
don't print warning message if --enable=warning is not given.
...
message was of type:
(warning) Call of pure virtual function 'foo' in constructor.
2015-04-06 13:34:44 +02:00
Matthias Krüger
6ff9a52d8b
don't print style message if --enable=style is not given ( #6627 )
...
message was of type:
(style) Class 'foo' is unsafe, 'foo::bar' can leak by wrong usage.
2015-04-06 12:02:21 +02:00
Simon Martin
0f7f08644c
Show template instantiation and not definition location in template instantiation debug message.
2015-04-05 14:54:24 +02:00
Robert Reif
c02acea5bf
Fixed #6614 (false positive: (style) The class 'A' does not have a constructor.)
2015-04-04 11:33:25 +02:00
Daniel Marjamäki
aacd9b9f6b
Fixed #6586 (Tokenizer: '>>' is wrongly tokenized as '> >' - if (n1 < len>>1))
2015-04-03 20:25:49 +02:00
Dmitry-Me
ba423185b8
Omit uneeded checks
2015-04-02 10:26:19 +03:00
amai2012
788da37e05
Merge pull request #584 from Dmitry-Me/betterVariableName3
...
Formatting cleanup, better variable name
2015-04-02 09:20:31 +02:00
Dmitry-Me
7b69396223
Formatting cleanup, better variable name
2015-04-01 18:23:51 +03:00
Dmitry-Me
aa7d665e7a
Better variable name
2015-04-01 16:39:45 +03:00
PKEuS
72b4809da0
Moved simplification of operator names before template and parentheses simplifications ( #6576 )
2015-04-01 13:47:36 +02:00
PKEuS
0d37c4df04
Fixed three unique crashs on garbage code ( #6613 ).
...
Removed redundant copy of string in templatesimplifier.cpp
2015-04-01 12:43:24 +02:00
PKEuS
4c3a7661c3
Merge pull request #565 from Dmitry-Me/cacheAndReuse
...
Cache and reuse value
2015-04-01 11:30:13 +02:00
PKEuS
04a3196a32
Merge pull request #576 from Dmitry-Me/anyParameterType
...
Constructor parameter type need not be a number
2015-04-01 11:29:44 +02:00
Daniel Marjamäki
e3bff8ff07
astyle formatting
2015-03-29 21:05:18 +02:00
Dmitry-Me
7c402afeb7
Preprocessor: Reduce overhead from searching for fallthrough comments when not needed
2015-03-29 09:28:17 +02:00
Dmitry-Me
e36ff852cd
Don't call abort() in the middle of C++ code
2015-03-26 15:26:08 +03:00
Dmitry-Me
e8f0abf259
Proper simplify delete a,b
2015-03-25 16:54:23 +03:00
Dmitry-Me
d735918a8a
Constructor parameter type need not be a number
2015-03-25 14:56:45 +03:00
Dmitry-Me
9398fa810b
Avoid value truncation
2015-03-25 10:39:09 +03:00
PKEuS
be4e51f00b
Merge pull request #571 from Dmitry-Me/omitUnneededActions3
...
Omit unneeded actions
2015-03-24 19:25:22 +01:00
PKEuS
b9ff2fd922
Merge pull request #573 from Dmitry-Me/removeDuplicateCheck
...
Remove duplicate check
2015-03-24 19:24:14 +01:00
amai2012
035faa4b6b
Merge pull request #572 from Dmitry-Me/mergeOverlappingPatterns4
...
Merge overlapping patterns
2015-03-24 16:55:37 +01:00
Dmitry-Me
8a4033e13a
Omit unneeded actions
2015-03-24 16:01:59 +03:00
Dmitry-Me
c9cdba5865
Remove duplicate check
2015-03-24 15:58:03 +03:00
Dmitry-Me
4201279954
Merge overlapping patterns
2015-03-24 10:22:26 +03:00
Daniel Marjamäki
a3a5c74bbf
Revert "Remove bitwise-or abuse"
...
This reverts commit 7017b051fe
.
2015-03-24 08:07:15 +01:00
PKEuS
ab97d8dd6f
Merge pull request #569 from Dmitry-Me/removeBitwiseOpAbuse
...
Remove bitwise-or abuse
2015-03-23 20:23:07 +01:00
Dmitry-Me
7017b051fe
Remove bitwise-or abuse
2015-03-23 13:30:05 +03:00
Dmitry-Me
0383998aea
Better variable name
2015-03-23 11:58:56 +03:00
PKEuS
19f770e41b
Fixed #6604 - don't create template instanciations with "const const const const..." patterns.
2015-03-22 11:20:47 +01:00
amai2012
a9b7299dc3
Merge pull request #566 from simartin/ticket_6587
...
Ticket #6587 : Do not consider template expressions in decltype as instantiations
2015-03-21 18:13:46 +01:00
Simon Martin
ec1eebf585
Ticket #6587 : Never consider a template parameter's default value as an instantiation.
2015-03-21 16:30:00 +01:00
amai2012
bb9848d24a
Merge pull request #563 from Dmitry-Me/deconvoluteCheck
...
Make the check slightly less convoluted
2015-03-21 12:27:37 +01:00
Dmitry-Me
8f21aba606
Cache and reuse value
2015-03-20 12:39:51 +03:00
Dmitry-Me
4a75ac58cf
Merge overlapping patterns
2015-03-20 11:06:18 +03:00
Dmitry-Me
5f6aaa4573
Make the check slightly less convoluted
2015-03-20 11:03:11 +03:00
Simon Martin
2587ebf189
Restore build on Mac OS X on which we're force to use GNU's STL, that does not have cend()...
2015-03-19 20:25:57 +01:00
amai2012
4086127144
Merge pull request #559 from Dmitry-Me/omitUnneededActions2
...
Omit unnecessary operations
2015-03-19 19:03:47 +01:00
Dmitry-Me
20d4c6fad3
Eliminate duplication in TCHAR functions substitution
2015-03-19 18:41:36 +03:00
Dmitry-Me
4fcbe00913
Omit unnecessary operations
2015-03-19 15:14:07 +03:00
Dmitry-Me
9703e6b72b
Unicode names set for ANSI
2015-03-19 13:26:08 +03:00
Dmitry-Me
7afe4ba5e0
Mismatching TCHAR function names
2015-03-19 10:41:02 +03:00
Daniel Marjamäki
dbfbddb178
Merge pull request #555 from Dmitry-Me/eliminateRepeatedFind
...
Eliminate repeated lookup
2015-03-19 06:45:26 +01:00
Jakub Melka
a49efb13f6
Added auto_ptr checking for malloc
2015-03-19 06:41:54 +01:00
Dmitry-Me
8f8ba65a29
Eliminate repeated lookup
2015-03-18 11:52:09 +03:00
Dmitry-Me
15a847cc0d
Move declaration to where it's first needed
2015-03-18 10:07:13 +03:00
Dmitry-Me
3ab3715a88
Merge overlapping patterns
2015-03-17 16:23:19 +03:00
PKEuS
e8161aeda6
Refactorized Scope::getVariableList(): Removed scope depth counter, simplified patterns
2015-03-15 12:37:50 +01:00
PKEuS
e978a681a3
Removed unused variable
2015-03-15 10:19:35 +01:00
PKEuS
0d127f15a5
Fixed grammar mistake; fixed two VS2013 code analysis messages; removed redundant Token::Match call
2015-03-15 10:06:56 +01:00
PKEuS
713d993f71
Some refactorizations in Tokenizer:
...
- Refactorized simplifyTypedef
- Perform some template specific code only on non-C code
2015-03-15 10:04:44 +01:00
PKEuS
d6751a7987
Merge pull request #537 from Dmitry-Me/decouplePatternMatchingFromOtherChecks
...
Decouple pattern matching from other checks
2015-03-15 08:50:59 +01:00
Daniel Marjamäki
a200e5b32f
Merge pull request #551 from simartin/ticket_4335
...
Ticket #4335 : Properly detect and handle template class specialisations
2015-03-15 07:59:11 +01:00
Simon Martin
520314f9a0
Ticket #4335 : Properly detect and handle template class specializations.
2015-03-15 00:28:33 +01:00
Simon Martin
32a7a178e8
Code simplification now that ">>" is turned into "> >" when it closes template argument lists.
2015-03-14 23:02:10 +01:00
amai2012
40769c9a59
Merge pull request #549 from simartin/ticket_6437
...
Ticket #6347 : Fix use after delete when simplifying template instantiations
2015-03-14 22:30:58 +01:00
PKEuS
430d8ca760
Refactorized code in simplifyEnum()
2015-03-14 20:43:14 +01:00
Daniel Marjamäki
fd6bd97972
Fixed #6495 (Improve check: uninitialized variable, 3rd function argument)
2015-03-14 19:23:33 +01:00
Simon Martin
4c916641cc
Ticket #6347 : Fix use after delete when simplifying template instantiations.
2015-03-14 18:46:17 +01:00
Daniel Marjamäki
42c4aa1c49
Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes)
2015-03-14 17:59:11 +01:00
amai2012
53e2d425d1
Merge pull request #546 from Dmitry-Me/properChainConditions
...
Proper if-else-if chain for mutually exclusive conditions
2015-03-14 17:38:06 +01:00
Dmitry-Me
2b50e73aa9
Misleading comment
2015-03-14 15:18:29 +03:00
Dmitry-Me
89ec9058a8
Proper if-else-if chain for mutually exclusive conditions
2015-03-14 15:09:46 +03:00
Dmitry-Me
43a19dee8b
Remove unneded deep copy, make reference const
2015-03-14 13:45:21 +03:00
PKEuS
6e0302fd56
Refactorized CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfBoolExpressionWithInt() and CheckBool::pointerArithBool():
...
- Support more patterns in CheckBool::pointerArithBool()
- Use AST and SymbolDatabase
- Removed redundant skipping over template arguments
2015-03-12 20:07:48 +01:00
PKEuS
7f2b6881b3
Refactorization: Avoid including path.h in (almost) every source file (via library.h)
2015-03-11 22:54:45 +01:00
PKEuS
3d2e26daeb
Small Refactorizations:
...
- Removed #include "symboldatabase.h" from library.h
- Moved variable to inner scope in tokenize.cpp
- Removed unnecessary variable in tokenize.cpp
2015-03-11 20:52:54 +01:00
PKEuS
cd84d78e92
Ran AStyle, fixed VS2015 warning in symboldatabase.h
2015-03-11 20:26:53 +01:00
PKEuS
9bafa3bf25
Fixed false positive #6575
2015-03-11 20:25:27 +01:00
amai2012
ed097d4c4f
Merge pull request #540 from JakubMelka/ticket_695
...
Ticket #695 : new style check : explicit declaration of ctor
2015-03-11 12:15:22 +01:00
Jakub Melka
e1e1dbfe97
Ticket #695 : Fixed VS 2010 issue, switched to "style" severity, changed error messages and updated unit tests
2015-03-10 19:35:12 +01:00
Jakub Melka
b7d92a4fc7
Fixed warnings of CppCheck's own code (caused by new check #695 )
2015-03-08 18:18:09 +01:00
Daniel Marjamäki
2d8a6c7b89
Fixed #6571 (Library::isNotLibraryFunction: Return true for methods)
2015-03-08 16:13:32 +01:00
Simon Martin
1d973b882d
Ticket #6567 : Handle member functions in TemplateSimplifier::getTemplateNamePosition.
2015-03-07 21:52:12 +01:00
Jakub Melka
2af9212b16
Ticket #695 : new style check : explicit declaration of ctor
2015-03-07 20:07:54 +01:00
Daniel Marjamäki
0131bda065
Merge pull request #539 from simartin/ticket_6181
...
Ticket #6181 : Normalize '>>' into '> >' when it's closing a C++11 template parameter list
2015-03-07 15:02:21 +01:00
Simon Martin
9c6a625f91
Ticket #6181 : Normalize '>>' into '> >' when it's closing a C++11 template parameter list.
2015-03-07 11:06:04 +01:00
Daniel Marjamäki
87ebeb3f65
Fixed #6533 (library: alloc/dealloc doesn't work when function declaration is seen)
2015-03-07 09:43:56 +01:00
Dmitry-Me
74417699db
Remove redundant break
2015-03-06 18:55:47 +01:00
Daniel Marjamäki
f705cdce72
Fixed #6556 (Tokenizer::simplifyVarDecl: doesn't simplify template variables properly)
2015-03-06 17:30:20 +01:00
Daniel Marjamäki
e38f15ecc0
--check-library: dont write <noreturn> messages now since they cant be fixed.
2015-03-05 07:19:03 +01:00
Daniel Marjamäki
6646a896f9
Fixed #6446 (FP zerodivcond on double arithmetics)
2015-03-03 15:50:31 +01:00
Daniel Marjamäki
925f077b8a
Fixed #6110 (TemplateSimplifier::simplifyCalculations: wrong simplification of 'if (VG_(strlen)(s)>=3)')
2015-03-02 16:27:00 +01:00
Daniel Marjamäki
86cdc8e7a6
Fixed #6540 (Tokenizer::simplifyKnownVariables: Missing varid for simplification in conditional code)
2015-03-02 06:18:00 +01:00
Daniel Marjamäki
830f656a25
Library: variables are not library functions (variable declarations can look like function calls)
2015-03-01 11:46:43 +01:00
Robert Reif
27388c3696
Fixed #6546 (False positive uselessAssignmentPtrArg - triggered by throw?)
2015-02-28 16:07:43 +01:00
Daniel Marjamäki
449b88aa0c
Fixed #6547 (Regression - unknown macro causes analysis error)
2015-02-28 11:09:39 +01:00
Daniel Marjamäki
3add466035
Add isFunctionHead() in Tokenizer
2015-02-27 18:29:34 +01:00
Dmitry-Me
10b762da98
Decouple pattern matching from other checks
2015-02-27 13:09:06 +03:00
Dmitry-Me
848f50b005
Get rid of Hungarian notation
2015-02-27 12:02:12 +03:00
Daniel Marjamäki
acbf48c7fa
Fixed #6548 (Tokenizer: Wrong varid set after function which is throw())
2015-02-26 16:31:42 +01:00
Dmitry-Me
22b0f37aaf
Cache and reuse value
2015-02-26 14:34:18 +03:00
Dmitry-Me
d7365519a5
Cache and reuse value
2015-02-26 11:48:15 +03:00
PKEuS
cb4bf73749
Merge pull request #530 from Dmitry-Me/doChecksEarlier
...
Don't run the checks which will be silenced later anyway
2015-02-25 19:22:00 +01:00
amai2012
b9316e8ce0
Merge pull request #531 from Dmitry-Me/removeRedundantCasts
...
Remove redundant casts
2015-02-25 07:57:52 +01:00
Daniel Marjamäki
d1892786b8
ValueFlow: Improved when using '[' on arrays and strings
2015-02-24 15:57:39 +01:00
Dmitry-Me
938b84903f
Remove redundant casts
2015-02-24 15:15:22 +03:00
Alexander Mai
8427398d9d
#6539 Segmentation fault in Tokenizer::duplicateTypedef. Avoid crash on garbage code
2015-02-24 11:15:23 +01:00
Dmitry-Me
24d2b0368f
Don't run the checks which will be silenced later anyway
2015-02-24 10:20:43 +03:00
Robert Reif
130ffc5752
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-24 06:11:31 +01:00
Alexander Mai
b9cc5b5c6b
#6543 crash: CheckCondition::checkBadBitmaskCheck ; wine dlls/gdi32/dibdrv/primitives.c. Run astyle.
2015-02-23 22:06:55 +01:00
Daniel Marjamäki
fb5cc6fded
Fixed #5905 (isSameExpression: comparisons 'a<b' and 'a>b' are same)
2015-02-23 16:38:55 +01:00
Daniel Marjamäki
830d1eb3fd
Revert "Fixed #6538 (Symboldatabase: improve isFunction)"
...
This reverts commit d7ef89bbe6
.
There was crashes in a Travis job.
2015-02-23 08:07:19 +01:00
Robert Reif
d7ef89bbe6
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-23 06:49:50 +01:00
Alexander Mai
26c2c4a824
Extend verbose message for memsetClassFloat
2015-02-22 15:41:02 +01:00
Daniel Marjamäki
d4fa656e58
Refactor and improve Tokenizer::sizeofAddParentheses
2015-02-22 13:38:06 +01:00
PKEuS
bedc935ab0
New check: Warn about constant expression if ( unknown | non_null_constant) ( #6519 )
2015-02-22 13:09:39 +01:00