PKEuS
389d30fe44
Fixed crash on garbage code ( #7118 )
2015-11-09 11:21:07 +01:00
PKEuS
c7987ad11a
Refactorization: Removed redundant nullptr checks. The existence of the tokens is guaranteed by previous Token::Match() call
2015-11-09 11:12:32 +01:00
Daniel Marjamäki
5074c11b53
CheckBufferOverrun: Fixed FP when accessing string that contains '\0'. Refactoring address-of.
2015-11-09 10:30:39 +01:00
Daniel Marjamäki
8317369c91
Explicit constructors: don't warn for abstract classes unless C++11 is used.
2015-11-09 08:36:47 +01:00
Daniel Marjamäki
ef5be435c7
Fixed #7113 (False positive arrayIndexOutOfBounds - using pointer alias with cast)
2015-11-08 17:21:32 +01:00
Alexander Mai
5318970f1e
#7109 segmentation fault (invalid code) in TokenList::createAst
2015-11-08 15:09:39 +01:00
Daniel Marjamäki
fc564d779e
Fixed #7112 (crash: CheckBufferOverrun::checkGlobalAndLocalVariable (invalid code))
2015-11-08 14:21:12 +01:00
Daniel Marjamäki
37dbebb093
Fixed #7049 (valueflow: value is not known after case)
2015-11-08 14:08:47 +01:00
PKEuS
4ad246f56f
Merge pull request #703 from nablaa/hh-hxx-header
...
Treat *.hh and *.hxx files as C++ files
2015-11-08 13:52:56 +01:00
Alexander Mai
ab296fa93f
7111 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses
2015-11-08 13:45:55 +01:00
Daniel Marjamäki
48da1d5396
Refactoring CheckBufferOverrun
2015-11-08 12:39:08 +01:00
PKEuS
32f0cbb6ad
Fixed false positive eraseDereference with range-based for-loops ( #7106 )
2015-11-08 09:42:55 +01:00
Daniel Marjamäki
7d6e1974eb
Fixed #7104 (False positive arrayIndexOutOfBounds)
2015-11-08 09:30:23 +01:00
Miika-Petteri Matikainen
1d4e33e792
Treat *.hh and *.hxx files as C++ files
...
Previously they were erroneously detected as C files.
2015-11-08 09:43:06 +02:00
PKEuS
fdb596fa05
Do not set "pure" flag if function is declared as "= default" ( #7101 )
2015-11-07 22:21:50 +01:00
Daniel Marjamäki
35ed902e3f
Try to fix crash when using getMaxValue()
2015-11-07 19:59:48 +01:00
Daniel Marjamäki
32627dc558
try to fix internal errors detected by Travis
2015-11-07 19:47:30 +01:00
Daniel Marjamäki
9c7271a5e9
CheckBufferOverrun: The simplifyKnownVariables() has been reduced, use ValueFlow instead
2015-11-07 18:12:01 +01:00
Daniel Marjamäki
3655ce7222
Fix typo in match pattern
2015-11-07 16:06:37 +01:00
Daniel Marjamäki
f7a7a8a95c
Fixed #6934 (False positive returnLocalVariable - assigning local array to function argument)
2015-11-07 15:07:26 +01:00
Daniel Marjamäki
d0ab3aea70
CheckBufferOverrun: Minor fixes for strings
2015-11-07 15:05:56 +01:00
PKEuS
9a879fc828
Fixed false positives with pointerSize being shown even if no sizeof() is used ( #7100 ).
2015-11-07 13:19:06 +01:00
PKEuS
49f6231756
Fixed two issues in CheckSizeof::checkSizeofForPointerSize()
2015-11-07 09:35:30 +01:00
Alexander Mai
598809a834
Fix multi-threading by converting static member variables to instance variables
2015-11-06 22:49:02 +01:00
PKEuS
0ac89c8af2
Fixed internal warning
2015-11-06 22:21:39 +01:00
PKEuS
61b16909bd
Fixed false negative pointerSize with member variables.
...
Fixed wrong comment in testcppcheck.cpp
2015-11-06 21:48:56 +01:00
Aleksandr Pikalev
2d0ecc08c1
Check pointers for NULL before utilizing and do not check it later
2015-11-06 20:24:09 +01:00
PKEuS
7a90b763f6
Tokenizer::simplifyLabelsCaseDefault(): Do not insert ; between two cases.
2015-11-06 19:59:23 +01:00
PKEuS
95a0c0f14c
Limit the number of cases created by Tokenizer::simplifyCaseRange().
2015-11-06 19:21:56 +01:00
PKEuS
1fe1d7ea4a
Extended Tokenizer::simplifyCaseRange() to support also ranges of chars.
2015-11-06 18:46:43 +01:00
PKEuS
41b1b9d850
Support case ranges (gcc extension, #6490 )
2015-11-06 18:39:03 +01:00
PKEuS
2ac8da0497
Fixed #6548 also for noexcept
2015-11-06 18:00:59 +01:00
PKEuS
72bc6d1f33
Refactorization: Fixed VS warning about variable shadowing.
2015-11-06 17:35:08 +01:00
PKEuS
be36539ad7
Fixed AST generation for C++11-style initialization ( #6528 )
2015-11-06 17:34:26 +01:00
PKEuS
62bc827eb0
Fixed createLinks2() when inheriting from a template ( #6601 )
2015-11-06 10:44:37 +01:00
PKEuS
eb2b0fa0d0
Fixed wrongly detected unconditional scope with C++11-style initialization in SymbolDatabase ( #6581 )
2015-11-06 10:16:44 +01:00
PKEuS
eefea507b9
Use ValueFlow in CheckIO::checkWrongPrintfScanfArguments() ( #6563 )
2015-11-06 09:52:22 +01:00
Alexander Mai
3177d73fb0
#7089 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1. Refactor some functions to accept argument as refernce instead of pointer
2015-11-05 19:00:08 +01:00
PKEuS
83a816b109
Fixed crash on garbage code ( #7085 )
2015-11-04 10:26:55 +01:00
PKEuS
6c20f4b2a2
Fixed crash on garbage code ( #7090 )
2015-11-04 10:10:20 +01:00
PKEuS
8374e8414b
Fixed use-after-free in clang test suite introduced recently ( #7087 )
2015-11-03 19:24:19 +01:00
PKEuS
b97f9e576d
Fixed crash in clang test suite introduced by previous commit.
2015-11-02 22:53:05 +01:00
PKEuS
b049050792
Fixed wrong parsing of ^{}
2015-11-02 22:14:41 +01:00
PKEuS
4f565ba90f
Fixed crashs on garbage code ( #7082 )
2015-11-02 21:30:28 +01:00
PKEuS
23e6e5a568
Fixed crash on garbage code ( #7081 )
2015-10-31 18:11:56 +01:00
Miika-Petteri Matikainen
acd8a092f8
Make syntaxError suppressable ( fixes #5917 and #7076 )
...
syntaxErrors were not suppressable, because they were treated as
InternalErrors which were thrown and catched during the checking,
and normal suppression rules were not applied for those.
We fix this by calling the normal reportErr() function that does
suppression matching.
2015-10-28 20:53:35 +02:00
PKEuS
963008089d
Fixed false positive with range-based for-loop ( #7078 )
2015-10-28 16:37:46 +01:00
PKEuS
a0ff992c4a
Refactorization: Simplified Tokenizer::simplifyAddBracesToCommand() and Tokenizer::simplifyAddBracesPair()
2015-10-27 20:04:34 +01:00
PKEuS
4ee56d2306
Fixed simplifyAssignmentInFunctionCall for complex expressions ( #6927 )
2015-10-27 20:01:40 +01:00
PKEuS
7866990d04
Fixed false positive with range-based for-loop ( #7075 )
2015-10-27 14:47:18 +01:00
Daniel Marjamäki
bfd8a69e74
Fixed #6243 (False positive: uninitialized variable, looping with goto)
2015-10-27 12:40:52 +01:00
Daniel Marjamäki
4b0625c570
Fixed #6239 (Possible null pointer dereference after pointer is modified by a function template)
2015-10-27 12:33:46 +01:00
PKEuS
b775603e93
Revert "Removed bailout in case a file (without include guards) is included twice. ( #5455 )"
...
This reverts commit 34ec1112a9
.
2015-10-26 21:37:08 +01:00
PKEuS
24882fb53a
Fixed VarId accidentially assigned to case labels.
2015-10-26 21:24:53 +01:00
PKEuS
dfdc0f6b99
Support range-based for-loop in SymbolDatabase
2015-10-26 19:20:42 +01:00
PKEuS
5add1d8901
Set VarId in range-based for-loops
2015-10-26 19:03:23 +01:00
PKEuS
a5f577d179
Support range-based for-loop in CheckClass::checkConst() ( #5514 )
2015-10-26 18:48:01 +01:00
PKEuS
636bf75799
Fixed crash on garbage code ( #7074 )
2015-10-26 13:29:47 +01:00
PKEuS
34ec1112a9
Removed bailout in case a file (without include guards) is included twice. ( #5455 )
2015-10-26 12:17:29 +01:00
PKEuS
0370c66e41
Fixed broken function Token::getCharAt() ( #7073 )
2015-10-26 11:51:05 +01:00
PKEuS
297f2c78bd
Fixed false positives variableHidingTypedef ( #5624 , #6507 )
2015-10-26 10:06:52 +01:00
PKEuS
ee58587706
Fixed false positive unreachableCode when ternary operator is used ( #6664 )
2015-10-26 08:29:43 +01:00
PKEuS
f637b84192
Fixed various false positives with --check-library ( #6545 , #6630 )
2015-10-26 08:16:50 +01:00
amai2012
116c10c7d6
Merge pull request #700 from simartin/ticket_6998
...
Ticket #6998 : Properly handle "typedef unsigned T;" constructs.
2015-10-24 15:24:27 +02:00
Simon Martin
5d40a3ab66
Ticket #6998 : Properly handle "typedef unsigned T;" constructs.
2015-10-24 12:27:26 +02:00
PKEuS
e989d4b11b
Support C++11 array initialization in CheckUninitVar ( #7010 )
2015-10-24 12:06:40 +02:00
Daniel Marjamäki
fc2bf2ef08
Fixed #7065 (AST: More explicit handling of lambda functions, generate ast for ';new Fred;')
2015-10-20 23:55:29 +02:00
Alexander Mai
3b1d849476
Correct template syntax check which got introduced by an attempt fix #6865 . Disable test for #6865 , adjust some modified tests and add new regression tests
2015-10-19 20:03:33 +02:00
Daniel Marjamäki
6b9088de3f
Fixed #7057 (valueFlowAfterAssign doesn't terminate)
2015-10-19 19:36:46 +02:00
Daniel Marjamäki
b856ac51dd
Fixed #7064 (Tokenizer: Wrong simplification of 'a.public:')
2015-10-19 10:01:57 +02:00
Philipp Kloke
06c20252fa
Added dot at end of stringLiteralWrite message
2015-10-19 09:01:21 +02:00
Philipp Kloke
2a5206a444
Refactorization: Reordered conditions - simplematch is cheaper than findsimplematch
2015-10-19 09:01:21 +02:00
Philipp Kloke
a837cc48e0
Refactorization: Simplified code in tokenlist.cpp, token.cpp and testthreadexecutor.cpp
2015-10-19 09:01:20 +02:00
Daniel Marjamäki
5d12471caa
fix travis, remove unused variable
2015-10-18 17:19:44 +02:00
Alexander Mai
8667184f12
#7062 Remove unnecessaryQualification check
2015-10-18 17:00:09 +02:00
Daniel Marjamäki
9be284e80f
AST: proper operator precedence for c++11 initializer {} and ::
2015-10-18 16:58:15 +02:00
PKEuS
52be380ef0
Fixed fix for #7042 - support hexadecimal digits
2015-10-18 16:37:33 +02:00
Alexander Mai
7112725d38
Simplify code (repair travis build)
2015-10-18 16:04:49 +02:00
Alexander Mai
21efa992e3
#6865 TemplateSimplifier::expandTemplate doesn't terminate on invalid code. Add some another syntax check on templates to avoid problems later on.
2015-10-18 15:47:37 +02:00
Daniel Marjamäki
9bb2af1893
Fixed #7059 (AST: handle C++ initialization with {} better)
2015-10-18 13:43:39 +02:00
Daniel Marjamäki
b81b21a57b
Fixed #7051 (hang in ast code (failed to create a proper testcase))
2015-10-18 11:42:18 +02:00
Daniel Marjamäki
fe4fac7eb2
Fixed #7058 (Tokenizer::simplifyTypedef: wrong simplification of enum constant 'AB::A' if AB is a struct typedef)
2015-10-18 04:55:04 +02:00
Daniel Marjamäki
ec87b09d89
Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0')
2015-10-17 18:58:13 +02:00
Daniel Marjamäki
30af2fcd73
iscast: handle '(ulong)~0' better
2015-10-17 18:25:27 +02:00
Daniel Marjamäki
507727e07f
Fixed Travis
2015-10-17 17:15:19 +02:00
Daniel Marjamäki
c88297c971
Fixed #7054 (AST: handle C++ initialization with {} better)
2015-10-17 17:03:24 +02:00
Dmitry-Me
fa30ed5d15
Reduce variable lifetime, better name
2015-10-16 11:00:04 +03:00
PKEuS
c22833342c
Merge pull request #695 from Dmitry-Me/explicitContinue
...
Explicit continue instead of fall through with a check
2015-10-15 21:48:08 +02:00
Alexander Mai
8e3e981323
#7050 segmentation fault (invalid code) in isVariableChanged
2015-10-15 21:27:55 +02:00
Dmitry-Me
ae7a7d287e
Explicit continue instead of fall through with a check
2015-10-15 18:03:27 +03:00
Daniel Marjamäki
6cf25825de
Fixed #7030 (Tokenizer::simplifyTypedef: Label)
2015-10-15 16:56:22 +02:00
Dmitry-Me
64bdf03986
Remove repeated search, clearer code
2015-10-15 16:48:35 +03:00
PKEuS
46bfa62aad
Execute prepareTernaryOpForAST earlier ( #7048 )
2015-10-15 10:31:54 +02:00
Alexander Mai
600641c4c5
#7043 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl
2015-10-14 20:34:55 +02:00
PKEuS
d0cc97a4cf
Fixed wrong syntax error ( #7045 )
2015-10-14 16:01:48 +02:00
Dmitry-Me
f54f9a7d3e
Explicit continue, better variable name
2015-10-14 15:06:04 +03:00
PKEuS
a97f6f973f
Support C++14 digit separators ( #7042 )
2015-10-14 12:00:54 +02:00
Daniel Marjamäki
60f8982999
Fixed #7039 (ValueFlow: bitand calculation '16&15')
2015-10-14 10:44:04 +02:00
Daniel Marjamäki
a04e072976
Fixed #7040 (False positive syntaxError False positive syntaxError)
2015-10-13 20:31:17 +02:00
PKEuS
3971f8625f
Fixed false positive seekOnAppendedFile if FILE* is reused ( #6566 )
2015-10-13 15:32:13 +02:00
PKEuS
05b5275110
Improved AST:
...
- Fixed TODO for ternary operator. Add parantheses between ? and : where necessary as a preparation for createAst()
- Improved AST validation:
-- Better message for binary operator with only one operand
-- Ensure ? has : as second operand (#7035 )
2015-10-12 19:21:48 +02:00
Daniel Marjamäki
97326fce13
Fixed #6992 (argument name of function typedef conflicts with local variable name)
2015-10-12 10:15:02 +02:00
Daniel Marjamäki
141dd78b0e
Tokenizer: Added a define CPPCHECK2 that can be used to test cppcheck without various simplifications I want to get rid of in the long run
2015-10-12 09:19:35 +02:00
Daniel Marjamäki
7148ad4239
Tokenizer: Fix sloppy syntax error
2015-10-12 08:51:41 +02:00
Daniel Marjamäki
df67e0efb6
Tokenizer: Try to hide attributes for non-gcc and non-clang compilers
2015-10-12 08:50:52 +02:00
Daniel Marjamäki
6157fc69ac
Tokenizer: Added a simple AST verification
2015-10-12 08:34:12 +02:00
Daniel Marjamäki
8b8870cb5e
Added noreturn attributes for methods that throws
2015-10-12 08:33:53 +02:00
Daniel Marjamäki
2c7c6b3e38
CheckIO: Try to use ValueType more
2015-10-11 17:35:54 +02:00
Daniel Marjamäki
cba11e623e
Use ValueType in astIsIntegral()
2015-10-11 14:11:11 +02:00
Daniel Marjamäki
be7bca385d
avoid some fixes for noisy signedness warnings
2015-10-11 12:50:46 +02:00
Daniel Marjamäki
40fffddb83
avoid some fixes for noisy signedness warnings
2015-10-11 12:36:23 +02:00
Daniel Marjamäki
0aad8af9ae
avoid fix for noisy signedness warning
2015-10-11 12:22:37 +02:00
Daniel Marjamäki
ac9cb87e04
ValueType: Handle bit operations, sizeof better. Use ValueType in astIsFloat().
2015-10-11 12:20:40 +02:00
Daniel Marjamäki
5b082aa799
ValueType: struct member
2015-10-11 10:48:08 +02:00
Daniel Marjamäki
9738cc66eb
ValueType: function return type
2015-10-11 08:42:31 +02:00
Daniel Marjamäki
cf179f82b6
ValueType: Better handling of wide strings
2015-10-11 08:13:30 +02:00
Daniel Marjamäki
37d9a95ef1
CheckIO: Refactoring. Split out CheckIO::checkFormatString() from CheckIO::checkWrongPrintfScanfArguments().
2015-10-10 20:08:15 +02:00
Daniel Marjamäki
0849ad4707
ValueType: Better handling of const
2015-10-10 08:32:45 +02:00
Daniel Marjamäki
6545172d8c
Revert "Add a dynamic rule enable/disable system"
...
This reverts commit 231b486e49
.
There was regressions reported in tools/generate_and_run_more_tests.sh.
2015-10-09 21:56:19 +02:00
Albert Aribaud
231b486e49
Add a dynamic rule enable/disable system
2015-10-09 19:57:05 +02:00
PKEuS
2eb8492993
Fixed crash on garbage code #7034
2015-10-09 13:49:17 +02:00
PKEuS
7d624f2e21
Fixed crash on garbage code #7033
2015-10-09 13:06:52 +02:00
Daniel Marjamäki
6d256b01b6
CheckIO: Use ValueType::Type::LONGDOUBLE type also
2015-10-08 19:52:24 +02:00
Daniel Marjamäki
a500f6f703
Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better.
2015-10-08 19:50:10 +02:00
PKEuS
3645e3c16b
Fixed two TODO unit tests by delaying arraySize simpification until createLink2 is executed
2015-10-08 12:52:28 +02:00
Daniel Marjamäki
be72b7413a
ValueType: Handling of originalTypeName
2015-10-07 20:24:17 +02:00
Daniel Marjamäki
c461b58421
astyle formatting
...
[ci skip]
2015-10-07 19:50:50 +02:00
Daniel Marjamäki
604a9acb48
ValueType: Handling constness
2015-10-07 19:08:26 +02:00
PKEuS
b7f2f826a4
Refactorization: Removed some redundant code
2015-10-07 18:40:04 +02:00
Daniel Marjamäki
db31e22316
ValueType: Improved signedness
2015-10-07 18:10:48 +02:00
PKEuS
2e510c8733
Added missing include to valueflow.h
2015-10-07 14:42:10 +02:00
PKEuS
50ed47c725
Fixed crash on garbage code ( #7022 )
2015-10-07 13:52:06 +02:00
PKEuS
b634a76fcb
Added CPPCHECKLIB to two clases and reverted 30a942af0b
2015-10-07 13:38:34 +02:00
Daniel Marjamäki
f5d9ba9cf3
Rewrote the charvar checker. It now uses valueflow also to limit false negatives.
2015-10-06 17:30:51 +02:00
amai2012
88b3d90505
#7023 segmentation fault (invalid code) in astIsIntegral. Avoid crash, unfortunately there is no syntax error yet detected.
2015-10-06 11:21:31 +02:00
Matthias Krüger
e99b4319c9
astutils: remove unused functions isSignedChar and isChar.
2015-10-06 08:27:47 +02:00
Daniel Marjamäki
2034706033
AST: Use AST type in astIsSignedChar
2015-10-06 07:13:41 +02:00
Daniel Marjamäki
b77203a277
CheckIO: Handle AST pointer type better
2015-10-05 19:59:15 +02:00
Daniel Marjamäki
b9036c2ca8
AST types: Fix for 'long long' handling
2015-10-05 19:20:42 +02:00
Daniel Marjamäki
bc8f1b972e
CheckIO: Early return
2015-10-05 19:04:29 +02:00
Daniel Marjamäki
8f6bd7fd0d
Fixed #7014 (False positive for printf("%c", "hello"[0]))
2015-10-05 10:12:30 +02:00
Daniel Marjamäki
f35c24d4af
SymbolDatabase: Better handling of valuetypes in AST
2015-10-04 23:27:58 +02:00
Daniel Marjamäki
30a942af0b
VS: Attempt to fix build problem with VS
2015-10-04 22:58:00 +02:00
Daniel Marjamäki
399cd0c07b
SymbolDatabase: Refactoring AST type information
2015-10-04 20:32:16 +02:00
Daniel Marjamäki
9b253612ca
SymbolDatabase: Add type information in AST
2015-10-04 19:42:58 +02:00
Frank Zingsheim
3bc21b8138
Fixed #6996 (ValueFlow: known and possible values)
2015-10-04 10:33:43 +02:00
Daniel Marjamäki
f5bd00f153
Library: return true from Library::isnullargbad() for format string arguments. Related with #7012 .
2015-10-03 20:51:45 +02:00
Daniel Marjamäki
28e3c266b3
Fixed #7012 (False positive uninitvar - first argument to snprintf)
2015-10-03 18:35:16 +02:00
Daniel Marjamäki
a574fda8a9
Fixed #6935 (Wrong duplicate expression)
2015-10-03 14:56:24 +02:00
Alexander Mai
27f72d7ae0
#7020 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #7021 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-10-03 10:47:23 +02:00
Simon Martin
0f7e20c11d
Ticket #7017 : Properly interpret operator= return type for template classes in CheckClass::operatorEq.
2015-10-02 23:23:44 +02:00
amai2012
fde59242bb
#7018 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-10-02 15:33:23 +02:00
PKEuS
e6467703b2
Support cast to ** in Tokenizer::simplifyCasts() ( #7005 )
2015-09-28 16:08:14 +02:00
PKEuS
590f1f1d66
Fixed handling of __asm...__endasm ( #6970 )
2015-09-28 15:43:48 +02:00
Thomas Otto
7ba69cfd0a
sizeofCalculation: skip if void-casted inside a macro ( #6888 )
2015-09-28 14:33:29 +02:00
Daniel Marjamäki
bd243a4748
Fixed #6903 (ValueFlow: Fix FP in ?:)
2015-09-27 13:29:28 +02:00
Dmitry-Me
6304a4dddb
Fix FP for members of temporaries
2015-09-25 13:57:11 +03:00
Dmitry-Me
da15efb3f6
Fix FN for distinct structs with identical members
2015-09-24 18:29:08 +02:00
Alexander Mai
c27fc31fcf
#6997 segmentation fault (invalid code) in CheckUninitVar::checkIfForWhileHead. Detect invalid syntax.
2015-09-23 10:33:55 +02:00
orbitcowboy
fc0786acb0
Merge pull request #686 from Dmitry-Me/omitUnneededActions6
...
Continue early, reuse pattern, better names
2015-09-22 21:31:47 +02:00
Dmitry-Me
0b991f5560
Tell if it's struct or union
2015-09-22 17:38:23 +03:00
Dmitry-Me
ce783483d1
Continue early, reuse pattern, better names
2015-09-22 16:38:49 +03:00
Martin Ettl
8936985c5c
#7001 : Fixed templatesimplifier.cpp: Remove double include.
2015-09-18 12:20:41 +02:00
orbitcowboy
c285b75611
Merge pull request #685 from Dmitry-Me/useTempVariables
...
Use temp variables, better variable names
2015-09-16 16:30:25 +02:00
Daniel Marjamäki
305760f143
Uninitialized variables: Fix FP for struct array
2015-09-16 14:42:55 +02:00
Dmitry-Me
074639548b
Use temp variables, better variable names
2015-09-16 15:31:13 +03:00
Dmitry-Me
85d47e25e4
Move variable declaration to where it's first used
2015-09-16 13:15:07 +03:00
Dmitry-Me
aa60358458
Temp variables, better names
2015-09-15 15:34:12 +03:00
Daniel Marjamäki
af233efcce
Uninitialized variables: tweaked checking of arrays / allocated buffers
2015-09-14 09:03:21 +02:00
PKEuS
6647976d80
Simplified a few Token::Match calls
2015-09-14 08:57:23 +02:00
Matthias Krüger
2ddd4c7197
fix [lib/checkuninitvar.cpp:836]: (warning) Found simple pattern inside Token::Match() call: "&"
2015-09-13 17:54:53 +02:00
Daniel Marjamäki
ab38ab800e
CheckUninitVar: don't rely on Tokenizer::simplifyKnownVar() to simplify references
2015-09-13 17:31:45 +02:00
Daniel Marjamäki
ad007ca2d7
Uninitialized variables: better checking of arrays
2015-09-13 16:32:16 +02:00
Frank Zingsheim
1fd9ba0cc4
Fixed #6988 (incorrect nullPointer error for string)
2015-09-13 10:53:05 +02:00
Daniel Marjamäki
8cee96a179
ValueFlow: Refactor 'ProgramMemory' so it can handle token * values also and not just int values. I believe this refactoring is needed before #6973 can be fixed.
2015-09-12 19:49:02 +02:00
Dmitry-Me
773ee8c32a
Better variable name, explicit no-op
2015-09-11 17:26:33 +03:00
amai2012
7dadd9f3ca
Merge pull request #677 from Dmitry-Me/simplifySearchReplace
...
Simplify overengineered search-replace code
2015-09-11 16:02:39 +07:00
amai2012
210d8d1957
Merge pull request #676 from Dmitry-Me/reuseCachedValue
...
Reuse cached value
2015-09-11 15:58:45 +07:00
Dmitry-Me
70d98c7176
Get rid of set object
2015-09-10 17:59:20 +03:00
Dmitry-Me
78ed37ca86
Explicit continue, break loop early
2015-09-10 12:54:35 +03:00
Dmitry-Me
b2cd0aabf5
Simplify overengineered search-replace code
2015-09-09 18:43:32 +03:00
PKEuS
fbbdfa85ca
Revert "Fixed false negative #5815 "
...
This reverts commit dc6c278d83
.
2015-09-09 14:46:47 +02:00
Dmitry-Me
fdfddde496
Reuse cached value
2015-09-09 15:29:06 +03:00
Daniel Marjamäki
47f64df8aa
minor refactoring
2015-09-09 10:08:37 +02:00
Matthias Krüger
49e2573b5c
fix -Wodr warning/violation putting struct 'VarInfo' into anonyous namespace
...
Was:
lib/checkclass.cpp:1994:8: warning: type ‘struct VarInfo’ violates one definition rule [-Wodr]
struct VarInfo {
^
lib/checkleakautovar.h:32:7: note: a different type is defined in another translation unit
class CPPCHECKLIB VarInfo {
^
lib/checkclass.cpp:1998:21: note: the first difference of corresponding definitions is field ‘var’
const Variable *var;
^
lib/checkleakautovar.h:40:39: note: a field with different name is defined in another translation unit
std::map<unsigned int, AllocInfo> alloctype;
2015-09-08 16:57:28 +02:00
orbitcowboy
7d229f082c
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-08 11:45:13 +02:00
Dmitry-Me
662e3c8b8c
Omit unneeded match checks
2015-09-07 18:35:15 +03:00
Daniel Marjamäki
d88dc3ed3e
Reverted 00c54df07c
(don't remove enum declarations) because it caused unexpected false positives
2015-09-06 18:37:22 +02:00
Daniel Marjamäki
00c54df07c
Tokenizer: Don't remove enum declarations
2015-09-06 17:44:49 +02:00
PKEuS
5c348890b2
Preserve varId in simplifyArrayAccessSyntax ( #6523 )
2015-09-05 13:14:08 +02:00
Philipp Kloke
687bde8af5
Set version to 1.70.99/1.71 dev
2015-09-04 21:10:05 +02:00
Daniel Marjamäki
dafba604ff
1.70: Set versions
2015-09-04 19:36:34 +02:00
Dmitry-Me
e9cb3d8c97
Consistent variable name
2015-09-04 17:00:44 +03:00
orbitcowboy
c1120c1df4
Merge pull request #672 from Dmitry-Me/fixSpelling
...
Fix spelling
2015-09-04 15:39:03 +02:00
Dmitry-Me
e377a2e9b2
Fix spelling
2015-09-04 16:12:40 +03:00
Dmitry-Me
31014fe334
Omit unneded action
2015-09-04 16:06:20 +03:00
PKEuS
1aa958d60c
Updated VS solution with VS2015 as default. Added flags /Zc:inline and /Zc:throwingNew.
2015-09-04 14:30:54 +02:00
orbitcowboy
117bdef19c
Merge pull request #668 from Dmitry-Me/makeChecksMutuallyExclusive
...
Treat checks as mutually exclusive
2015-09-04 11:17:42 +02:00
orbitcowboy
d97d5d8691
Merge pull request #669 from Dmitry-Me/fixIncompleteComment
...
Comment omitted one of the items listed
2015-09-04 11:16:33 +02:00
Dmitry-Me
a87990901a
Better variable name
2015-09-04 11:38:46 +03:00
Dmitry-Me
e082264677
Comment omitted one of the items listed
2015-09-04 11:19:03 +03:00
Dmitry-Me
cd4f3cf8db
Treat checks as mutually exclusive
2015-09-04 10:42:26 +03:00
PKEuS
b49c5d7193
Merge pull request #665 from simartin/todo_condition
...
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 22:53:33 +02:00
Simon Martin
f273323cd0
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 21:07:03 +02:00
Dmitry-Me
7287b1a251
Avoid unneeded match checks
2015-09-03 18:30:05 +03:00
Dmitry-Me
0f073ad27e
Quick check to omit useless heavy matches
2015-09-03 13:09:57 +03:00
Dmitry-Me
cdf1521258
Further fix search replace
2015-09-02 17:06:19 +03:00
Dmitry-Me
139ead15ef
Merge overlapping patterns
2015-09-01 16:17:17 +03:00
amai2012
e683d31e71
Re-enable okenizer::removeMacroInClassDef for C code
2015-09-01 07:10:12 +02:00
PKEuS
04209c08cf
Merge pull request #644 from Dmitry-Me/fixSearchReplace
...
Fix search-replace
2015-08-31 21:14:58 +02:00
Dmitry-Me
969b1bfbe9
Fix search-replace
2015-08-31 17:44:33 +03:00
PKEuS
dc6c278d83
Fixed false negative #5815
2015-08-31 14:12:19 +02:00
Alexander Mai
b90b751b54
Cure some doxygen warnings
2015-08-30 20:12:02 +02:00
PKEuS
c5a8ecb6f9
New check: Detect unused 'goto' labels ( #5124 )
2015-08-30 16:45:47 +02:00
PKEuS
f12f16cb4a
Handle anonymous structs (which can appear inside unions) like anonymous unions ( #2039 )
2015-08-30 15:41:54 +02:00
Philipp Kloke
56698dd844
Fixed #6919 : Support initializer list in duplicateEnumError check
2015-08-29 22:20:09 +02:00
PKEuS
d7853b9963
Fixed simplification of fma(a, b, c) ( #6958 )
2015-08-29 20:52:03 +02:00
Alexander Mai
8d2c4453ad
Small optimizations for C code in Tokenizer. Add some regression tests for recently fixed results
2015-08-29 19:00:09 +02:00
Daniel Marjamäki
e31ee26b6c
Merge pull request #662 from simartin/ticket_6959
...
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors
2015-08-29 13:22:10 +02:00
Daniel Marjamäki
6ddd0a953f
Fixed #6917 (False positive uninitvar - unused array declaration and ternary expression)
2015-08-29 13:19:28 +02:00
Simon Martin
b4b636b6a2
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-29 13:11:00 +02:00
PKEuS
70368a2e3a
Made ctor of triplet explicit, because cppcheck demands it.
2015-08-29 11:13:03 +02:00
PKEuS
d5bc3285b9
Move "extern" to the beginning of a declaration like "static" and "const"
2015-08-29 10:57:52 +02:00
PKEuS
f89205064a
Several small optimizations in tokenize.cpp
2015-08-29 10:46:51 +02:00
Martin Ettl
08413f0112
test/cfg: Improved testing of std.cfg.
2015-08-29 00:09:33 +02:00
Simon Martin
101cebbde1
Ticket #6957 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-28 23:06:39 +02:00
Simon Martin
59abb04042
Ticket #6596 : Address of local variables can also be assigned to pointer-pointer arguments using the ptr[] syntax.
2015-08-28 20:29:51 +02:00
Daniel Marjamäki
498c920180
addons/cert.py: better handling of structs. read pragmas in the file.
2015-08-28 18:07:12 +02:00
amai2012
45bb7d5adb
Merge pull request #647 from Dmitry-Me/continueOnRuleMatch
...
Treat matches as mutually exclusive
2015-08-28 16:00:53 +02:00
orbitcowboy
b0f2351649
Merge pull request #658 from Dmitry-Me/omitMatchCall
...
Replace match call with explicit comparison
2015-08-28 14:56:35 +02:00
Dmitry-Me
962f0ee584
Treat matches as mutually exclusive
2015-08-28 15:27:56 +03:00
Dmitry-Me
0cef076f10
Prefer previous() to tokAt(-1)
2015-08-28 15:19:24 +03:00
Dmitry-Me
81613d958a
Replace match call with explicit comparison
2015-08-28 15:16:10 +03:00
amai2012
2b17a5bcee
Merge pull request #656 from simartin/ticket_6953
...
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-28 06:01:13 +02:00
Simon Martin
c78d99dc07
Ticket #6954 : Properly handle pointers to arrays in CheckUnunsedVar.
2015-08-27 23:56:26 +02:00
Simon Martin
2e2f9facf5
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-27 23:35:22 +02:00
Daniel Marjamäki
436d7b6d59
Merge pull request #655 from Dmitry-Me/explicitConstCastBetterNames
...
Use const_cast to add const, better variable name
2015-08-27 17:04:07 +02:00
Dmitry-Me
c760ccee13
Use const_cast to add const, better variable name
2015-08-27 17:14:33 +03:00
PKEuS
72b918e704
Merge pull request #654 from Dmitry-Me/eliminateDuplicateCheck
...
Eliminate duplicate find() calls
2015-08-27 14:40:33 +02:00
PKEuS
2ace3d3144
Rewritten handling of declaration specifiers:
...
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
Dmitry-Me
ca75096141
Eliminate duplicate find() calls
2015-08-27 11:19:51 +03:00
PKEuS
39dd71e49b
Merge pull request #653 from Dmitry-Me/reduceVariableScope
...
Reduce variable scope
2015-08-26 14:08:10 +02:00
Dmitry-Me
346f04098c
Reduce variable scope
2015-08-26 14:48:19 +03:00
PKEuS
7bb79562e9
Skip inner classes in CheckAutoVariables::returnReference() ( #6951 )
2015-08-26 13:31:51 +02:00
PKEuS
37aec52399
Simplify complex/_Complex types ( #6939 )
2015-08-26 13:13:45 +02:00
PKEuS
c8c59aa92b
Removed Tokenizer::simplifyIfSameInnerCondition(). It covered only very simple patterns and is unlikely to have an impact on real-world code.
2015-08-26 13:04:00 +02:00
PKEuS
6b4a0a5ed7
Merge pull request #652 from Dmitry-Me/mergeIdenticalMAtches
...
Merge identical matches
2015-08-26 11:38:50 +02:00
Dmitry-Me
77317c3373
Merge identical matches
2015-08-26 10:43:15 +03:00
Simon Martin
6fb19b02d0
Properly differentiate arrays of pointers and pointers to arrays.
2015-08-25 21:19:19 +02:00
Simon Martin
8beb95e179
Fix CheckClass::checkMemset for arrays of pointers.
2015-08-23 19:57:58 +02:00
amai2012
873861df4a
#6948 cash: daca: mgetty (garbage code)
2015-08-21 10:40:43 +02:00
PKEuS
8d926d7328
Moved some simple WinAPI/MFC-specific simplifications to windows.cfg
2015-08-20 15:59:59 +02:00
PKEuS
ebae879cf9
Some small refactorizations to tokenize.cpp
2015-08-19 20:06:49 +02:00
PKEuS
11be2f79a6
Refactorization: Removed some redundant conditions and an unused syntax check from tokenize.cpp
2015-08-19 19:29:49 +02:00
PKEuS
a720153e1e
Refactorization: Removed redundant code for syntax error handling in templatesimplifier.cpp and symboldatabase.cpp
2015-08-19 19:29:48 +02:00
PKEuS
4e2d56242c
Refactorization: Removed unreachable and duplicate code in tokenize.cpp
2015-08-19 19:29:48 +02:00
Daniel Marjamäki
13cf6be40b
dump: use toxml for function names to handle operator& etc
2015-08-18 15:39:15 +02:00
Dmitry-Me
a8135d9bd8
Merge overlapping patterns
2015-08-17 17:25:19 +03:00
PKEuS
ab8afec3eb
Refactorizations:
...
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS
1627b19dd6
Refactorizations:
...
- Call std::string::find() with char instead of char* where possible
- Avoid string copying
- Optimized several Token::tokAt/strAt calls
2015-08-16 10:33:51 +02:00
PKEuS
ee4a5843bb
Some small refactorizations
2015-08-15 19:46:31 +02:00
PKEuS
1a266315f1
Removed some unused code
2015-08-15 19:17:25 +02:00
Daniel Marjamäki
7bb9d2d2f3
minor tweak. use isNotLibraryFunction in Library to prevent false matches
2015-08-15 16:48:30 +02:00
PKEuS
b77912a0b5
Support namespaces in CheckOther::checkIgnoredReturnValue()
2015-08-15 12:19:14 +02:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Daniel Marjamäki
7ede9de502
Removed unused code. The isVariableUsed is used instead.
2015-08-15 07:43:39 +02:00
Alexander Mai
8b433fa053
Add regression test for #6299 . Fix clang compiler warning due to doxygen comment
2015-08-14 18:27:03 +02:00
PKEuS
a297a03b64
Fixed false positive #6787 : Skip over lambdas in CheckAutoVariables::returnReference()
2015-08-14 13:03:07 +02:00
PKEuS
b0bf69bae7
Fixed false positive #6763 and reordered conditions
...
Ran AStyle
2015-08-14 12:50:45 +02:00
PKEuS
3cf67014ad
Fixed parsing of template in enum
2015-08-14 11:08:03 +02:00
Daniel Marjamäki
e578988832
invalidScanf: removed the checking for 'scanf crash with huge input data for old glibc'. new systems are not vulnerable to this bug anymore.
2015-08-14 08:03:46 +02:00
Dmitry-Me
769d8e713d
Eliminate repeated lookup, better variable names
2015-08-13 16:10:23 +03:00
Malcolm Parsons
daf633ef78
Fixed #5028 Fix parsing of C++11 raw string literals
2015-08-12 13:11:55 +01:00
Daniel Marjamäki
6865724c4e
Fixed #6914 (Token::expressionString: parenthesis missing in expression (*it)->stats.corpse_ticks)
2015-08-12 10:55:25 +02:00
Dmitry-Me
f0aa9e31de
Cache and reuse value
2015-08-12 10:57:36 +03:00
Dmitry-Me
50fb9cea66
Reduce variables scope
2015-08-11 17:20:30 +03:00
PKEuS
002b606a9c
Refactorized CheckObsoleteFunctions:
...
- Mention all checked functions in getErrorMessages() and classInfo(), not only posix ones
- Made members static and initialize them only once only once
- Better support for global namespace
2015-08-11 14:57:23 +02:00
PKEuS
c96f85e2a2
Refactorization: Implemented rValue-reference- and "const char*"-overload to make_container::operator<<
2015-08-11 14:05:01 +02:00
PKEuS
ebfdacb0d3
Introduced .cfg file format version to 2 (to prevent older cppcheck versions from failing silently when reading them), because 5b287fc849
introduced a backward-incompatible feature.
...
Increased format version of std.cfg, which is the only cfg file that makes use of the new backward incompatible feature.
Refactorization: Avoid a redundant std::string::find()-call
2015-08-11 14:05:01 +02:00
Matthias Krüger
7a90b36cca
CheckVaarg::va_start_subsequentCallsError: fix spelling "inbetween" -> "in between"
2015-08-11 14:03:00 +02:00
Matthias Krüger
391194579c
CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates"
2015-08-11 13:27:55 +02:00
Daniel Marjamäki
501ab0b6da
CheckLeakAutoVar: updated handling of unknown types in C++
2015-08-11 12:41:42 +02:00
PKEuS
b0b01d3962
Merge pull request #637 from Dmitry-Me/mergeOverlappingPatterns5
...
Merge overlapping patterns
2015-08-11 12:24:52 +02:00
Daniel Marjamäki
2e78d21480
Fixed #6730 (ValueFlow: inner scope does not return (continue,throw))
2015-08-11 11:21:03 +02:00
Dmitry-Me
51ee9b0e06
Merge overlapping patterns
2015-08-11 12:19:59 +03:00
Matthias Krüger
72b00b35f8
Tokenizer::simplifyNamespaceStd() check condition only once instead of potentially 3 times
2015-08-10 23:33:58 +02:00
PKEuS
bce45fb328
Merge pull request #635 from Dmitry-Me/removeUnimplementedMethod
...
Remove unimplemented method
2015-08-10 23:00:22 +02:00
Alexander Mai
a5aba110a4
Replace Tokenizer::simplifyBuiltinExpect by a suitable addition to gnu.cfg
2015-08-10 20:21:30 +02:00
Daniel Marjamäki
57aec12f34
Fixed #5622 (Allow class methods to be referenced in library XML configuration files)
2015-08-10 18:51:51 +02:00
Daniel Marjamäki
a70c57daa2
Library: move Library::alloc and Library::dealloc from header to cpp file and use the functionName utility function
2015-08-10 18:36:09 +02:00
Dmitry-Me
eec5e1722b
Remove unimplemented method
2015-08-10 18:02:49 +03:00
Daniel Marjamäki
3a1a34751f
Library: Initial handling of method calls
2015-08-10 09:41:06 +02:00
Daniel Marjamäki
5b287fc849
Library: The <function> name attribute can now have a comma separated list of names
2015-08-09 21:27:57 +02:00
Daniel Marjamäki
06110689a6
Replace Token::Match with Token::simpleMatch
2015-08-09 20:07:38 +02:00
Daniel Marjamäki
b70fe4c609
Fixed #6711 (Add namespace support to library files)
2015-08-09 19:55:33 +02:00
Daniel Marjamäki
9627fccdc5
assignFunctionArg: don't warn when there is self assignment. There is a separate warning for self assignments.
2015-08-09 14:51:23 +02:00
Matthias Krüger
4e4a1cfe3a
Tokenizer::combineOperators: prevent duplicate checking of same condition
2015-08-09 14:35:17 +02:00
Alexander Mai
66676b8e55
Warning selfAssignment was only issued if style was enabled.
2015-08-09 13:45:35 +02:00
Alexander Mai
95658030bc
Avoid UB in Tokenizer::printDebugOutput in case of empty tokenlist (see #6913 )
2015-08-09 07:49:34 +02:00
Daniel Marjamäki
e71ab70356
Fixed #6871 (False positive uninitvar - pointer to uninitialized char[])
2015-08-08 14:52:46 +02:00