Daniel Marjamäki
3986c0dc64
fixed cppcheck warnings
2015-06-10 19:07:04 +02:00
Dmitry-Me
cae605b1ec
New warning: warn about redundant code in condition.
2015-06-10 18:53:55 +02:00
Frank Zingsheim
0e354a03bd
Fixed #6716 (Performance: Alternative String Representation in Match Compiler)
2015-06-07 16:21:06 +02:00
Daniel Marjamäki
0ca410a4d7
Fixed #6668 (False positive bufferAccessOutOfBounds on sprintf() - regression)
2015-06-07 14:01:20 +02:00
Alexander Mai
c18461b173
#6761 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash.
2015-06-07 13:35:51 +02:00
Daniel Marjamäki
75b0430ba5
Token::strValue: fixed handling of backslash
2015-06-07 11:25:33 +02:00
Alexander Mai
b6264e4a00
#6759 segmentation fault (invalid code) in Tokenizer::simplifyTokenList2. #6760 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crashes
2015-06-06 13:11:32 +02:00
Daniel Marjamäki
d208e763df
astyle formatting
2015-06-05 14:34:53 +02:00
Daniel Marjamäki
e36cc9f6d9
stringLiteralWrite: Updated error message
2015-06-05 14:34:13 +02:00
amai
5fd9dd04fa
#6757 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash
2015-06-04 19:00:35 +02:00
Alexander Mai
5f4902c613
6755 segmentation fault (invalid code) in Token::isAssignmentOp. #6756 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix two crashes.
2015-06-04 17:46:52 +02:00
amai2012
f2d397882f
#6753 segmentation fault (invalid code) in CheckMemoryLeakStructMember::checkStructVariable. #6754 segmentation fault (invalid code) in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes. Trivial fixes to avoid null pointer access
2015-06-03 17:17:53 +02:00
amai2012
87bf09c0ae
#6751 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-03 11:39:30 +02:00
amai2012
ed5a4127e8
#6749 segmentation fault (invalid code) in Tokenizer::copyTokens. #6750 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-03 10:39:19 +02:00
amai2012
d36c84553f
#6748 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw error from now (member-function) Tokenizer::processFunc
2015-06-03 08:59:38 +02:00
Alexander Mai
d86ac9e3ed
#6747 segmentation fault (invalid code) in Token::isAttributeConstructor
2015-06-02 22:26:17 +02:00
Alexander Mai
09f2cff519
#6746 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-06-02 21:52:08 +02:00
Alexander Mai
6e1b5a0a53
#6744 segmentation fault (invalid code) in Tokenizer::simplifyPointerToStandardType. #6745 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-06-02 21:20:41 +02:00
Alexander Mai
454d4573b4
#6742 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix in Type::initBaseInfo()
2015-06-02 20:15:21 +02:00
Alexander Mai
f348c8eebe
#6741 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-02 20:09:12 +02:00
Alexander Mai
7fc9930b38
#6740 segmentation fault (invalid code) in Tokenizer::simplifyFunctionPointers. Throw syntaxError instead
2015-06-02 19:48:20 +02:00
Alexander Mai
a3bdd90df5
#6739 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix segfault in the specified method
2015-06-02 19:40:20 +02:00
Alexander Mai
be3690920a
#6738 Avoid segfault on garbage code in Tokenizer::simplifyTypedef()
2015-06-02 19:07:26 +02:00
amai2012
7895f1c2bb
#6737 Avoid segfault on garbage code inside Type::initBaseInfo. Disable test TestGarbage::garbageCode58() for #6732 since it triggers memory corruption still
2015-06-02 18:28:43 +02:00
Martin Ettl
0a148a9433
Running astyle, no functional changes.
2015-06-01 22:09:56 +02:00
amai2012
4b2fb4b76c
#6735 , #6735 Fix segfault on garbage code
...
Throw syntax error instead
2015-06-01 21:47:06 +02:00
Daniel Marjamäki
4bde4d5a4a
updated style messages
2015-06-01 21:22:47 +02:00
Alexander Mai
fb2bd978ad
#6732 segmentation fault (invalid code) in Tokenizer::simplifyEmptyNamespaces. Add testcase, segfault seems to have been fixed by previous commit. Run astyle
2015-06-01 13:46:13 +02:00
amai2012
b81e82d462
#6733 segmentation fault (invalid code) in Tokenizer::simplifyAddBracesPair
...
Avoid access to NULL-token by throwing an InternalError
2015-06-01 13:27:32 +02:00
Frank Zingsheim
6857dbe864
#6729 Simplification reference to constants.
2015-06-01 10:00:03 +02:00
Simon Martin
519bd7007a
Ticket #6588 : Properly detect whether the condition in a ternary operator is constant on C input.
2015-05-31 22:40:13 +02:00
Simon Martin
85b47636dc
Simplify known variableswhen they are at the end of a statement.
2015-05-30 23:34:50 +02:00
orbitcowboy
9c6ce2b06b
Merge pull request #605 from simartin/no_space_in_decl
...
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers
2015-05-30 21:22:14 +02:00
Simon Martin
c73876b3a8
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers.
2015-05-30 21:00:41 +02:00
Simon Martin
98e6dca4f2
Ticket #6713 : Properly detect ternary operator in valueFlowForward.
2015-05-30 20:55:36 +02:00
Alexander Mai
ddc80246c2
#6724 segmentation fault (invalid code) Token::isAttributeConstructor. Local fix to avoid access to NULL-token
2015-05-30 19:15:53 +02:00
Alexander Mai
4050d56169
#6722 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-05-29 21:44:00 +02:00
Martin Ettl
d5d6d7fbb8
Running astyle, no functional changes.
2015-05-29 20:20:05 +02:00
amai2012
5b347c537b
Fix #6720 and #6721 (Crashes on garbage code)
...
Local fixes to avoid access to NULL-token
2015-05-29 19:30:55 +02:00
Martin Ettl
9236ea4a20
Running astyle, no functional changes.
2015-05-29 19:15:41 +02:00
amai2012
e41beb4f8d
Fix #6718 and #6719 (crashes on garbage code).
...
Local fixes avoiding access to NULL-token. Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai
098391ee32
#6715 segmentation fault (invalid code) in TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates. Harden TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-28 21:38:20 +02:00
Alexander Mai
8adff0a31b
#6712 segmentation fault (invalid code) in CheckExceptionSafety::checkRethrowCopy. Local fix to avoid accessing NULL-token
2015-05-28 21:12:02 +02:00
Alexander Mai
133d8f9a91
#6706 segmentation fault (invalid code) in tokenlist::compilePrecedence3. Local fix to prevent acess to NULL-token
2015-05-27 21:39:31 +02:00
Alexander Mai
94d376e228
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-05-27 21:13:18 +02:00
Alexander Mai
e498f8493e
#6705 segmentation fault (invalid code) in CheckVaarg::va_list_usage. Local fix i nchecker preventing SIGSEGV on NULL-token
2015-05-27 21:12:33 +02:00
Daniel Marjamäki
22c608dd2c
Reverted fix for #6710 . It didnt work as I wanted.
2015-05-27 20:50:03 +02:00
Daniel Marjamäki
0836bf3d33
astyle formatting
2015-05-27 20:26:26 +02:00
Daniel Marjamäki
152ea116fa
Fixed #6710 (valueFlowBeforeCondition: function call in loop seems to cause FN)
2015-05-27 20:25:58 +02:00
Simon Martin
50e5595845
Ticket #6708 : Check that a function name is not a reserved keyword in SymbolDatabase::isFunction instead of later.
2015-05-26 00:28:08 +02:00
amai2012
729b240d9c
Refactoring (compiler warnings and a typo)
2015-05-25 23:15:59 +02:00
Alexander Mai
d4550c763d
Exit code shall indicate that an internal error (syntax error) has been found. Add some const. Run astyle
2015-05-25 21:15:55 +02:00
amai2012
f1c4cc6d55
Merge pull request #598 from simartin/useless_str_check
...
Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify
2015-05-25 19:13:33 +02:00
Daniel Marjamäki
a8d7897471
Fixed travis failure
2015-05-25 18:19:40 +02:00
Daniel Marjamäki
a9db06c641
longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used.
2015-05-25 18:06:20 +02:00
Daniel Marjamäki
c0b33d2fef
Fixed #6707 (new check: possible truncation when assigning int result to long)
2015-05-25 10:02:17 +02:00
Alexander Mai
e28e9be82f
Add TODO testcase for #5738 . Refactoring: add some const
2015-05-25 08:20:14 +02:00
Daniel Marjamäki
eb0db322eb
Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction)
2015-05-24 17:02:00 +02:00
Simon Martin
c58fab07d6
Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify.
2015-05-24 13:13:46 +02:00
Alexander Mai
7f15873759
Refactoring in tokenize.cpp: Fix cppcheck warning, add some const, fix typo from previous refactoring
2015-05-24 11:43:46 +02:00
Alexander Mai
7002f9df35
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-05-24 09:43:52 +02:00
Alexander Mai
394160184a
Refactoring: Replace complex if/else cascade by search in a container. Remove redundant plain arrays (in favour of container)
2015-05-24 09:43:17 +02:00
Simon Martin
26f244e638
Ticket #6704 : Tighten pattern skipping base class declarations and fix crash upon garbage code.
2015-05-24 08:16:34 +02:00
Simon Martin
898ba783bf
Ticket #6703 : Rewrite pattern in SymbolDatabase to avoid crash upon garbage code.
2015-05-23 23:18:59 +02:00
Alexander Mai
7416d6add9
Another fix for handling of final/override specifiers in Tokenizer::simplifyKeyword() including a testcase. Ran astyle
2015-05-23 20:51:15 +02:00
amai2012
7c23f4e611
Merge pull request #596 from simartin/ticket_6620-6685
...
Ticket #6620 , #6685 : Reserved keywords cannot be function names.
2015-05-23 13:47:07 +02:00
Alexander Mai
e8d84bc6b4
#6700 const vs non-const inside assert() statement. Function matching in symboldatabase did not honor const'ness of a class instance variable
2015-05-23 11:56:11 +02:00
Simon Martin
67eab0cd7c
Ticket #6620 , #6685 : Reserved keywords cannot be function names.
2015-05-23 11:29:58 +02:00
Alexander Mai
f0bc300198
#6510 False positive performance warning for std::list::size(). Fix this and other similar false positives. Refactoring of Variable::isStlType(), use fail-safe std::set instead of plain array. Run astyle
2015-05-17 20:02:41 +02:00
amai2012
20842fb1fc
#6690 override and final qualifiers plus less than operator results in a syntax error
...
Tokenizer::simplifyKeyword() is now able to handle all combinations out
of const|final|override
2015-05-17 13:02:13 +02:00
PKEuS
3ce4e68ca6
Refactorization: Make use of do-loops to avoid redundant Token::Match() calls
2015-05-13 13:40:40 +02:00
PKEuS
b946b74e09
Fixed crash #6686
2015-05-13 13:02:33 +02:00
PKEuS
4f00189ee1
Fixed crash #6684
2015-05-12 14:00:43 +02:00
PKEuS
1b6e4589da
Implemented array size calculation for n-dimensional arrays with arbitrary dereferencing ( #6657 )
2015-05-11 17:30:11 +02:00
PKEuS
33277c6110
Fixed false positive #6679 , fixed unit test for #6663 .
2015-05-11 13:10:11 +02:00
PKEuS
d5302953c7
Merge pull request #594 from simartin/ticket_6680
...
Ticket #6680 : Members can be initialized by operator>>.
2015-05-10 22:53:26 +02:00
PKEuS
8bbf8f1b50
Merge pull request #593 from simartin/ticket_6675
...
Ticket #6675 : Fixed pattern detecting C++ 11 delegated constructors.
2015-05-10 22:50:49 +02:00
PKEuS
f8d8856d09
Merge pull request #592 from simartin/ticket_6666
...
Ticket #6666 : Don't crash upon garbage code in CheckLeakAutoVar::checkScope
2015-05-10 22:49:25 +02:00
Simon Martin
da302b3912
Ticket #6680 : Members can be initialized by operator>>.
2015-05-10 14:27:15 +02:00
PKEuS
77c5381612
Support C++14 [[deprecated]]
2015-05-10 12:36:28 +02:00
Simon Martin
27e88fdc47
Ticket #6666 : Don't crash upon garbage code in CheckLeakAutoVar::checkScope.
2015-05-10 11:35:33 +02:00
Simon Martin
25aff001e0
Ticket #6675 : Fixed pattern detecting C++ 11 delegated constructors.
2015-05-10 11:27:47 +02:00
Daniel Marjamäki
075b07fb6c
stringLiteralWrite: only check in function scopes
2015-05-10 10:34:13 +02:00
Alexander Mai
96891dface
#6276 clang: -fsanitize=integer warnings. Fix remaining issues in preprocessor.cpp.
2015-05-09 19:26:31 +02:00
PKEuS
22fbc18fb7
Fixed false positive for *a++ in for-loop condition
...
Moved unit test to testgarbage.cpp
2015-05-07 20:34:57 +02:00
Alexander Mai
1c5e9e47c5
#6671 false positive: incorrect sizeofwithsilentarraypointer with reference to array.
2015-05-06 07:38:26 +02:00
Alexander Mai
6f96634759
#6276 clang: -fsanitize=integer warnings. Fix unwanted integer overflow in TemplateSimplifier::useDefaultArgumentValues() and Tokenizer::simplifyQtSignalsSlots()
2015-05-03 15:21:58 +02:00
Daniel Marjamäki
71cb8e9f64
Fixed --errorlist output for new checker stringLiteralWrite
2015-05-03 15:02:34 +02:00
Daniel Marjamäki
baa1ae079d
New check: negative size in array declaration. Ticket #1760
2015-05-03 15:00:47 +02:00
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
PKEuS
5f31242ee8
CheckOther::checkRedundantAssignment(): Bail out on inline assembly ( #6525 )
2015-02-22 12:03:53 +01:00
PKEuS
f04070940e
Fixed setVarId on ternary operator in initialization list
2015-02-22 11:57:46 +01:00
PKEuS
bae95b4560
Fixed noise in CheckOther::checkLibraryMatchFunctions().
2015-02-21 12:39:02 +01:00
PKEuS
e02caea025
Fixed C&P-mistake in comment
2015-02-21 12:39:02 +01:00
Dmitry-Me
19d05979ee
Remove C4189 in release builds
2015-02-20 11:00:34 +03:00
Dmitry-Me
158a2acc41
Resolve CID 1037075
2015-02-19 17:16:38 +03:00
PKEuS
6227abac73
Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings
2015-02-18 21:19:36 +01:00
Alexander Mai
6a7605271a
Fix compiler warning. Add interfaces of POSIX passwd.h and pwd.h to posix.cfg
2015-02-18 20:56:44 +01:00
Daniel Marjamäki
e251a99817
AST: fix handling of sizeof. ticket #6515
2015-02-18 19:56:13 +01:00
Daniel Marjamäki
b1e9d9b86f
Coverity CID 1270450: Removed redundant conditions
2015-02-17 19:32:59 +01:00
Alexander Mai
0a6babea74
#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
2015-02-16 22:19:51 +01:00
Daniel Marjamäki
42b40b0c85
Merge pull request #525 from Dmitry-Me/moreDoubleSlashCases
...
Handles double slashes close to end of path, more tests
2015-02-16 18:02:51 +01:00
Dmitry-Me
f0e0201c2d
Better handle double slashes, more tests
2015-02-16 13:11:13 +03:00
Dmitry-Me
56747e4af9
Reorder checks
2015-02-16 12:11:13 +03:00
Simon Martin
c4c46be972
Revert fix for #6181 , that caused #6354 and #6414 .
2015-02-14 12:29:05 +01:00
Luis Díaz Más
22424ba54a
Add CMake files
2015-02-13 19:00:14 +01:00
Daniel Marjamäki
6afe2e9fdc
astyle formatting
2015-02-13 16:36:47 +01:00
Dmitry-Me
5674b3c49d
early break in loop for readability
2015-02-13 16:36:20 +01:00
Dmitry-Me
7961bba0da
Path: better handling of UNC paths
2015-02-13 16:32:45 +01:00
Daniel Marjamäki
2d21eb07ba
Cleaned up snprintf hardcoding in CheckBufferOverrun
2015-02-13 06:44:38 +01:00
Daniel Marjamäki
9aad4fa8ca
CheckBufferOverrun: Remove hardcoding for sprintf and rely on cfg configuration instead
2015-02-12 17:29:36 +01:00
amai2012
baba720e58
Merge pull request #518 from Dmitry-Me/removeRedundantCode
...
Remove completely redundant code
2015-02-11 17:17:15 +01:00
Daniel Marjamäki
a24cbc448a
CheckBufferOverrun: loop through all arguments in checkFunctionCall
2015-02-11 16:24:25 +01:00
Daniel Marjamäki
d9deabe2ce
TestBufferOverrun: clean up
2015-02-10 17:29:36 +01:00
Dmitry-Me
77aa385384
Remove completely redundant code
2015-02-10 13:52:04 +03:00
Dmitry-Me
dfd19233e9
Simplify loop logic
2015-02-09 14:40:17 +03:00
Dmitry-Me
6eacb4957c
Simplify ternary operators, use else-if to avoid extra comparison
2015-02-09 11:46:27 +03:00
Dmitry-Me
fd0155cacf
Reuse already known values
2015-02-09 10:23:36 +03:00
Daniel Marjamäki
8a1b8df1ba
ValueFlow: Improved handling of alias values in valueFlowForward
2015-02-08 19:20:05 +01:00
Daniel Marjamäki
1d873de67f
Fix testrunner
2015-02-07 19:44:33 +01:00
Daniel Marjamäki
62a5d88eb0
ValueFlow: Improved handling of strings
2015-02-07 18:14:22 +01:00
Matthias Krüger
dd70b6e0cd
fix internal message: [lib/valueflow.cpp:239]: (warning) Found simple pattern inside Token::Match() call: "} ;"
2015-02-07 12:51:17 +01:00
Daniel Marjamäki
29db3eb848
Fixed #5980 (ValueFlow: pointer cant be 0 below throw in switch)
2015-02-07 10:45:30 +01:00
Dmitry-Me
6f6f9f7754
Reorder checks, move declaration
2015-02-06 16:30:39 +03:00
Daniel Marjamäki
eec938dbad
Fixed #6249 (False positive: Incorrect detection of (assignment + comparison) inside for-clause)
2015-02-05 20:17:30 +01:00
Dmitry-Me
cc18b8d1bb
Merge overlapping patterns
2015-02-05 17:30:49 +03:00
Dmitry-Me
1f31dd749b
Break loop early
2015-02-04 10:47:58 +03:00
Robert Reif
323475393b
Symboldatabase: improved debug output
2015-02-04 06:08:41 +01:00
PKEuS
f1714110d0
Fixed crash if double constants are passed as default arguments ( #6494 )
2015-02-03 22:12:05 +01:00
Daniel Marjamäki
5888b65bd4
fixed --check-library information message
2015-02-03 17:50:32 +01:00
Dmitry-Me
5517c22524
Omit redundant token match
2015-02-03 15:01:09 +03:00
Dmitry-Me
c05e632baf
Cache and reuse value
2015-02-03 11:00:40 +03:00
Dmitry-Me
21fbc30d59
Calling a function using Class::func() syntax should not be simplified
2015-02-02 10:37:10 +03:00
PKEuS
9dfb864522
Fixed two nullpointer messages in cppcheck
2015-02-01 15:21:09 +01:00
PKEuS
451a277b18
Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
...
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
PKEuS
f78744ac30
Fixed AST generation if expression starts with ternary operator
2015-02-01 14:02:19 +01:00
Daniel Marjamäki
d6c94e3828
isOppositeCond: Fixed FN
2015-02-01 13:03:38 +01:00
Daniel Marjamäki
d091639080
Fixed #6482 (False positive multiCondition)
2015-02-01 12:58:06 +01:00
PKEuS
b74b94b1e6
Partially reverted previous commit - std::vetcor instance creation can't be avoided without generating lots of debug messages
2015-02-01 12:33:53 +01:00
PKEuS
58c3fdd063
Fixed crash on garbage code introduced recently, optimized code in valueFlowFunctionReturn.
2015-02-01 12:26:46 +01:00
PKEuS
a4cc4c3e3f
Refactorization: Use SymbolDatabase scope information in ValueFlow
2015-02-01 12:10:20 +01:00
PKEuS
54b6b8e571
Fixed false positive #6481
2015-01-31 20:34:06 +01:00
PKEuS
21cb0cfd60
Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072 )
2015-01-31 20:12:02 +01:00
PKEuS
1f97e3001b
Fixed calculation of array size ( #6487 )
2015-01-31 19:06:44 +01:00
PKEuS
ae4b86c231
Several improvements to CheckMemoryLeakNoVar::checkForUnusedReturnValue():
...
- Support user defined functions (solves TODO tests)
- Print message if return value is not stored properly (adapted message text, #6458 )
2015-01-31 17:28:03 +01:00
Daniel Marjamäki
73113c67e7
Fixed #6480 (False positive unreachableCode - member function exit called instead of ::exit())
2015-01-31 16:55:55 +01:00
PKEuS
789665dadf
Fixed #6455 : Show uninitvar even for const variables
2015-01-31 13:21:22 +01:00
PKEuS
27924d4ae2
Improved detection of array dimensions ( #6430 )
2015-01-31 13:12:06 +01:00
PKEuS
f771a79738
Removed obsolete internal check. The underlying but in Token::Match should be fixed since b4f0869a71
2015-01-31 12:56:54 +01:00
PKEuS
18b0e14590
Refactorizations: Fixed a pattern in checkbufferoverrun.cpp, simplified one in checkclass.cpp
2015-01-31 12:32:05 +01:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
PKEuS
33f5d27b53
Fixed varId0 message #6443 .
2015-01-31 10:33:32 +01:00
Daniel Marjamäki
57ec1aea91
Library: Don't rely on ast in isNotLibraryFunction since it's used in tokenizer
2015-01-31 10:24:10 +01:00
PKEuS
36841cfa41
Better support for stream operator in CheckAutoVariables::returnReference() ( #6423 )
2015-01-31 10:12:49 +01:00
PKEuS
3a1bd4a5ad
Fixed gcc shadowing warnings
2015-01-30 22:04:26 +01:00
PKEuS
dcc1362890
SymbolDatabase: Support std::array ( fixes #6401 )
2015-01-30 21:56:27 +01:00
PKEuS
03e44d4aa0
CheckMemoryLeakInFunction: Don't treat delete as delete operator for C code
...
Fixed GCC message in checkbufferoverrun.cpp
2015-01-30 20:55:53 +01:00
PKEuS
98e33a189f
Enhanced CheckBufferOverrun:
...
- Fixed bug in library: manual and existing libraries use "size", but library.cpp reads "sizeof" as podtype attribute
- Fixed a couple of bugs in handling unknown size in checkbufferoverrun.cpp, get size from library if available.
2015-01-30 20:27:48 +01:00
PKEuS
b69528eb80
Bailout in Token::getValueTokenDeadPointer() if reference is used ( #6399 )
2015-01-30 19:29:37 +01:00
PKEuS
0d151b45b5
Better support for funciton pointers in checkuninitvar.cpp ( #6404 )
2015-01-30 19:16:25 +01:00
PKEuS
80feb8697d
Fixed false positives #6473 and #6469
2015-01-29 21:26:06 +01:00
PKEuS
71379616e7
Fixed false positive #6467
2015-01-29 10:18:21 +01:00
PKEuS
9ada111045
Fixed false positive #6466
2015-01-29 09:50:48 +01:00
PKEuS
8225b12763
Fixed some cppcheck messages
2015-01-28 22:29:07 +01:00
PKEuS
3342ea4c54
CheckInternal: Complain about Token::Match pattern if %or% or %oror% is the only "complex" pattern
2015-01-28 19:48:36 +01:00
PKEuS
21bd1d080e
Refactorization: Rearranged some code in checkleakautovar.cpp
2015-01-28 19:44:59 +01:00
PKEuS
0488f45a5f
Removed standalone check CheckOther::checkDoubleFree(), integrated (most of) the functionality into CheckLeakAutoVar. Added support for new/delete to checkLeakAutoVar.
2015-01-28 17:38:43 +01:00
PKEuS
5c56e63996
Fixed false positive #6452 : Handle member functions in CheckIO::checkFileUsage()
2015-01-27 21:52:52 +01:00
PKEuS
e82d2b3c8d
Fixed false positive #6453 : Skip over inner class if checking outer function
2015-01-27 21:21:17 +01:00
Daniel Marjamäki
3285f85ebf
Fixed #6460 (Library: better function/type matching)
2015-01-27 17:55:18 +01:00
PKEuS
bfa16ec258
Set /LARGEADDRESSAWARE flag for Win32 builds
...
Idea from Kosta-Github (pull-request #501 )
2015-01-27 15:43:40 +01:00
Dmitry-Me
e7bb43fc6b
Cache and reuse token pointer
2015-01-27 10:23:58 +03:00
Dmitry-Me
c79bfdce2c
CheckClass: Better checking of what operator= returns
2015-01-24 11:18:33 +01:00
PKEuS
ee046af20c
Fixed false positives #6450 and #6451
2015-01-23 19:38:39 +01:00
PKEuS
da35a74589
Fixed false negative: Passing uninitialized variable to stream ( #4673 )
2015-01-22 22:56:41 +01:00
PKEuS
da5a04f071
Fixed recently introduced FP in checkuninitvar.cpp if address of variable is passed to a function
2015-01-22 21:22:02 +01:00
PKEuS
4c76f71499
Reactivated old uninitialized variable checker which I accidentially disabled in previous commit
2015-01-22 17:34:22 +01:00
PKEuS
f4d11a4209
Fixed false negatives on try and non-executable scopes in checkUninitVar, removed unnecessary function parameters
2015-01-22 13:55:19 +01:00
PKEuS
bdae9064ea
Support throw in checkleakautovar.cpp
2015-01-22 11:12:26 +01:00
PKEuS
331a6b66be
Fixed internal message
2015-01-22 10:53:53 +01:00
PKEuS
7c60fe4aef
Fixed crash introduced by last commit.
2015-01-22 10:51:06 +01:00
PKEuS
7364cc8040
Fixed false positive in fityk: operator new calling constructor
2015-01-22 10:37:31 +01:00
PKEuS
60b2b655df
Support new/delete in new uninitialized variable checking; realloc() requires an initialized first argument.
2015-01-21 23:46:52 +01:00
PKEuS
c3e47f7eaa
Fixed false positive in CheckUninitVar and internal message
2015-01-21 22:26:44 +01:00
PKEuS
94c3c45350
CheckUninitVar: Use function information from library, bailout for '?'
2015-01-21 22:02:25 +01:00
PKEuS
ecb9d87e42
Fixed false positive: Bailout in checkuninitvar.cpp if setjmp is found
2015-01-21 16:49:34 +01:00
PKEuS
5334aaa25f
Refactorization:
...
- Removed a few unit tests of old uninitialized variable checking expecting other results than same test for new checking
- A few tweaks to new uninitvar checking to improve results when run on tests for old check
- switched some (TODO) tests to new check if the TODO is fixed
2015-01-21 16:17:58 +01:00
PKEuS
d8e282fe76
Refactorization: Made checkUninitVar::isVariableUsage() non-static
2015-01-21 13:52:03 +01:00
PKEuS
346532d312
Fixed false positives in CheckUninitVar::checkStruct()
2015-01-21 13:11:48 +01:00
PKEuS
54de731cac
Refactorized CheckUninitVar::checkScope(), fixed false negative
2015-01-21 12:20:03 +01:00
PKEuS
5f36c7c914
Improved detection of Type::needInitialization:
...
- Implement shortcut for C code - all types need initialization there
- Break out of loop faster if we encounter a type that needs initialization (it is sufficient if one member needs initialization)
2015-01-21 10:34:58 +01:00
Samir Aguiar
141a071792
* Added Clang-related flag to gui.pro
...
* Updated external lib location with PWD variable
2015-01-20 19:20:00 +01:00
Thomas Jarosch
ec21134817
Fix false negatives for local suppressions
...
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.
When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.
The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00
orbitcowboy
5a8574cc05
tokenlist::createAst(); should not be const.
2015-01-20 11:22:22 +01:00
orbitcowboy
bf1565bd34
Fixed inconclusive warnings regarding const correctness.
2015-01-20 09:09:16 +01:00
Robert Reif
56dc0b02ef
Fixed #6432 (cppcheck fails to detect ctor - partial template specialization)
2015-01-19 16:15:11 +01:00
Robert Reif
3b8540fdc0
Fixed #6424 (false negative: Use of 'class Ns::C' silence Cppcheck)
2015-01-19 06:38:54 +01:00
Thomas Jarosch
a83fe0e268
Check "var" for null pointer before using it
...
Reported by covertey -> amai on IRC.
2015-01-18 13:02:58 +01:00
Thomas Jarosch
c0aceb893e
Replace custom code with Settings::isWindowsPlatform()
2015-01-18 12:43:43 +01:00
Thomas Jarosch
9a5260a43f
Only simplify Windows's DEBUG_NEW macro on Windows platform
2015-01-18 12:20:23 +01:00
Thomas Jarosch
cd4c297dce
Fix segfault in template simplifier
...
When something parsing the template syntax
went wrong, "tok2" was NULL and resulted
in deleting all remaining tokens. Whoops.
Triggered by gcc test suite:
gcc/testsuite/g++.dg/cpp0x/variadic87.C
Tracked down the source of the bug with
valgrind's "--track-origins=yes" switch.
2015-01-18 01:43:43 +01:00
Thomas Jarosch
58cb6cc116
Add new "style" check to catch redundant pointer operations
...
Doing "&*some_ptr_var" is redundant and might be the remainder
of a refactoring. Warnings for expanded macros are excluded though:
They are often used with and without pointers and
do something like this: "func(&(*macroarg))".
The new check is fully AST based and was given
strong false positive testing on a large code base.
2015-01-18 00:34:07 +01:00
Thomas Jarosch
2bcd675653
Verbose AST dump: Show if token is expanded from macro
...
I also added the token variable id, but that decreased
readability of the AST tree too much.
2015-01-17 23:20:52 +01:00
Thomas Jarosch
10fffbfce0
Use unsigned int for all flags
...
Frank Zingsheim reported: With the parameter 'flag_'
and the member variable '_flags' having the type 'int'
produces a lot of warings in clang:
"warning: implicit conversion changes signedness: 'int' to 'unsigned int'".
2015-01-17 16:46:05 +01:00
Thomas Jarosch
fd01cafb1b
Clean up redundant pointer operations
2015-01-17 16:29:50 +01:00
Thomas Jarosch
e6f042dadc
Multi process check: Sanitize error messages for illegal characters
...
before sending them across the pipe.
The deserializer died while deserializing
a string containing a binary zero.
2015-01-17 16:12:00 +01:00
Thomas Jarosch
36bcefc39d
Don't crash when the deserialization of an error message fails
...
Found while scanning the code of an
open source project related to onions.
2015-01-17 16:09:58 +01:00
Robert Reif
193645318b
Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later
2015-01-17 07:42:49 +01:00
Thomas Jarosch
08985bf68a
Throw exception in getVariableFromVarId() if called with out_of_range varId
...
That way we have a chance to catch code bugs at all.
2015-01-15 18:52:11 +01:00
Thomas Jarosch
1cc85bfce3
Add bounds check to getVariableFromVarId()
...
While poking around the memory leak check,
I managed to trigger an out-of-bounds access
in the symbol database.
Fix it by sanity checking the variable id
passed to getVariableFromVarId().
2015-01-14 23:00:38 +01:00
Thomas Jarosch
ef7f104335
Make sure we have a valid Variable pointer before dereferencing it
...
All other call sites check the pointer already.
2015-01-14 23:00:28 +01:00
Thomas Jarosch
c92d861b1e
Fix typo in "internal error" message
2015-01-12 23:09:17 +01:00
Robert Reif
68bb197bcb
Destructor detected as constructor resulting in false variable not initialized warnings
2015-01-12 06:11:22 +01:00
Thomas Jarosch
059f9d056c
Move to global variables to file scope
...
Putting them in the anonymous namespace
is the same effect as making them "static".
2015-01-11 12:37:11 +01:00
PKEuS
787cbcb02e
Accept unknown elements in Library files, but print a warning. This fixes backward compatibility of libraries with older cppcheck versions
2015-01-10 22:18:57 +01:00
PKEuS
fd2f93bb80
Two small refactorizations:
...
- Avoid leaving and entering again critical section without doing anything
- Use isPointer() in checkbufferoverrun.cpp instead of string comparison
2015-01-10 21:03:21 +01:00
PKEuS
d019b7f9a6
Fixed wrong condition in library.cpp
2015-01-10 20:51:14 +01:00
Aneesh Azhakesan S
fe5d2fc245
Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure))
2015-01-10 12:21:55 +01:00
Thomas Jarosch
332254e0af
Make patterns compilable (mini refactoring)
2015-01-09 23:43:45 +01:00
PKEuS
d110d715ba
Refactorization: Use Token::link() when stringifying template argument list in symboldatabase.cpp
2015-01-09 22:03:43 +01:00
PKEuS
4da314b2e4
Declared recently added helper functions as static
2015-01-09 21:40:50 +01:00
PKEuS
25cd3794ac
Refactorization: Simplified and unified SymbolDatabase printing
2015-01-09 21:35:16 +01:00
PKEuS
7452613479
Refactorization:
...
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
PKEuS
4d5bf28b33
Refactorization: Removed code for copying attributes from function declaration to implementation in symboldatabase as it is neither tested nor necessary
2015-01-09 19:46:04 +01:00
Robert Reif
6998c55680
Symboldatabase: function return token ( #6244 )
2015-01-09 16:08:34 +01:00
Thomas Jarosch
374af15bd4
Fix parsing linkage specifier from global function declaration
...
Our very own "tools/dmake.cpp" had a function declaration
featuring "static void foobar()" while the function implementation
did not have the 'static' keyword (which is perfectly legal code).
2015-01-09 00:38:25 +01:00
Daniel Marjamäki
2375f1c46d
CheckBufferOverrun: Fix FN when multifile checking is used.
2015-01-08 21:01:22 +01:00
Daniel Marjamäki
6a8293a8b7
Library: More strict matching of functions
2015-01-08 19:31:41 +01:00
Robert Reif
ba1c24ee65
Fixed #6422 (symbol database: put function flags into a single flag variable)
2015-01-08 05:45:31 +01:00
Thomas Jarosch
4248c94d87
Silence compiler warning about unused parameter
...
PKEuS should decide if we can drop the parameter altogether.
2015-01-07 16:30:30 +01:00
Thomas Jarosch
2cb2161c5d
Fix unmatched local suppression error message for "unusedFunction" ( #6228 )
...
This fixes a regression from commit
e35329aba3
(fix for #4946 )
2015-01-07 15:40:12 +01:00
orbitcowboy
cd98471398
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-01-07 08:30:17 +01:00
Thomas Jarosch
4bec2b58fd
Unused function check: Fix detection of func.usedOtherFile
...
Check if function is called from another file or not.
2015-01-07 11:29:37 +01:00
orbitcowboy
c07b07b8fe
Fixed #6415 - FP stringCompare memcmp(ptr, ptr+offset, length).
2015-01-07 08:30:05 +01:00
orbitcowboy
ba837a6f2d
Added support for strpbrk to std.cfg. Running astyle.
2015-01-07 02:34:41 +01:00
Daniel Marjamäki
8a6bb46958
Tokenizer: only print AST in debug output if --verbose is used
2015-01-07 06:46:04 +01:00
Daniel Marjamäki
b0cc46e98b
reverted 840b2fb0
, it caused FN. tweaked the Tokenizer::simplifyAssignmentBlock to fix the FP it caused.
2015-01-07 06:38:42 +01:00
Daniel Marjamäki
840b2fb035
Tokenizer: Removed simplification Tokenizer::simplifyAssignmentBlock. This fixes a fp in linux.
2015-01-06 20:44:58 +01:00
Daniel Marjamäki
a87fb96eaf
Uninitialized variables: fix fp when 'a=((b)=c)' is used
2015-01-06 18:03:40 +01:00
Daniel Marjamäki
88e7b55a2d
CheckSizeof: only report warnings when --enable=warning has been used
2015-01-06 15:20:42 +01:00
Daniel Marjamäki
1068e095e7
Fixed cppcheck warning about iterator post increment
2015-01-06 15:16:29 +01:00
Daniel Marjamäki
6c3b7c1d0e
CheckBufferOverrun: only report warnings when --enable=warning has been used
2015-01-06 15:14:15 +01:00
Daniel Marjamäki
228f5960fc
CheckIO: only report warnings when --enable=warning has been used
2015-01-06 15:08:25 +01:00
Daniel Marjamäki
eee9183406
ValueFlow: improved handling of conditional noreturn scope in valueFlowForward
2015-01-06 14:12:35 +01:00
Daniel Marjamäki
f2e5fbd30d
Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better.
2015-01-06 07:44:04 +01:00
Daniel Marjamäki
1f698ca493
ValueFlow: Fixed valueFlowForward, when condition is false and else-block returns dont set values below the else-code
2015-01-05 16:39:47 +01:00
Daniel Marjamäki
fe8d04e840
CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]'
2015-01-05 14:54:24 +01:00
Daniel Marjamäki
c5467766e2
ValueFlow: Fix for valueflow analysis after for loop
2015-01-05 14:00:12 +01:00
Daniel Marjamäki
a80101f277
CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it
2015-01-05 13:23:38 +01:00
Daniel Marjamäki
fb685f096a
CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?:
2015-01-05 10:01:04 +01:00
Thomas Jarosch
1ef1143609
Make local functions static
2015-01-05 01:25:49 +01:00
Daniel Marjamäki
d1927e3492
Removed Tokenizer::simplifyStructInit simplification.
2015-01-04 16:48:52 +01:00
PKEuS
432ff8fa7b
Fixed GCC warnings in checkstl.cpp
2015-01-04 14:32:20 +01:00
Daniel Marjamäki
7bafbfbd6e
Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux)
2015-01-04 13:50:54 +01:00
PKEuS
e06a4cdf00
Refactorized CheckStl::if_find():
...
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
Daniel Marjamäki
f94243f85e
CheckMemoryLeak: Fix fp for allocation function that returns success value
2015-01-04 11:46:26 +01:00
Daniel Marjamäki
b3c2ea2c4f
CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro
2015-01-04 11:13:20 +01:00
Zachary Blair
22bd20c94a
New check: Use make_shared/make_unique ( #5673 )
2015-01-04 11:07:53 +01:00
PKEuS
016e89e422
Refactorizations:
...
- Disabled some parts of setVarId() for C code.
- Fixed mistake in <contaier> documentation
2015-01-04 10:52:11 +01:00
Daniel Marjamäki
8dd569b9e1
Refactoring: Use AST in CheckUninitVar::isVariableUsage() to determine if & operator is address-of. This fixes FP in linux.
2015-01-04 09:23:24 +01:00
PKEuS
11fa185cae
Fixed crash on range-based for-loop
2015-01-03 22:36:39 +01:00
PKEuS
7ece58c3a0
CheckStl::stlOutOfBounds() now uses <container> information from Libraries
2015-01-03 22:18:33 +01:00
PKEuS
e39729ffcc
Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
...
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki
eb1c048d2a
Tokenizer: Fix wrong simplification when checking linux kernel
2015-01-03 21:35:03 +01:00
Daniel Marjamäki
014f8e3c71
Fixed #6396 (There are false negatives when --include is used)
2015-01-03 18:22:52 +01:00
PKEuS
267552779d
Improved check ( #6391 ): Detect identical code in both branches of ternary operator
2015-01-03 18:01:49 +01:00
PKEuS
bb9ce68354
Refactorization: Reduced chaos in CheckOther::classInfo()
2015-01-03 18:00:16 +01:00
PKEuS
9e46aabc03
Set version to 1.68.99/1.69 dev
2015-01-03 17:44:47 +01:00
Daniel Marjamäki
6793e96458
1.68: Set versions
2015-01-03 13:20:01 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
PKEuS
1355f49af7
Fixed false positive: Support assignments in CheckStl::if_find()
2015-01-03 11:29:13 +01:00
PKEuS
8885ac3eba
Fixed #6217 , refactorized CheckStl::if_find(): allow all comparison operators, use AST, fixed wrong unit tests
2015-01-03 11:07:11 +01:00
Martin Ettl
c8bb19567b
CheckString::checkAlwaysTrueOrFalseStringCompare: Added support for Microsofts string compare functions.
2015-01-02 15:33:55 +01:00
Martin Ettl
8f4f3ca063
CheckString::checkAlwaysTrueOrFalseStringCompare: Added support for string compare more functions.
2015-01-02 13:12:42 +01:00
Martin Ettl
465f74b3bb
Fixed #6398 - false negative: (warning) Unnecessary comparison of static strings.
2015-01-02 12:58:04 +01:00
Robert Reif
1aa3adbb46
Refactorization: Speedup function lookup in symboldatabase ( #6277 ) (Part 2)
2015-01-02 21:41:01 +01:00
PKEuS
417f42f732
Fixed #6096 : bool is an integral type, but there is no portability issue if a pointer is assigned to a bool.
2015-01-02 21:07:02 +01:00
PKEuS
274e1a838a
Fixed #5871 : Properly parse initialization list in setVarId() if constructor is declared as noexcept
2015-01-02 20:03:06 +01:00
Robert Reif
9a679d1720
Refactorization: Speedup function lookup in symboldatabase ( #6277 )
2015-01-02 16:11:21 +01:00
orbitcowboy
d53f2f583c
Fixed #6388 : Support strncasecmp
2015-01-02 14:04:55 +01:00
PKEuS
c4fd8919a2
Fixed #6014 : Added plausibility check before issuing null pointer messages on function calls defined in library
2015-01-02 13:35:39 +01:00
PKEuS
88990bac59
Fixed #6386 : Improved behaviour on unknown language (header file)
2015-01-02 12:32:23 +01:00
PKEuS
a3fbc5aee5
Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch()
2015-01-02 11:24:28 +01:00
Daniel Marjamäki
2831bbd420
ValueFlow: better handling of goto to avoid false positives
2015-01-01 14:29:49 +01:00
Alexander Mai
d2caf89706
#6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095 .
2014-12-31 18:19:10 +01:00
Daniel Marjamäki
5c2a2a5c22
Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects)
2014-12-31 15:14:22 +01:00
PKEuS
58f4660c94
Fixed #5223 : Bailout in valueFlowForLoop1() for complex conditions
...
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS
5dc45bd4ac
Fixed #5497 : Support designated initializers in array size detection
2014-12-30 19:23:01 +01:00
PKEuS
ec826a0e0e
Fixed #6022 : Support ++%var% in valueFlowForLoop1
...
Fixed TODO unit test: properly handle loops that are never executed
2014-12-30 18:50:22 +01:00
PKEuS
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
Thomas Jarosch
69b31a0743
Fix up extra whitespaces in match patterns
...
Detected by new internal check.
2014-12-30 14:53:43 +01:00
Thomas Jarosch
17b47f1ce0
New internal check: Catch extra whitespace in match patterns
...
Inspired by a recent commit from PKEuS.
2014-12-30 14:21:18 +01:00
Daniel Marjamäki
208761f0c3
Fixed #6361 (crash: CheckBufferOverrun)
2014-12-28 10:05:08 +01:00
PKEuS
8b59c39c42
Refactorization: Removed whitespaces at the end of Token::Match patterns
2014-12-27 11:09:54 +01:00
PKEuS
990d14f3e2
Fixed #6328 : Use isAttributeNoreturn() whereever we also check Library::isnoreturn().
2014-12-27 11:07:36 +01:00
Robert Reif
9e60f584d9
Fixed #6321 : Implemented function Token::swapWithNext().
2014-12-27 10:53:26 +01:00
Dmitry-Me
14f13afa0a
Don't care which type protected operator= returns
2014-12-26 15:38:22 +01:00
Daniel Marjamäki
6194a4eefd
Fixed #6357 (Improve check: pointer arithmetic 'p+x' overrun, conditional x)
2014-12-26 09:12:00 +01:00
Daniel Marjamäki
7ab12cea63
Improved pointer arithmetic message
2014-12-25 14:31:46 +01:00
Daniel Marjamäki
bc594d52c8
Fixed #6349 (Pointer arithmetic: clarify message)
2014-12-25 10:05:55 +01:00
Thomas Jarosch
26aa049724
Fix C++11 compat wrapper for clang
...
clang identifies itself as gcc 4.2.
The preprocessor macros can be dumped with:
clang++ -dM -E -x c /dev/null
2014-12-25 01:28:02 +01:00
Daniel Marjamäki
0c086cf247
Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro()
2014-12-24 21:47:37 +01:00
Daniel Marjamäki
7cfa54f0e0
Fixed #6353 (False positive: CheckBufferOverrun checking reassigned array function parameter)
2014-12-24 14:03:52 +01:00
Daniel Marjamäki
06803ee333
Refactoring Tokenizer::simplifyAttribute
2014-12-24 13:03:38 +01:00
Daniel Marjamäki
fb3f5a159d
Token: Added flag for attribute noreturn ( #6328 )
2014-12-24 12:50:51 +01:00
Daniel Marjamäki
90bd38a972
Renamed isCasted to isCast
2014-12-24 10:35:40 +01:00
Daniel Marjamäki
de1a91f30d
Incomplete statement: tweaked bailout for '(void*)0' using isCasted()
2014-12-23 18:19:33 +01:00
Daniel Marjamäki
1b2a23b3fe
Fixed #6350 (Tokenizer::simplifyCast: set Token::isCasted when cast is removed)
2014-12-23 16:16:14 +01:00
Daniel Marjamäki
e16a934fb3
CheckBufferOverrun: Added comment in code to clarify why severity is portability for pointerOutOfBounds message.
2014-12-22 15:41:46 +01:00
Thomas Jarosch
d5e10c18d3
checkUnreachableCode(): fix FP for statements that just hide compiler warnings about unused function arguments
...
Seen throughout the rockbox codebase.
2014-12-22 11:18:23 +01:00
Daniel Marjamäki
10ae551fef
CheckBufferOverrun: Use portability warning for pointer arithmetic UB. It can be used by intention and usually works as intended.
2014-12-22 10:56:17 +01:00
Thomas Jarosch
dca65ce3da
Fix FP if sizeof is used without parentheses on struct members
...
Right now we only support checking basic pointer types.
Pointers inside structs are not supported yet.
Consider the tokens "foo@1 . bar@2",
Token::Match( "sizeof ( %varid% )" ) won't match it.
Token::Match( "sizeof %varid%" ) did match it -> FP.
2014-12-22 09:44:08 +01:00
Daniel Marjamäki
93ac5a41cd
Fixed #6346 (pointer calculation overflow)
2014-12-22 09:38:00 +01:00
Daniel Marjamäki
293dc1efc7
Fixed #6327 (Unwanted constStatement on (void)0)
2014-12-21 13:42:21 +01:00
PKEuS
e03f49360f
Merge pull request #484 from simartin/ticket_6181
...
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-21 12:21:17 +01:00
Lauri Nurmi
d543a85510
Fix compilation with GCC 4.4.
...
It was broken by fe468ac142
.
2014-12-21 02:15:53 +02:00
Daniel Marjamäki
a95e5bff2b
Fixed #6344 (false positive: out of bounds access when array size is unknown)
2014-12-20 18:50:08 +01:00
Daniel Marjamäki
f24e1b82cf
astyle formatting
2014-12-20 18:47:40 +01:00
Daniel Marjamäki
b8371ebd87
Revert 2e45df3b
. Because there are FP.
2014-12-18 06:37:15 +01:00
Matthias Krüger
cc7f69da54
fix two internal warnings:
...
[lib/checkuninitvar.cpp:1668]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
[lib/checkuninitvar.cpp:1669]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2014-12-17 19:06:13 +01:00
orbitcowboy
2e45df3b72
Fixed #6341 : false negative uninitvar pattern "return foo ( %var%"
2014-12-17 17:43:31 +01:00
Daniel Marjamäki
a1537e1a6e
Fixed #6339 (false negative: array index out of bounds on allocated buffer using valueflow)
2014-12-17 16:23:48 +01:00
Simon Martin
4c7a8c5497
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-14 15:14:27 +01:00
PKEuS
010eb1c8cb
Merge pull request #483 from simartin/ticket_6172
...
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 17:01:25 +01:00
Simon Martin
859c6381cc
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 14:33:37 +01:00
Daniel Marjamäki
5490fad8c7
Fixed #5840 (False positive (inconclusive): Possible nullpointer dereference - use before for-loop over nested list)
2014-12-14 14:10:42 +01:00
Thomas Jarosch
2f1ba89567
Improve readability of Library::load()
...
by caching often used node names.
Also constify existing name caches.
2014-12-12 22:18:22 +01:00
PKEuS
ff5ede342b
Fixed #6266 : Support noexcept(false)
2014-12-09 23:53:50 +01:00
PKEuS
4d81945ac5
Fixed a couple of #6276 integer over/underflow issues
2014-12-09 23:28:22 +01:00
PKEuS
493ab541ab
Fixed #6291 and #6293 : Support :: in front of function name in checkUnusedFunctions
...
Simplified code in CheckUnusedFunctions
2014-12-09 22:04:51 +01:00
PKEuS
e9bc3b7acf
Fixed #6308 : Properly associate Function with Scope for destructors in SymbolDatabase
2014-12-09 21:36:09 +01:00
Alexander Mai
cef324435f
Remove dead code in CheckMemoryLeakInFunction::call_func() (Coverity CID 1257017)
2014-12-09 20:34:30 +01:00
Dmitry-Me
ff6604e289
Make expensive string manipulation depend on settings
2014-12-09 06:08:38 +01:00
Alexander Mai
ec2c4aa2e3
#6301 Unused shared lock variable. Add exception for std::shared_lock() to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes()
2014-12-07 15:32:09 +01:00
Daniel Marjamäki
64e6b5186d
astyle formatting
2014-12-05 06:41:47 +01:00
Alexander Mai
c2584aa635
#6303 crash in CheckBufferOverrun. Add check on loop variable in CheckBufferOverrun::checkScope().
2014-12-04 20:49:58 +01:00
Matthias Krüger
7a6cd54059
Fix [lib/tokenize.cpp:6184]: (warning) Found simple pattern inside Token::Match() call: ") {"
2014-12-04 11:11:47 +01:00
Daniel Marjamäki
e3892a95b5
Fixed #6290 (Tokenizer: Because 'and' is not simplified to '&&' there are false positives)
2014-12-03 16:32:05 +01:00
Dmitry-Me
7d259c073a
Cache and reuse value
2014-12-02 16:19:52 +03:00
Daniel Marjamäki
0b9d80c95d
Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis
2014-12-02 06:41:18 +01:00
Dmitry-Me
cf3f8c2f38
Refactoring: Replace names with underscores with camelCase names
2014-12-01 16:22:56 +01:00
Dmitry-Me
c0d2933ec7
Reorder checks to avoid redundant actions
2014-11-30 16:14:53 +03:00
Dmitry-Me
6482fefe3e
Cache and reuse previously computed value
2014-11-30 13:00:27 +01:00
Dmitry-Me
5e37275b2a
Code cleanup. Use 'isDelete' instead of token match
2014-11-28 17:50:23 +01:00
Dmitry-Me
828fdb6c47
Code cleanup. Omit redundant check.
2014-11-28 17:48:23 +01:00
Robert Reif
418c2e51a0
Fixed #3314 (cppcheck incorrectly reporting Syntax error.)
2014-11-28 17:44:36 +01:00
Robert Reif
0dad8b64e8
Fixed #6268 (False positive functionStatic (inconclusive) - nested namespaces)
2014-11-27 06:29:33 +01:00
Daniel Marjamäki
139414bd5c
astyle formatting
2014-11-26 16:13:57 +01:00
Daniel Marjamäki
465555e39d
Fixed memory leaks for non-solaris compilers.
2014-11-26 16:13:40 +01:00
amai2012
0913a51ccd
Merge pull request #469 from lasergnu/SEGV
...
Fix SEGV on Solaris x86
2014-11-25 17:01:00 +01:00
Dmitry-Me
f926958acb
Fix false positive about return type when there's =delete in operator= declaration
2014-11-25 15:52:52 +01:00