PKEuS
c0e2adf723
Detect "var += fclose(f)" as deallocation (fixes false positive #6016 )
2014-09-30 13:19:53 +02:00
PKEuS
ccb5384645
Fixed false positive memoryLeak #6013
2014-09-30 13:02:02 +02:00
PKEuS
936043d47d
Fixed false positive 'unusedVar' with C++11 initialization ( #6160 )
2014-09-30 12:39:27 +02:00
PKEuS
374ea8f039
Fixed false positive ignoredReturnValue on unknown member function log() ( #6197 )
2014-09-29 19:55:32 +02:00
Martin Ettl
a7c870bdc8
Fixed crash on garbage code in CheckOther::checkVariableScope(). The corresponding backtrace is hosted at https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash223.cpp
2014-09-29 19:44:25 +02:00
Martin Ettl
2ca47601cd
Running astyle
2014-09-28 22:05:05 +02:00
Martin Ettl
b677d3d17f
Fix crash on garbage code in tokenlist. The corresponding backtrace along with a testcase is hosted at: https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash220.cpp
2014-09-28 22:04:25 +02:00
PKEuS
38af865560
Fixed false positive: Member variable not initialized in the constructor with array and (*this) ( #5754 )
2014-09-29 16:49:20 +02:00
PKEuS
cbb8360b30
Added version attribute to .cfg files ( #5928 )
2014-09-29 16:26:17 +02:00
PKEuS
68b26f8faa
Fixed subsequent false negatives in CheckBufferOverrun::checkInsecureCmdLineArgs() ( #5835 )
2014-09-29 15:38:33 +02:00
PKEuS
1df1b9c2bd
Fixed #5836 : Make showing $ in stringified tokens optional
2014-09-29 14:50:00 +02:00
PKEuS
448195f255
Added variable name to debug message about typeStartToken()
...
Fixed cppcheck message
2014-09-29 14:36:03 +02:00
PKEuS
0ae09c0029
SymbolDatabase: A token with a varId cannot be a function declaration
2014-09-29 13:05:51 +02:00
PKEuS
58fe668fc4
Fixed AST for operator:: after template ( #6195 )
2014-09-29 11:01:37 +02:00
PKEuS
55b14853d0
Fixed AST: Compile expression inside [] brackets of operator new. ( #6193 )
2014-09-29 10:26:15 +02:00
PKEuS
1495a411eb
Fixed false positive ignoredReturnValue for variables initialized with constructor syntax ( #6194 )
2014-09-29 10:15:29 +02:00
PKEuS
03b1afc28c
Loops over all varIds should start at 1.
2014-09-28 09:47:11 +02:00
Alexander Mai
ccd80e3407
#6141 FP: Unknown type is assumed to have size 0.
2014-09-27 21:51:11 +02:00
PKEuS
210294443e
New check: Check for unused return values ( #653 )
2014-09-27 21:31:04 +02:00
PKEuS
e1218cf846
Support allocation of array of pointers with operator new in checkmemoryleak.cpp
2014-09-27 11:25:08 +02:00
PKEuS
812bc6bdaf
CheckVaarg::va_list_usage(): Bailout when try{} block is encountered ( #6186 )
2014-09-27 11:03:58 +02:00
Alexander Mai
21c85118d6
#6189 assign with operator= a '\0' to a std::string is not an error
2014-09-26 20:40:44 +02:00
PKEuS
de13ad7eca
Improved simplifications of redundant loops:
...
- Execute simplifyWhile0 after simplifyKnownVariables (#394 )
- Support declaration of variable in loop header in removeRedundantFor
2014-09-26 10:47:05 +02:00
Robert Reif
1729ea6f0f
Fixed #6182 (Format specifier check confused by ternary operator)
2014-09-24 16:45:06 +02:00
PKEuS
0cc5b67bf6
Avoid copying std::list object in valueFlowAfterAssign
2014-09-24 13:22:22 +02:00
Robert Reif
194e4a71a4
Symbol database: handle anonymous namespace
2014-09-24 06:09:08 +02:00
PKEuS
1e8c7e102d
Revert "run dmake"
...
This reverts commit 8ccf9eed09
.
2014-09-23 21:04:31 +02:00
PKEuS
6dc5b1725e
Restored files removed in 1cc872f5b2
2014-09-23 21:02:46 +02:00
Matthias Krüger
8ccf9eed09
run dmake
2014-09-23 16:20:19 +02:00
Lauri Nurmi
1cc872f5b2
Change "obsolete" in all filenames into "obsolescent", and also update all references to such files.
...
Neither the C standard, the C++ standard, or POSIX talks about "obsolete". All of them use the word "obsolescent", which is a different word with a different meaning.
2014-09-23 16:18:04 +02:00
Daniel Marjamäki
ee93d30d94
ValueFlow: improved valueflow for loops that assign variable and then break
2014-09-23 16:06:02 +02:00
Dmitry-Me
b17f2eea16
Cache search result to avoid dual search
2014-09-22 15:54:17 +04:00
Dmitry-Me
ebf1764bcc
Move variable declarations, remove unneeded assignments, remove comparison duplication
2014-09-19 11:29:31 +04:00
amai2012
77f341be97
Merge pull request #440 from Dmitry-Me/renameVariablesReduceActions
...
Cleanup variable names, reduce unneeded operations
2014-09-17 18:39:17 +02:00
Jonathan Thackray
2b3ef83f26
Fixed #5747 (When socket() returns -1 on error, this shouldn't be marked as a resource leak)
2014-09-17 18:37:41 +02:00
Dmitry-Me
57c379d300
Cleanup variable names, reduce unneeded operations
2014-09-17 15:52:03 +04:00
Dmitry-Me
32f7a789df
Merge overlapping patterns, move declarations
2014-09-17 10:54:53 +04:00
amai2012
776e720d8f
Merge pull request #438 from Dmitry-Me/moveDeclarationReorderCheck
...
Move declaration, run check earlier
2014-09-16 20:50:04 +02:00
Daniel Marjamäki
f93cf9d1b7
Fixed #6170 (Tokenizer: sizeof on array in 2d-array is not handled properly)
2014-09-16 17:21:17 +02:00
Dmitry-Me
7c4b9bed9e
Move declaration, run check earlier
2014-09-16 13:34:16 +04:00
Dmitry-Me
6f9730b1d8
Reorder checks, unwrap code
2014-09-16 10:17:06 +04:00
Dmitry-Me
b479948f0f
Refactoring: Merge overlapping Token::Match function calls
2014-09-16 06:22:16 +02:00
Daniel Marjamäki
bbbe2c1b94
Fixed #6169 (False positive: passing uninitialized struct buffer member to strncpy)
2014-09-15 15:58:21 +02:00
PKEuS
cafddcb109
Fixed wrong function log10 being recommended instead of log1p
2014-09-14 13:36:12 +02:00
Daniel Marjamäki
29a49d0641
removed some redundant null pointer checks before calling Token::Match
2014-09-14 11:35:04 +02:00
Simon Martin
53b58f0ed9
Refactoring. Use Token::Match instead of hardcoded patterns to increase readability.
2014-09-14 11:26:16 +02:00
Daniel Marjamäki
d354cdc02c
Fixed #6168 (False positive: sign conversion for inner calculation)
2014-09-14 10:29:58 +02:00
Daniel Marjamäki
865a252c89
astyle formatting
...
[ci skip]
2014-09-14 10:29:12 +02:00
Simon Martin
4b750997cb
Ticket #6121 : Report a syntax error for invalid enum initializers.
2014-09-13 20:46:53 +02:00
Simon Martin
01cf008792
Ticket #6134 : Improve the mechanism differentiating template declarations from template definitions.
2014-09-13 16:44:05 +02:00
PKEuS
210d01c274
Merge pull request #430 from Dmitry-Me/mergeDuplicatePatterns
...
Merge partially duplicate patterns
2014-09-12 21:28:18 +02:00
Daniel Marjamäki
8cbd013d7f
checkSignConversion: dont warn for + and -
2014-09-12 18:58:31 +02:00
Dmitry-Me
961a1b65ae
Merge partially duplicate patterns
2014-09-12 19:10:41 +04:00
Daniel Marjamäki
0e55f12140
Fixed #6165 (Remove old checkUnsignedDivision checker that uses neither AST nor ValueFlow. The CheckType::checkSignConversion should be much more accurate)
2014-09-12 16:59:16 +02:00
Daniel Marjamäki
d60cf16eb8
Sign conversion: Improved check. When its not explicit that 'int' variable is signed but it can have negative values, assume its signed
2014-09-12 16:18:42 +02:00
PKEuS
0b7281803e
Merge pull request #428 from Dmitry-Me/detectArrowAccessesViaUninitPtrs
...
Detect -> accesses on uninitialized pointers
2014-09-12 09:19:59 +02:00
Dmitry-Me
a2b30c7801
Detect -> accesses on uninitialized pointers
2014-09-12 10:19:00 +04:00
Daniel Marjamäki
7119550dde
Too big shift: fix FP when cast is used
2014-09-12 06:45:45 +02:00
Daniel Marjamäki
0ab7abded1
AST: fixed cast for 'return (long long)c << 40;'
2014-09-12 06:43:52 +02:00
PKEuS
e2136adf5b
Merge pull request #427 from Dmitry-Me/reorderChecksMoveDeclaration
...
Reorder checks, move declaration closer to where it's needed
2014-09-11 21:46:13 +02:00
PKEuS
6f92557478
Use information about pure/leak-ignore from library to improve accuracy of several bailouts
2014-09-11 20:27:07 +02:00
PKEuS
c1b0bfe4ee
Simplified code
2014-09-11 20:27:01 +02:00
PKEuS
fb0d145b34
Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
...
Ran AStyle
2014-09-11 19:45:52 +02:00
PKEuS
87e6a3501a
Added checktype.cpp to VS solution; Fixed MSVC warning about signed/unsigned mismatch
2014-09-11 18:47:28 +02:00
Daniel Marjamäki
7847263451
Fixed #6158 (New check: dangerous sign conversion)
2014-09-11 18:10:19 +02:00
Dmitry-Me
f58a25bebd
Reorder checks, move declaration closer to where it's needed
2014-09-11 17:14:06 +04:00
Dmitry-Me
e050fba414
Move declaration closer to where it is used
2014-09-11 11:26:35 +04:00
PKEuS
865fc9aa67
Fixed #6154 : Don't suggest to reduce scope if inner scope is a lambda.
2014-09-10 20:56:34 +02:00
PKEuS
0a416910c4
Improved speed of testrunner: Avoid repeated loading of the same library
2014-09-10 20:29:44 +02:00
PKEuS
3fade4d28c
Improved performance of library loading (~5%):
...
- Use std::string for comparison, convert to string only once
- Avoid calling tinyxml functions multiple times
2014-09-10 20:29:44 +02:00
PKEuS
c3ac91eb42
Fixed ID of message about purged configurations.
2014-09-10 20:19:21 +02:00
Daniel Marjamäki
a46f5c00a8
Minor tweaks for new CheckOther::checkIntegerOverflow checker
2014-09-10 17:26:20 +02:00
Daniel Marjamäki
974c8688c3
Fixed #1751 (Undefined Behavior: Signed integer overflow)
2014-09-10 17:02:18 +02:00
Daniel Marjamäki
a36b0e55be
CheckOther::checkTooBigBitwiseShift: improving error messages
2014-09-09 17:06:45 +02:00
Dmitry-Me
0a1b8c22d6
Simplify null pointer handling
2014-09-09 13:11:41 +04:00
Daniel Marjamäki
f111a89639
Fixed #1757 (Undefined Behavior: Shift too many bits)
2014-09-09 07:24:59 +02:00
Dmitry-Me
f7824bfd00
CheckNullPointer::isPointerDeRef: Improve handling of static member variables and functions
2014-09-09 05:36:09 +02:00
Matthias Krüger
323fd1b3dc
tokenize.cpp: fix internal warning: Found simple pattern inside Token::Match() call: ") :"
2014-09-08 22:00:57 +02:00
Martin Ettl
0ced0c33e5
Fixed #6149 : (gcc) warning: comparing floating point with == or != is unsafe. Using Tokenizer::isOneNumber function to compare a floating point number being 1.0.
2014-09-08 20:02:04 +02:00
Frank Zingsheim
8c5013adda
Fixed #6073
2014-09-07 21:53:32 +02:00
Daniel Marjamäki
db929ffd19
Fixed CID 1037074. Useless null pointer check. Created ticket #6144 .
2014-09-07 13:50:55 +02:00
PKEuS
301b668eb5
Fixed internal warning of cppcheck
2014-09-07 11:47:40 +02:00
PKEuS
ff4fc6a234
New check: Recommend expm1, log1p, erfc ( #5392 )
2014-09-07 11:38:49 +02:00
Daniel Marjamäki
7142edf03e
Improved fix for Cppcheck warning. Remove useless conditions instead of adding a new one.
2014-09-07 09:56:07 +02:00
PKEuS
605fb9039a
Merge pull request #391 from Dmitry-Me/resolveIssue1037098
...
Resolve CID 1037098
2014-09-06 23:17:52 +02:00
PKEuS
117e45f8af
Merge pull request #395 from Dmitry-Me/fixBufferOverrun
...
Fix potential buffer overrun
2014-09-06 23:03:02 +02:00
PKEuS
4859b55ce6
Merge pull request #422 from simartin/ticket_6023
...
Ticket #6023 : Properly handle template'd default template parameter values
2014-09-06 22:55:45 +02:00
Alexander Mai
e4d0435976
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-09-06 22:27:38 +02:00
Alexander Mai
6b26b6ed31
Fix read access to uninitialized variable
2014-09-06 22:27:13 +02:00
Simon Martin
6e10603227
Ticket #6023 : Properly handle template'd default template parameter values.
2014-09-06 20:39:04 +02:00
PKEuS
35b00a5e05
Support rValue references in typedef ( #1823 )
2014-09-06 19:00:26 +02:00
Alexander Mai
efab840b50
#5230 Explicit reinterpret_cast should not give a warning. Lower all invalidPointerCast messages to 'portability'
2014-09-06 13:09:02 +02:00
Alexander Mai
29b46cb505
#6132 crash: daca: kvirc CheckOther::checkRedundantAssignment()
2014-09-05 20:03:34 +02:00
Martin Ettl
8a15486370
Fixed CID-1234716: Dereference after null check in lib/checkio.cpp
2014-09-01 09:00:05 +02:00
PKEuS
e8f7279039
Refactorization: Moved detection of STL strings to SymbolDatabase
2014-09-05 12:03:08 +02:00
PKEuS
4940da06c0
Calculate checksum only if necessary ( #6129 )
2014-09-05 11:05:21 +02:00
Simon Martin
eeeb816db9
Ticket #6103 : Simplify "new (type)" constructs into "new type" to avoid confusion upon certain input.
2014-09-05 08:02:18 +02:00
PKEuS
8c24553229
Support inherited member variables in setVarId ( #4101 )
2014-09-04 22:22:09 +02:00
Alexander Mai
5a96413220
#6127 crash on patch(?)-".c" file. Avoid segfault.
2014-09-04 21:28:18 +02:00
Alexander Mai
65f599bd9e
Fix version number macros
2014-09-04 21:18:15 +02:00
Daniel Marjamäki
b3e4abd82a
Fixed Cppcheck warnings
2014-09-04 18:08:56 +02:00
Daniel Marjamäki
05617d7285
Fixed #6118 (False positive: divide by zero - if condition not evaluated properly)
2014-09-04 17:52:14 +02:00
PKEuS
800b57d87e
Merge pull request #415 from Dmitry-Me/reducePatternsDuplication
...
Reduce patterns duplication
2014-09-04 07:46:59 +02:00
PKEuS
5d0aa15002
Merge pull request #416 from Dmitry-Me/removeDuplicateChecks
...
Remove duplicate checks
2014-09-04 07:46:45 +02:00
PKEuS
e4a81f9666
Improved checksum algorithm to fix configurations being purged by coincidence ( #6126 ):
...
- Better distribution of values by rotating the bits of the checksum for each token
2014-09-03 23:10:38 +02:00
Alexander Mai
270f59e76a
Fix doxygen warning and astyle formatting
2014-09-03 20:38:41 +02:00
Dmitry-Me
68d650e9ac
Remove duplicate checks
2014-09-03 14:17:34 +04:00
PKEuS
6d27ca6c9a
Fixed SymbolDatabase if unnamed struct is casted and returned ( #6125 )
2014-09-03 11:15:05 +02:00
PKEuS
bf2f76e70c
Detect and purge duplicate configurations by calculating a checksum.
2014-09-02 22:35:52 +02:00
Alexander Mai
a632f68345
#6122 segmentation fault (invalid code) in in valueFlowForLoop2. Simple fix and testcase.
2014-09-02 19:41:50 +02:00
Alexander Mai
45dc4ca6be
Fix compiler warning. Re-order if-expression for performance reasons
2014-09-02 19:18:30 +02:00
Dmitry-Me
46d24c7bfb
Reduce patterns duplication
2014-09-02 19:51:22 +04:00
Dmitry-Me
7342a81ea7
Minor refactorings. rename token. cleanup if/else.
2014-09-02 16:10:51 +02:00
PKEuS
a52401cf1b
Fixed some compiler warning about signed/unsigned conversions.
2014-09-02 11:44:51 +02:00
PKEuS
3e65cb446e
Remove "auto" keyword (storage class specifier) from C++03 and C code ( #4990 ).
2014-09-02 11:21:47 +02:00
PKEuS
2d608890a5
Improved message 'mismatchSize' ( #4167 )
2014-09-02 09:38:40 +02:00
PKEuS
ddc19febb5
Merge pull request #413 from Dmitry-Me/improveCStyleCastsDetection
...
Improve C style casts detection
2014-09-02 08:07:53 +02:00
PKEuS
428f7a6f26
Attempt to fix crashs on clang test suite.
2014-09-01 23:29:15 +02:00
PKEuS
00044aabb0
Handle ternary operator in redundantAssignment check ( #5964 )
2014-09-01 23:16:52 +02:00
Alexander Mai
a4ff30301a
#5805 'Passing value -1.0 to sqrt() leads to undefined result' is incorrect. Degrade wrongmathcall from error to warning, since it deals with implementation-defined behaviour
2014-09-01 19:31:32 +02:00
PKEuS
80df3dc642
Disabled several checks and simplifications for C code, if they are C++-only. Do not match arguments for C code, since there can't be overloads.
2014-09-01 18:43:24 +02:00
amai2012
9bc0e3afd6
Merge pull request #412 from Dmitry-Me/moveChecksEarlier
...
Move cheap checks earlier to avoid more expensive ones
2014-09-01 17:49:45 +02:00
Dmitry-Me
f937dde1e0
Improve C style casts detection
2014-09-01 16:40:28 +04:00
PKEuS
0995b85c09
Attempt to fix crashs when self-checking cppcheck introduced by previous commit
2014-09-01 14:12:43 +02:00
PKEuS
40e5dab9dc
Refactorization in checkmemoryleak.cpp:
...
- Use Library to detect noreturn/notnoreturn functions
- Removed realloc from std.cfg as long as there is no proper way to configure such functions
2014-09-01 13:54:33 +02:00
PKEuS
c92230dfee
Fixed crash on garbage code introduced by recent commit.
2014-09-01 12:41:30 +02:00
PKEuS
20a066bb14
Run unreachableCode checking only on executable scopes ( #5789 )
2014-09-01 11:29:39 +02:00
PKEuS
b5e064e737
Fixed unreachableCode message if a lambda is returned ( #6008 ).
2014-09-01 11:10:42 +02:00
Dmitry-Me
a6219adc9b
Move cheap checks earlier to avoid more expensive ones
2014-09-01 12:52:27 +04:00
PKEuS
353a9e9a64
Bailout for duplicateBranch check if branches are empty ( #5354 )
2014-09-01 10:19:14 +02:00
PKEuS
e35329aba3
Fixed reporting of unmatched suppressions for unusedFunction ( #4946 )
2014-09-01 10:13:03 +02:00
PKEuS
47764321f2
Several fixes to invalidScanfFormatWidthError():
...
- Different IDs for different messages (#5809 )
- severity is warning, not style, so check _settings->isEnabled() properly
- Removed never shown message text
2014-09-01 09:33:58 +02:00
amai2012
d1d3c24f3e
Merge pull request #411 from Dmitry-Me/moveDeclarationsCloserToWhereTheyreNeeded
...
Move declarations closer to where they're first used
2014-09-01 08:48:46 +02:00
PKEuS
59cccb83ce
Reimplemented version.h:
...
- Use macros to form version number and string. CPPCHECK_MAJOR, CPPCHECK_MINOR and CPPCHECK_DEVMINOR now contain the parts of the version number.
- "dev" status is now detected by comparison of CPPCHECK_MINOR and CPPCHECK_DEVMINOR, version string created accordingly.
Fixed two comments.
2014-09-01 08:48:25 +02:00
Dmitry-Me
9199dde560
Move declarations closer to where they're first used
2014-09-01 10:05:59 +04:00
PKEuS
288c94a47f
Extended Message "fflushOnInputStream" to files opened for reading.
2014-08-31 21:03:33 +02:00
PKEuS
b07f61170d
Changed severity of fflushOnInputStream to portability: The behaviour of fflush(stdin) is defined on Linux.
2014-08-31 20:56:05 +02:00
PKEuS
e1bc5f5248
Fixed false positive #4788 (break; in BOOST_FOREACH)
2014-08-31 20:40:52 +02:00
PKEuS
8722bba52a
Fixed false positive #4648
2014-08-31 20:33:27 +02:00
PKEuS
3ccdae78ba
Support __declspec(property) ( #4700 )
2014-08-31 20:17:18 +02:00
PKEuS
b8918906e6
Fixed false positive #5466
2014-08-31 19:46:30 +02:00
PKEuS
8f4662de92
No unused variable messages about std::unique_ptr|shared_ptr|auto_ptr ( #4355 )
2014-08-31 19:18:02 +02:00
PKEuS
78932094c8
Fixed crash on garbage code #6106
2014-08-31 12:12:03 +02:00
PKEuS
9733a751ec
SymbolDatabase: Several small refactorizations
2014-08-31 11:27:32 +02:00
PKEuS
862b18e0e2
SymbolDatabase: New scope type eLambda
2014-08-31 10:21:27 +02:00
Daniel Marjamäki
97005d7d87
remove redundant declaration of isSameExpression. fixes gcc compiler warning.
2014-08-30 19:23:31 +02:00
Dmitry-Me
eace67ee1c
Use logical instead of bitwise operators to save cpu
2014-08-30 11:35:25 +02:00
PKEuS
e9fdfc6cd0
Fix on checking side for #6099
2014-08-30 11:18:48 +02:00
Daniel Marjamäki
3ac5f16668
Makefile: generate new Makefile with dmake
2014-08-29 18:32:50 +02:00
PKEuS
06a92e8981
Moved several condition checks from checkOther to checkCondition (former checkAssignIf)
2014-08-29 17:06:46 +02:00