Daniel Marjamäki
86a620a3b4
ValueFlow: Better handling of function return value when there are 0 parameters
2016-10-20 16:10:55 +02:00
Daniel Marjamäki
a85eacc157
cstyleCast: don't warn about '(const Variable *)nullptr'
2016-10-18 22:56:33 +02:00
Daniel Marjamäki
efa3aba32a
Remove Tokenizer::simplifyNull()
2016-10-18 21:44:02 +02:00
Daniel Marjamäki
9cea2d6dfa
Tokenizer: Removed simplifications of standard functions that should be handled through configuration.
2016-10-18 19:25:58 +02:00
Dmitry-Me
d2e667ae7b
Put apostrophes consistent with other similar messages
2016-10-18 15:45:08 +03:00
Daniel Marjamäki
fae4a4dacf
Fixed #7668 (ValueFlow: return value from abs)
2016-10-17 13:05:19 +02:00
Daniel Marjamäki
1b7766c7bd
astyle formatting
2016-10-16 19:03:14 +02:00
Daniel Marjamäki
90ed7634b8
MathLib: fix for octal char literal '\200'
2016-10-16 13:42:20 +02:00
Daniel Marjamäki
5175bf88d6
Platform: Fix type limits calculations. sizeof=>bit
2016-10-16 12:00:33 +02:00
Daniel Marjamäki
c70987b727
ValueType: fix type of integer literals
2016-10-16 11:36:22 +02:00
Daniel Marjamäki
7fb812f415
Fixed #7752 (ValueFlow: no conditional value, probably because condition is in ternary operator and/or in function call.)
2016-10-16 07:15:28 +02:00
Daniel Marjamäki
ad74421526
Fixed #7756 (ValueFlow: fix bug in valueAfterAssign, same variable in lhs and rhs)
2016-10-15 19:09:50 +02:00
Daniel Marjamäki
d09a8dde57
Improved char literal handling. In the 'normal' tokenlist these should not be simplified to integer literals.
2016-10-12 10:20:24 +02:00
Miika-Petteri Matikainen
26816ed954
Fixes preprocessor regression causing hang
...
Cppcheck 1.76 introduced a regression in preprocessor which causes
the following code to hang:
$ cat > test.c << EOF
#ifndef Y
#else
#endif
EOF
$ cppcheck -D BAR --force test.c
Checking test.c ...
^C
This used to work with version 1.75. Git bisect reveals that this
regression was caused by commit:
ff036c8742
This commit fixes the regression by avoiding infinite loop in
hasDefine(). If cfg is empty string "", we can skip the whole loop
and exit early.
2016-10-11 19:56:13 +03:00
orbitcowboy
fe08abb76f
Improved Doxygen comments. There are no functional changes.
2016-10-11 13:51:46 +02:00
PKEuS
1715969f6f
Support prefix-increment/decrement in CheckAutoVariables::assignFunctionArg() ( #3177 )
2016-10-10 21:34:40 +02:00
PKEuS
1227a3f596
Improved check: Complain if a variable is modified but not used again
2016-10-10 21:27:40 +02:00
Harald Scheidl
04421f5601
check if AST is not null before accessing it
2016-10-09 18:21:23 +02:00
Daniel Marjamäki
e0e53cbd66
alwaysTrueFalse: Don't warn when condition is 0 or 1
2016-10-09 15:20:43 +02:00
Daniel Marjamäki
af5dd2c29e
New check: Pointer overflow (null pointer subtracted)
2016-10-09 15:15:29 +02:00
Harald Scheidl
58eb644003
Improved Check: Warn about number and char literals in boolean expressions ( #7750 )
2016-10-09 13:21:00 +02:00
Daniel Marjamäki
0e785e435e
charLiteralWithCharPtrCompare: Improved warning to catch any char literal
2016-10-09 11:39:20 +02:00
PKEuS
e417e15567
Set version to 1.76.99/1.77 dev
2016-10-09 10:33:03 +02:00
PKEuS
54959d1932
CheckLeakAutoVar: Distinguish between new and new[] ( #888 )
2016-10-09 10:28:19 +02:00
Daniel Marjamäki
0afe745c94
1.76: Update version
2016-10-08 18:40:36 +02:00
PKEuS
e1a21a8bb1
Fixed internal warnings
2016-10-08 11:34:25 +02:00
Harald Scheidl
9f1b70fa04
new can initialize memory, don't warn in this case ( #7623 )
2016-10-08 10:03:09 +02:00
Daniel Marjamäki
bcbc8ef017
Fixed #7747 (Syntax error when setting the bitcount of an enum defined inside a struct)
2016-10-04 15:57:43 +02:00
Daniel Marjamäki
02402eeea4
Make simplifyBitfields() a bit more strict
2016-10-04 15:33:50 +02:00
Boris Egorov
a32f61ae4a
Fixed #7139 (ValueFlow: Missed shift operation in for expression)
2016-10-04 13:09:33 +07:00
Harald Scheidl
ba6cda9c86
Fixed #7740 (Tokenizer::setVarId: Function declaration does not start with 'return')
2016-10-03 10:02:18 +02:00
PKEuS
4df8bf9c39
Added missing #include "config.h" in pathmatch.h
2016-10-02 15:51:21 +02:00
PKEuS
29e1fe136a
Fixed Visual Studio build after pathmatch.h/cpp was moved to lib, fixed compiler errors about getcwd
2016-10-02 15:48:03 +02:00
Daniel Marjamäki
fff8aa8590
dmake: pathmatch was moved from cli to lib
2016-10-02 13:32:39 +02:00
Daniel Marjamäki
03d6d34396
Fixed #4399 (Exclude directory with absolute path does not work)
2016-10-02 13:02:29 +02:00
Daniel Marjamäki
3605457cbe
CLI: Fix exclude of absolute path. #4399
2016-10-02 12:38:44 +02:00
Daniel Marjamäki
91d97c556d
Path: Add methods Path::isAbsolute() and Path::getCurrentPath()
2016-10-02 12:06:55 +02:00
Simon Martin
3f415673e4
Ticket #7541 : Properly keep track of namespace definition end markers when there are multiple of them.
2016-10-01 20:46:33 +02:00
orbitcowboy
ee0602cd21
Merge pull request #832 from simartin/ticket_7068
...
Ticket #7068 : Treat "memset(&this->member, ..." as member initialization
2016-10-01 15:36:32 +02:00
Simon Martin
dc61b6342d
Ticket #7068 : Treat "memset(&this->member, ..." as member initialization.
2016-10-01 13:46:58 +02:00
Daniel Marjamäki
6f133a397b
Fixed #3492 (GUI: after edit project recheck use old settings)
2016-10-01 13:08:58 +02:00
Daniel Marjamäki
9dcad7115a
Fixed #7743 (--config-exclude no longer supported)
2016-09-30 08:00:06 +02:00
Boris Egorov
0154d39bf6
Show struct member in unsignedLessThanZeroError warning
...
Before:
[/tmp/test.c:8]: (style) Checking if unsigned variable '.' is less than zero.
[/tmp/test.c:12]: (style) Checking if unsigned variable '.' is less than zero.
After:
[/tmp/test.c:8]: (style) Checking if unsigned variable 'd.n' is less than zero.
[/tmp/test.c:12]: (style) Checking if unsigned variable 'd.n' is less than zero.
2016-09-22 08:03:30 +07:00
Matthias Krüger
2f39ed6f88
redundantPointerOpError: put pointer name into single quotes in the error message.
2016-09-16 22:18:24 +02:00
Daniel Marjamäki
6b55acd7af
CheckIO: Changed severity for '.. aka' warnings to portability. If type is compatible then it's just a possible portability issue.
2016-09-11 17:05:01 +02:00
Simon Martin
f816fb811e
Ticket #7680 : Properly handle ::delete during memory leak checks.
2016-09-10 14:55:50 +02:00
Daniel Marjamäki
ac1a869d60
unused struct members: don't warn about packed structs ( #3088 )
2016-09-05 17:27:12 +02:00
Daniel Marjamäki
4d22ada078
Fixed #5839 (False positive: Function can be const, if this is passed to functor)
2016-09-04 16:36:04 +02:00
Daniel Marjamäki
ce7bfba416
Refactoring CheckClass::checkConst. Use continue.
2016-09-04 16:06:54 +02:00
Daniel Marjamäki
54db79305b
Redo refactoring of CheckClass::checkConst.
2016-09-04 16:02:59 +02:00
Daniel Marjamäki
530a05e40e
Refactoring CheckClass::checkConst. Use continue.
2016-09-04 15:38:56 +02:00
Daniel Marjamäki
03a6282ab3
Fixed #7338 (Library: method in base class)
2016-09-04 14:14:21 +02:00
Daniel Marjamäki
60f22bd4ee
Fixed #7477 (False positive 'Assigned value is never used' in multithreaded context)
2016-09-03 20:38:36 +02:00
Daniel Marjamäki
b97bdb5300
bump simplecpp to rev b50ced8ac14f8debab9e85e78036f881ff2b3965
2016-09-03 12:29:45 +02:00
Roberto Martelloni
28f1222dc2
CWE mapping of useAutoPointerMalloc, uselessCallsCompare, uselessCallsSwap, uselessCallsSubstr, uselessCallsEmpty, uselessCallsRemove, derefInvalidIterator, reademptycontainer, multiplySizeof, divideSizeof, stringLiteralWrite, incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, truncLongCastAssignment, truncLongCastReturn, unusedFunction, unusedVariable, unusedAllocatedMemory, unreadVariable, unassignedVariable, unusedStructMember, postfixOperator, va_start_wrongParameter ( #824 )
...
Add an optional extended description…
2016-09-03 00:31:35 +02:00
Daniel Marjamäki
0e48625ff4
Fixed false positive when self-checking Cppcheck 'boolean result used in bitwise operation' when using boolean variables.
2016-08-29 04:09:36 +02:00
Daniel Marjamäki
24c6d92667
astyle formatting
...
[ci skip]
2016-08-29 04:08:38 +02:00
Daniel Marjamäki
939b42df06
Fixed #7134 (False positive redundantAssignment - assignment to local variable of unknown type)
2016-08-29 03:48:08 +02:00
Daniel Marjamäki
18cab009c1
Fix Token::Match pattern
2016-08-28 19:25:57 +02:00
Daniel Marjamäki
254e5675ff
Fixed #7573 (Tokenizer: FP caused by constant folding)
2016-08-28 19:11:05 +02:00
Daniel Marjamäki
fee0e4edfa
Fixed #7177 (MathLib: Does not handle '\xF6' properly)
2016-08-28 11:37:05 +02:00
Robert Reif
bf7ef56ef5
Fixed #7713 (False positive: %hhu in format string (no. 1) requires 'unsigned char' but the argument type is 'signed int'.)
2016-08-26 19:47:36 +02:00
orbitcowboy
87409ea6b3
Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read.
2016-08-25 19:17:07 +02:00
Roberto Martelloni
1db24ee070
CWE mapping of signedCharArrayIndex, unknownSignCharArrayIndex, suspiciousCase, suspiciousEqualityComparison, duplicateBranch, duplicateExpressionTernary, suspiciousSemicolon, incompleteArrayFill, redundantPointerOp, unusedLabelSwitch, unusedLabel, unknownEvaluationOrder, stlIfFind, useAutoPointerCopy
2016-08-25 15:40:23 +01:00
amai2012
ece478979b
Merge pull request #821 from boos/cwe-mapping-11
...
CWE mapping of invalidLengthModifierError, leakUnsafeArgAlloc, nullPointerDefaultArg, nullPointerRedundantCheck, raceAfterInterlockedDecrement.
2016-08-24 20:44:06 +02:00
Roberto Martelloni
01ee9ee5e6
CWE mapping of invalidLengthModifierError, leakUnsafeArgAlloc, nullPointerDefaultArg, nullPointerRedundantCheck, raceAfterInterlockedDecrement.
2016-08-24 15:37:14 +01:00
Dmitry-Me
667038a402
Merge overlapping patterns
2016-08-24 15:10:39 +03:00
Robert Reif
6043a27065
Fixed #7710 (%h and %hh printf type size specifiers not supported)
2016-08-24 12:47:11 +02:00
Daniel Marjamäki
706877df2d
astyle formatting
...
[ci skip]
2016-08-24 12:43:45 +02:00
amai2012
7cc2124176
Fix crash in parsing solution/project
2016-08-24 12:17:54 +02:00
amai2012
c0401c2ef5
Merge pull request #820 from boos/cwe-mapping-10
...
CWE mapping of functionConst, functionStatic, initializerList, badBitmaskCheck, knownConditionTrueFalse, invalidTestForOverflow, unhandledExceptionSpecification, coutCerrMisusage, invalidPrintfArgType_int
2016-08-24 09:48:01 +02:00
Roberto Martelloni
4c6f4f6708
CWE mapping of functionConst, functionStatic, initializerList, badBitmaskCheck, knownConditionTrueFalse, invalidTestForOverflow, unhandledExceptionSpecification, coutCerrMisusage,
...
invalidPrintfArgType_int
2016-08-23 16:48:36 +01:00
Dmitry-Me
cd6aa27010
Clarify loop logic
...
* clearer variable names
* don't rely on npos being outside indices range - explicitly break the loop instead
2016-08-23 18:27:07 +03:00
Frank Zingsheim
8c8a534117
SymbolDatabase: stronger type matching
2016-08-21 16:11:23 +02:00
Frank Zingsheim
7c9a69357e
Fixed #7696 (cppcheck 1.75 runs very slowly with style and/or performance checks)
2016-08-21 16:07:05 +02:00
Daniel Marjamäki
bea35ee04c
GUI: Select configuration that is checked
2016-08-21 15:57:38 +02:00
Daniel Marjamäki
a94628d8fc
Settings: Make Settings::_terminated static. All threads and subchecks are terminated
2016-08-21 15:57:19 +02:00
Daniel Marjamäki
d9ebdc6a10
Preprocessor: fix handling of -U in Preprocessor::getConfigs()
2016-08-21 15:01:04 +02:00
Daniel Marjamäki
ff036c8742
Fixed #7700 (Using -D to force a configuration still checks the configuration as well as configurations that are not relevant)
2016-08-21 13:53:44 +02:00
Daniel Marjamäki
19c105cdf9
Fixed #7677 (skipping of configurations broken?)
2016-08-21 12:31:26 +02:00
PKEuS
e0838ff194
Fixed crash on garbage code ( #7699 )
2016-08-21 11:06:48 +02:00
Daniel Marjamäki
363605906f
Fixed #7695 (Running with -U_WIN32 still checks related configurations)
2016-08-21 07:45:15 +02:00
Robert Reif
62ac40fc5e
Fixed #7706 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 22:43:27 +02:00
Robert Reif
1dd1f6dd6a
Fixed #7673 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 17:56:48 +02:00
Daniel Marjamäki
fe2fa4d343
GUI: Only check current platform when checking sln/vcxproj file
2016-08-20 13:47:25 +02:00
Daniel Marjamäki
f1d0498418
ImportProject: Fix crash when there is condition $(Configuration.Contains('X'))
2016-08-20 13:00:47 +02:00
Daniel Marjamäki
079051a4e4
ImportProject: UseOfMfc => define __AFXWIN_H__
2016-08-20 12:20:04 +02:00
Daniel Marjamäki
8a66535399
Fixed #7694 (ValueType: 1.23L)
2016-08-20 08:44:53 +02:00
Robert Reif
b56c765a45
Fixed #7703 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 07:43:15 +02:00
Robert Reif
f1b5ac30a7
Fixed 7698 (FP syntaxError with enum (1.75 regression))
2016-08-19 19:09:52 +02:00
Robert Reif
1e999e0cfe
Fixed #7697 ((debug) Executable scope 'B' with unknown function.)
2016-08-19 19:06:15 +02:00
Daniel Marjamäki
789aef7fde
Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking)
2016-08-19 17:36:27 +02:00
Daniel Marjamäki
305609f4fb
Fixed #7688 (setTokenValue: crash when there is no 2nd operand for ternary operator)
2016-08-17 18:44:41 +02:00
Daniel Marjamäki
499e52c976
astyle formatting
...
[ci skip]
2016-08-15 18:04:55 +02:00
Daniel Marjamäki
1f98af654a
ValueFlow: better handling of ? when condition result is known
2016-08-15 14:19:35 +02:00
amai2012
453b5577cd
Merge pull request #819 from boos/cwe-mapping-9
...
CWE mapping of assignBoolToFloat, strncatUsage, sizeArgumentAsChar, terminateStrncpy, bufferNotZeroTerminated, negativeArraySize, noExplicitConstructor, virtualDestructor
2016-08-15 09:20:59 +02:00
Daniel Marjamäki
62362cd06d
ValueFlow: improve handling of unary minus
2016-08-14 22:19:06 +02:00
Roberto Martelloni
41dee04e90
CWE mapping of assignBoolToFloat, strncatUsage, sizeArgumentAsChar, terminateStrncpy, bufferNotZeroTerminated, negativeArraySize, noExplicitConstructor, virtualDestructor
2016-08-14 18:23:41 +01:00
Daniel Marjamäki
f2e49b4db4
Fixed #7178 (Defect: False positive due to mistake in return type of function pointer.)
2016-08-14 17:19:14 +02:00
Daniel Marjamäki
c8667096e0
Fixed #7658 (False positive: Same iterator is used with different containers)
2016-08-14 10:49:48 +02:00
Robert Reif
73e1378af8
Fixed #7661 (False positive: Function parameter 'e' should be passed by reference.)
2016-08-13 21:25:57 +02:00
Daniel Marjamäki
2ed50fbf5a
Refactoring
2016-08-13 15:23:46 +02:00
Daniel Marjamäki
606e31602c
Fixed #7177 (Support compile_commands.json)
2016-08-13 10:50:03 +02:00
Robert Reif
fc1a755100
Fixed #7666 (Executable scope with unknown function.)
2016-08-09 14:02:06 +02:00
Daniel Marjamäki
bd21cd7c85
Fixed #6309 (FP: checkRedundantAssignment should not warn for pointer alias)
2016-08-08 21:43:00 +02:00
Daniel Marjamäki
c586ae8cbe
Revert 'project' - it is not ready yet
2016-08-07 17:10:37 +02:00
Bartlomiej Grzeskowiak
09a83f2cc8
Fixed #7567 ("(a | 7) > 6U" is always true)
2016-08-07 16:58:39 +02:00
Daniel Marjamäki
78fc307c73
1
2016-08-07 15:45:36 +02:00
Daniel Marjamäki
4dbdb50317
split
2016-08-07 15:35:41 +02:00
Daniel Marjamäki
70ccfa5947
fix loading of vcxproj files
2016-08-07 14:21:06 +02:00
Daniel Marjamäki
e0f4ce9358
vs
2016-08-07 13:55:27 +02:00
Daniel Marjamäki
f0727f2148
Merge branch 'master' into project
2016-08-06 21:05:29 +02:00
Daniel Marjamäki
09d6f4f0a4
1
2016-08-06 21:04:50 +02:00
Frank Zingsheim
47c063e13f
Fixed #7660 (cmake build does not handle simplecpp)
2016-08-06 18:21:54 +02:00
Daniel Marjamäki
a8df08f22b
Fixed #7659 (crash: Token::varId() : vxl: brdb_selection.cxx)
2016-08-06 18:07:41 +02:00
Daniel Marjamäki
b86c2689b3
TestPreprocessor: Fix output
2016-08-06 13:28:24 +02:00
Daniel Marjamäki
2f1c80560a
1.75: Set versions
2016-08-06 11:47:27 +02:00
Robert Reif
cdfe92b753
Fixed #7657 (False positive: Function parameter 'c' should be passed by reference.)
2016-08-06 10:27:00 +02:00
Daniel Marjamäki
8983997a88
Fix GCC warning
2016-08-06 10:22:58 +02:00
Daniel Marjamäki
3777db39db
Preprocessor: Mostly refactorings. Also added handling of --include.
2016-08-06 09:15:09 +02:00
Dmitry-Me
89e8f51a28
Explicit continue instead of init-set-check
2016-08-05 15:05:37 +03:00
Daniel Marjamäki
7d6c587580
Fixed #6113 (Tokenizer::simplifyFunctionPointer: wrong simplification of usage 'return (*f)();')
2016-08-04 19:10:08 +02:00
PKEuS
084fcc936c
Rephrased syntaxError message for empty configurations to improve readability:
...
Old: Invalid number of character 'c' when these macros are defined: ''.
New: Invalid number of character 'c' when no macros are defined.
2016-08-04 16:28:11 +02:00
PKEuS
ad96f7b519
Fixed wrong variable being used in CheckOther::checkPassByReference()
2016-08-04 15:30:59 +02:00
Daniel Marjamäki
9711064b74
Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop)
2016-08-04 14:39:54 +02:00
amai2012
0bec604627
Repair CWE mapping for calling obsolete functions
2016-08-04 13:55:38 +02:00
Daniel Marjamäki
2566fd09da
Fixed #5803 (False positive: Same iterator is used with different containers - insert() from range of different container)
2016-08-04 09:35:16 +02:00
Robert Reif
55b3f0bf38
Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++))
2016-08-04 09:06:32 +02:00
Dmitry-Me
7f30108f1d
Descriptive variable name
2016-08-03 18:15:08 +03:00
Robert Reif
b40edca62f
Fixed #7387 (SymbolDatabase: Wrong overloaded function is picked)
2016-08-02 23:34:11 +02:00
Robert Reif
b9030bcfcd
Fixed #7650 (SymbolDatabase: Wrong Token::type(), enum and class with same name)
2016-08-02 23:30:46 +02:00
Daniel Marjamäki
908e1b991e
Tokenizer: Refactoring simplifyPlatformTypes()
2016-08-02 19:44:18 +02:00
Daniel Marjamäki
9f59bd6dae
Try to fix travis hang
2016-08-02 19:23:45 +02:00
Robert Reif
b44f448acc
Fixed #7649 (SymbolDatabase: Wrong overloaded function is picked for char and wchar_t)
2016-08-02 18:54:01 +02:00
Daniel Marjamäki
f23287544a
Fixed #7196 (Improve check: deem sizeof(thing) as using the thing's members)
2016-08-02 18:50:04 +02:00
Daniel Marjamäki
cc62259103
Tokenizer: don't set varid on c++11 'template using' type.
2016-08-02 15:04:07 +02:00
Robert Reif
612e83d5af
SymbolDatabase: Small fix
2016-08-02 14:31:07 +02:00
Daniel Marjamäki
2187e8ba02
CheckUninitVar: Fixed FP when dereferencing multidimensional arrays. Refactoring of testing. The FP was spotted when looking at #7092
2016-08-02 14:27:51 +02:00
Daniel Marjamäki
99b23012aa
Refactoring, use Settings::platformString()
2016-08-02 10:53:51 +02:00
Robert Reif
891e21b478
Fixed #7458 (SymbolDatabase: Wrong overloaded function is picked)
2016-08-02 08:58:11 +02:00
Daniel Marjamäki
41526ef3a8
Fixed #6147 (FP unreadVariable: variable assignment in function call argument list)
2016-08-02 08:50:04 +02:00
Daniel Marjamäki
31484133c0
Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };')
2016-08-01 22:26:11 +02:00
Daniel Marjamäki
e784901303
Fixed #6971 (False positive duplicateExpressionTernary - cast ignored)
2016-08-01 21:53:43 +02:00
Daniel Marjamäki
695b1f0ef3
Fixed #5692 (Preprocessor: ifdef symbol used indirectly in code leads to 'analysis failed')
2016-08-01 20:09:41 +02:00
PKEuS
da34883770
Improved message invalidscanf: Removed misleading example from verbose message
2016-08-01 18:42:27 +02:00
Dmitry-Me
b3877a8ba0
Cleanup variable names
...
* fix typo
* use camelCase instead of underscore
2016-08-01 14:33:56 +03:00
Daniel Marjamäki
1c51fbce7a
astyle formatting
...
[ci skip]
2016-08-01 13:01:01 +02:00
Daniel Marjamäki
095b2f73f7
Library: look for cfg files in more paths, include exepath even if CFGDIR is used.
2016-08-01 12:58:33 +02:00
Daniel Marjamäki
09b6568ea2
Fixed #7646 (podtypes do not get proper valuetype)
2016-07-31 19:47:34 +02:00
Daniel Marjamäki
8d89eefff9
Merge pull request #815 from boos/cwe-mapping-8
...
CWE mapping of invalidscanf, invalidScanfArgType_s, invalidScanfArgType_int, invalidScanfArgType_float, invalidPrintfArgType_s, invalidPrintfArgType_n, invalidPrintfArgType_p, invalidPrintfArgType_int, invalidPrintfArgType_uint, invalidPrintfArgType_sint, invalidPrintfArgType_float, wrongPrintfScanfParameterPositionError
2016-07-31 14:14:48 +02:00
Daniel Marjamäki
b6246ecc55
bump simplecpp and update Preprocessor to handle new simplecpp::Output enum constants
2016-07-31 12:10:30 +02:00
Roberto Martelloni
9ab4057ddc
CWE mapping of invalidscanf, invalidScanfArgType_s, invalidScanfArgType_int, invalidScanfArgType_float, invalidPrintfArgType_s, invalidPrintfArgType_n, invalidPrintfArgType_p, invalidPrintfArgType_int, invalidPrintfArgType_uint, invalidPrintfArgType_sint, invalidPrintfArgType_float, wrongPrintfScanfParameterPositionError
2016-07-31 10:49:36 +01:00
Daniel Marjamäki
66d0d7a0ad
Fixed #7553 (False positive with 1.74 'returning an integer in a function with pointer return type' when no integer is used)
2016-07-29 21:53:58 +02:00
Daniel Marjamäki
5611a71820
Fixed #7543 (False positive boolean result used in bitwise operation)
2016-07-29 18:46:43 +02:00
Daniel Marjamäki
89be630156
Fixed #7543 (False positive boolean result used in bitwise operation)
2016-07-29 17:24:22 +02:00
Daniel Marjamäki
a65ae3ce2e
Token: Allow dollar sign in identifiers
2016-07-29 13:42:11 +02:00
Daniel Marjamäki
5546f052ef
Preprocessor: the simplecpp begin() and end() has been renamed
2016-07-29 08:51:57 +02:00
PKEuS
452ecc7ceb
Improved check: Detect passedByValue even for arguments that are not declared as "const"
2016-07-28 19:37:10 +02:00
Daniel Marjamäki
0777ecd071
Fixed #7640 (Preprocessor::getConfigs: -U is not honored)
2016-07-28 19:22:59 +02:00
Daniel Marjamäki
57951a2681
one more fix for rules
2016-07-28 15:35:41 +02:00
Daniel Marjamäki
1a4ef60e7c
Fixed #7639 (rule support partially broken since simplecpp was introduced)
2016-07-28 13:40:52 +02:00
PKEuS
3f4fe8f578
Refactorized CheckBufferOverrun:
...
- Removed redundant code
- Apply non-simplified checking in test suite
2016-07-27 17:28:43 +02:00
PKEuS
13c11b8c1d
Fixed compilation with HAVE_RULES
2016-07-26 17:10:05 +02:00
PKEuS
eafed235a6
Attempt to fix build on Unix systems, ran AStyle.
2016-07-26 16:50:32 +02:00
PKEuS
9a6569fde1
Always set ErrorMessage::file0 to ensure that the source file that cppcheck is checking when an error occurs can be identified
...
Removed unused function and unused includes from preprocessor.h/cpp
2016-07-26 16:28:40 +02:00
Dmitry-Me
560e7d618d
Get rid of "magic" patterns set
...
* magic should match "knownPatterns" but it didn't
* two identical sets are of no use
2016-07-26 16:42:17 +03:00
Daniel Marjamäki
71f62950ed
Tokenizer::findGarbageCode: Make it less picky about 'UNKNOWN_MACRO if ..'
2016-07-26 14:35:11 +02:00
PKEuS
fc1603eb9b
MathLib, ValueType: Support integer suffix "i64"
2016-07-26 13:19:53 +02:00
Daniel Marjamäki
7ff9545b10
Fixed #7637 (FP syntax error assignment in switch)
2016-07-26 12:15:55 +02:00
Daniel Marjamäki
fd19ab4ed1
fix garbage code handling
2016-07-26 08:50:00 +02:00
Dmitry-Me
2b31afe2ab
Variable name consistent with surroundings
2016-07-26 09:46:50 +03:00
Daniel Marjamäki
383b815cca
Tokenizer: refactoring garbage code handling
2016-07-26 08:16:10 +02:00
Matthias Krüger
6fd8edd6e5
Symboldatabase::sizeOfType: fix crash; fixes #7615
2016-07-26 01:18:47 +02:00
PKEuS
045116f797
Optimized SymbolDatabase::findVariableType().
2016-07-25 18:33:22 +02:00
Dmitry-Me
64360d291d
Variable name consistent with surroundings
2016-07-25 17:04:18 +03:00
Daniel Marjamäki
2feb86a6af
Preprocessor: set platform info
2016-07-25 14:52:23 +02:00
Daniel Marjamäki
90faa80590
Preprocessor: Cleanup unused functions
2016-07-25 14:29:02 +02:00
Daniel Marjamäki
7ef02a7469
Cleanup Tokenizer
2016-07-25 12:12:11 +02:00
Daniel Marjamäki
adf16fae8b
Remove handling of ##, __FILE__, __LINE__ from tokenizer
2016-07-25 07:58:03 +02:00
Daniel Marjamäki
0767284ca1
Fixed #7630 (FP: dead store, modifying array, index var modified)
2016-07-25 07:35:33 +02:00
Daniel Marjamäki
cd3818088f
Remove unused function Tokenizer::tokenizeCondition
2016-07-24 14:37:43 +02:00
Daniel Marjamäki
e9fef003ac
Preprocessor: refactoring directives, they are now only set once for each file
2016-07-24 14:02:21 +02:00
Daniel Marjamäki
48fc19b34c
Remove unused function Preprocessor::preprocessCleanupDirectives()
2016-07-24 12:51:52 +02:00
PKEuS
2e2800f5bd
Fixed several MSVC warnings
2016-07-24 12:36:36 +02:00
PKEuS
f44d9d5c9b
Optimizations in CheckInternal:
...
- Run checks only on executable scopes
- Simplified patterns
2016-07-24 12:05:58 +02:00
Daniel Marjamäki
f931c0cf2b
Preprocessor::getConfigs: Handle invalid #else better
2016-07-23 14:40:01 +02:00
Daniel Marjamäki
ed4a47de45
Tokenizer: Improve syntax checking of switch,if,while
2016-07-22 16:54:24 +02:00
Dmitry-Me
224e55780e
Add const where const access is enough
2016-07-22 15:35:07 +03:00
PKEuS
12e3cf584c
Visual Studio solution:
...
- Fixed include paths
- Export simplecpp to cppcheck-core.dll
- Added /Zc:rvalueCast
2016-07-21 20:38:58 +02:00
Daniel Marjamäki
99307846cf
Preprocessor: simplecpp optimisations
2016-07-21 19:42:26 +02:00
Daniel Marjamäki
79ac409c7d
Preprocessor: Refactoring Preprocessor::getConfigs()
2016-07-21 19:11:49 +02:00
Daniel Marjamäki
b2f1b95e38
Bump simplecpp. Preprocessor: Warn about missing includes
2016-07-21 12:47:00 +02:00
Daniel Marjamäki
9899e81f2e
handle inline suppressions in included files
2016-07-21 07:57:23 +02:00
Daniel Marjamäki
e16f0e500c
Preprocessor: Parse comments and then remove them
2016-07-21 07:48:17 +02:00
Daniel Marjamäki
8a1936d5c9
update AdditionalIncludeDirectories in vcxproj files
2016-07-20 22:17:23 +02:00
Daniel Marjamäki
4ceba79f7f
Replace std::to_string, to hopefully make appveyor happier
2016-07-20 20:43:32 +02:00
Daniel Marjamäki
f1839ebfaf
Preprocessor: Fix crashes for invalid code
2016-07-20 20:39:03 +02:00
Daniel Marjamäki
03d2829fb9
Merge simplecpp branch
2016-07-20 12:21:00 +02:00
Daniel Marjamäki
a68da1a725
ValueType: Set valuetype for sizeof argument
2016-07-20 09:39:48 +02:00
Daniel Marjamäki
3eef225b36
Revert preprocessor fix for struct tag macros. There are performance problems.
2016-07-19 18:59:58 +02:00
Matthias Krüger
18d5a7317e
fix travis; fix [lib/preprocessor.cpp:2772]: (style) The scope of the variable 'noprescan' can be reduced.
2016-07-19 17:28:31 +02:00
Mavik
3e86c7b637
Fixed #5700 (Defect: False positives due to failure to expand struct tag macros)
2016-07-19 16:52:53 +02:00
Daniel Marjamäki
9bda97975a
Fixed #7037 (32bit (-m32): testsuite fails)
2016-07-19 12:14:55 +02:00
Daniel Marjamäki
83b982064d
Fixed #7579 (varid not set properly in 'int b[] = { m * a[0] };')
2016-07-18 15:27:08 +02:00
Daniel Marjamäki
f55040a987
Fix segfault when there is no ast generated in lambda function
2016-07-18 14:08:44 +02:00
Daniel Marjamäki
0ddeac0429
refactor (use ast) and improve CheckOther::checkRedundantAssignment (warn about global variables unless they are volatile, handle arrays in lhs better)
2016-07-18 12:43:23 +02:00
Daniel Marjamäki
b9443771fb
cleanup tests
2016-07-18 10:42:03 +02:00
Daniel Marjamäki
4f051bf9dd
Fixed #7599 (valueFlowAST: handle && and || better)
2016-07-17 21:51:20 +02:00
Daniel Marjamäki
0162f33d3f
CheckSizeof: allow division with sizeof(char) when byte count is expected.
2016-07-17 19:19:15 +02:00
Daniel Marjamäki
45ee29d5dc
Fixed #7604 (simplifyCalculation: expression '0 && x[2]' is not simplified properly)
2016-07-17 15:52:53 +02:00
PKEuS
801fd8f96a
Support trailing return types (C++11)
2016-07-17 15:47:50 +02:00
Daniel Marjamäki
91e38f3eb9
Fixed #7582 (false positive: Division by result of sizeof(). strncpy() expects a size in bytes)
2016-07-17 15:22:14 +02:00
PKEuS
7a183779e2
CheckOther::checkMemsetZeroBytes(): Support wmemset()
2016-07-16 21:53:25 +02:00
Daniel Marjamäki
b8ca9fc844
Tokenizer: alternative tokens for and,or,etc. context sensitive for both c and c++.
2016-07-16 21:29:56 +02:00
Daniel Marjamäki
920ac5a3f6
astyle formatting
...
[ci skip]
2016-07-16 21:21:24 +02:00
Daniel Marjamäki
6e3d5dc0d1
Fixed #7580 (False positive when using logical operator keywords 'and', 'or')
2016-07-16 20:21:31 +02:00
amai2012
920b402d35
Merge pull request #813 from boos/cwe-mapping-7
...
CWE mapping of incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, unusedFunction, unusedVariable
2016-07-16 13:10:22 +02:00
Roberto Martelloni
25525e38a7
CWE mapping of incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, unusedFunction, unusedVariable
2016-07-16 10:07:06 +01:00
PKEuS
0afecd8fee
Do not simplify name "CALLBACK" away on non-windows platforms ( #7554 )
2016-07-16 10:43:28 +02:00
Robert Reif
768c26805c
Fixed false positive: %Ld in format string (no. 1) requires 'long long' but the argument type is 'long long' ( #7601 ).
2016-07-16 10:33:46 +02:00
Alexander Mai
e495bfb960
Use proper tokenizer variable
2016-07-10 22:24:28 +02:00
PKEuS
f869f7ebde
Fixed false positive reademptycontainer when end() is called ( #7560 )
2016-07-10 10:48:21 +02:00
Simon Martin
bae81fba05
Silent clang -Wshadow warning. ( #812 )
...
Add an optional extended description…
2016-07-09 19:07:58 +02:00
Alexander Mai
4eef5642c9
Avoid null pointer access in CheckBufferOverrun::runSimplifiedChecks
2016-07-09 19:00:59 +02:00
PKEuS
ded8d80b23
Library: Support arguments with default value. Fixed default value handling for <container> tags broken in last commit.
2016-07-09 12:44:17 +02:00
PKEuS
b5d3ecb942
Updated TinyXML, make use of second argument of XMLElement::Attribute()
2016-07-09 11:56:07 +02:00
Robert Reif
c1594bedbb
Fixed creation of SymbolDatabase for some template code ( #7594 )
2016-07-09 09:22:52 +02:00
PKEuS
44a19b527e
Use ValueFlow and SymbolDatabase to detect buffer overflows with new and malloc, improving support for enums ( #7576 )
2016-07-08 20:53:08 +02:00
Robert Reif
eca805ba3b
ValueFlow: Fixed constant folding of sizeof(enum) and sizeof(enumerator) ( #7564 )
2016-07-08 20:39:34 +02:00
PKEuS
a808549af0
Support lambdas in simplifyCompoundAssignment ( #7571 )
2016-07-08 20:10:33 +02:00
Roberto Martelloni
87372ccd58
CWE mapping of sizeofForArrayParameter, sizeofForPointer, sizeofDivisionMemfunc, sizeofwithnumericparameter, sizeofsizeof, sizeofCalculation, sizeofVoid, sizeofDereferencedVoidPointer, arithOperationsOnVoidPointer ( #810 )
2016-07-08 09:06:55 +02:00
Daniel Marjamäki
a87b4368cb
Revert "Preprocessor: Start replacing our Preprocessor code with simplecpp"
...
This reverts commit 9820783b60
.
There was Travis errors I'll need to look more at.
2016-07-07 23:45:42 +02:00
Daniel Marjamäki
9820783b60
Preprocessor: Start replacing our Preprocessor code with simplecpp
2016-07-07 22:58:56 +02:00
PKEuS
644a216394
Fixed two false positives related to char arrays initialized by a literal:
...
- Run check for writing to string literals on non-simplified token list (#7283 )
- Run buffer overrun checking for string literals on non-simplified token list (https://sourceforge.net/p/cppcheck/discussion/general/thread/2c33dfc5/ )
2016-07-07 19:38:15 +02:00
PKEuS
3bdcf68990
Fixed false positive in CheckUnusedVar::checkFunctionVariableUsage(): Bailout when break; is encountered
...
See also: https://sourceforge.net/p/cppcheck/discussion/general/thread/1c169dc5/
2016-07-07 18:27:31 +02:00
Simon Martin
40eacb19b1
Ticket #7565 : Handle numbers with several C++14 integer separators.
2016-07-01 23:24:28 +02:00
umanamente
0f11007c19
Fixed #7083 (false positive: typedef and initialization with strings)
2016-06-21 22:42:46 +02:00
PKEuS
dde6f5eaea
Do not warn about alloca() in C89 mode ( #7558 )
2016-06-20 09:30:41 +02:00
PKEuS
721bc32b2d
Fixed crash in CheckVaarg::va_list_usage() ( #7559 )
2016-06-20 09:24:23 +02:00
Bartlomiej Grzeskowiak
a5cfa2b12c
- #7522 and #7428 revisited. ((a&7)>7U) is always false and ((X|7)>=6) is correct (X can be negative).
2016-06-17 12:12:53 +02:00
Daniel Marjamäki
d1f06ff47c
Fixed #7175 (False positive performance warning (buffer overwritten before its old content has been used))
2016-06-13 15:46:43 +02:00
PKEuS
53e2cabdbb
Properly support "break" in CheckVaarg::va_list_usage() ( #7533 )
...
Ran AStyle
2016-06-07 19:28:32 +02:00
PKEuS
321d2aeafb
Set version to 1.74.99/1.75 dev
2016-06-07 19:19:58 +02:00
Roberto Martelloni
f1c39dbda7
CWE mapping of stlIfStrFind, stlcstrReturn, stlcstrParam, stlSize, ( #801 )
...
StlMissingComparison, redundantIfRemove.
2016-06-05 18:24:06 +02:00
Daniel Marjamäki
e7f1318d4b
1.74: set version
2016-06-05 18:21:33 +02:00
Daniel Marjamäki
bab4f61bb2
astyle formatting
...
[ci skip]
2016-06-05 14:14:28 +02:00
Simon Martin
3c10b25b3e
Ticket #7117 : Properly detect if a const ternary operator is in a template parameter list.
2016-06-05 14:13:32 +02:00
Robert Reif
583b340034
enum: set the return type of derived class functions returning enums defined in a base class.
2016-06-05 14:08:33 +02:00
Simon Martin
3095f47a7b
Ticket #7137 : Properly detect C++14 digit separators. ( #802 )
...
Add an optional extended description…
2016-06-04 22:55:55 +02:00
PKEuS
9a61559eca
Fixed false positive va_list_usedBeforeStarted ( #7527 )
2016-06-02 09:32:45 +02:00
Daniel Marjamäki
3eb0e9b6c0
astyle formatting
...
[ci skip]
2016-05-30 09:17:40 +02:00
Daniel Marjamäki
c24a4b9189
Removed enum mismatch checker. Ticket #6960 .
2016-05-29 18:00:37 +02:00
Robert Reif
f4dd43a71a
Fixed #7523 (Scope::findEnumerator(): does not find enum constant from other enum type)
2016-05-29 14:45:45 +02:00
Simon Martin
12a298b9cd
Ticket #7445 : Properly represent integer types smaller than int in CheckIO::ArgumentInfo.
2016-05-28 15:36:13 +02:00
Daniel Marjamäki
18fc288de9
Fixed #5582 (Crash when there is OOM)
2016-05-28 13:24:19 +02:00
Daniel Marjamäki
2b2f12bcd5
Fixed #6758 (Preprocessor: handle #__VA_ARGS__)
2016-05-28 11:27:45 +02:00
Daniel Marjamäki
cee67730b1
Fixed #5746 (Cppcheck returns error-exitcode when globally suppressed error is encounted when running with multiple jobs.)
2016-05-27 20:13:51 +02:00
PKEuS
00e4f70fe3
Fixed false positives in CheckSizeof::checkSizeofForPointerSize() ( #7518 )
2016-05-26 21:25:29 +02:00
PKEuS
373ac52480
Mention exact function name in invalidscanf message ( #5649 )
2016-05-26 21:11:33 +02:00
Daniel Marjamäki
4b903a838f
Fixed #5522 (CheckLeakAutoVar: Don't treat 'x==p' as dereference of p)
2016-05-26 19:22:38 +02:00
Daniel Marjamäki
2417f72c5e
Silence Travis
2016-05-26 18:31:52 +02:00
Daniel Marjamäki
2a42f245a9
Fixed #7130 (Wrong assignmentInAssert when using lambda in predicate function)
2016-05-26 18:29:29 +02:00
Daniel Marjamäki
54be403f64
Fixed #7026 (Cppcheck does not recognizes the use of a variabile inside lambda function)
2016-05-26 18:07:56 +02:00
Daniel Marjamäki
38741868b5
Fixed #3989 (false positive: memory leak (inline function))
2016-05-26 17:42:27 +02:00
Daniel Marjamäki
8b088a472f
SymbolDatabase: Refactoring
2016-05-26 12:04:18 +02:00
Daniel Marjamäki
f45233682e
SymbolDatabase: Code cleanup
2016-05-26 12:00:03 +02:00
Robert Reif
66cacde3db
Fixed #7513 (value flow of array dimension with enum doesn't always work)
2016-05-26 11:25:50 +02:00
Daniel Marjamäki
50352c8d69
Fixed #3552 (Don't warn about missing ctor for class inside union)
2016-05-25 19:05:16 +02:00
PKEuS
c7b3836379
Small refactorizations:
...
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
PKEuS
8c0eab3eb3
Optimization: Improved performance of CheckBufferOverrun::checkScope() when dealing with a large number of arrays ( #5975 )
...
-> checking time decreases from 1010s to 50s on the code snippet in #5975
-> Dropped a garbage code unit test
2016-05-25 14:42:00 +02:00
Daniel Marjamäki
ae97f53244
Fixed #6184 (ValueType: overloaded < operator)
2016-05-25 13:56:36 +02:00
Matthias Krüger
0556edd151
fix #7505 (crash on invalid code)
2016-05-25 13:14:34 +02:00
PKEuS
728d4242dc
Refactorizations in CheckBufferOverrun:
...
- Improved performance of CheckBufferOverrun::checkScope()
- Made some patterns less restrictive
2016-05-25 11:50:34 +02:00
PKEuS
cda246da75
Refactorized CheckUnusedVar::checkStructMemberUsage(): Reimplemented check based on symboldatabase
2016-05-25 11:13:31 +02:00
PKEuS
e22c177003
Optimized Tokenizer::setVarIdPass1(): Avoid costly std::stack<std::map<...>>::push/pop() operations for struct initializers
2016-05-24 23:15:09 +02:00
PKEuS
43bf1bb685
Refactorized CheckUnusedVar::checkStructMemberUsage(): Drastically reduced number of Token::findmatch() calls to improve performance
2016-05-24 23:10:39 +02:00
PKEuS
686cc6640e
Refactorization: Improved performance of Tokenizer::simplifyMicrosoftMemoryFunctions() and Tokenizer::simplifyMicrosoftStringFunctions()
...
- Added pre-check before doing complex Token::Match() calls
- Use std::map instead of std::set
2016-05-24 21:19:20 +02:00
PKEuS
f2ae295f1e
Support char literals in CheckCondition::checkIncorrectLogicOperator() ( #5912 )
2016-05-24 15:08:48 +02:00
Daniel Marjamäki
06a594a9e0
Fixed #6207 ('not' misinterpreted as alternative C token)
2016-05-24 13:33:21 +02:00
Daniel Marjamäki
684966f674
Fixed #7509 (ValueType: wrong type for container element - std::array)
2016-05-24 09:07:38 +02:00
Daniel Marjamäki
397480f929
Fixed #7376 (ValueType: wrong type for container element)
2016-05-23 18:53:59 +02:00
Daniel Marjamäki
37afc57a2a
Fixed #7455 (Suppressions: not working well with windows path separators)
2016-05-23 15:38:47 +02:00
Simon Martin
ce05d23bb7
No need to use std::min() in normalizeCharacterLiteral.
2016-05-22 22:59:32 +02:00
PKEuS
4bb99a7887
Improved CheckSizeof::checkSizeofForPointerSize():
...
- Support cast in front of malloc() call
- Support sizeof(type) pattern (#4428 )
2016-05-22 22:29:52 +02:00
Daniel Marjamäki
beabe110fd
setVarIdStructMembers: Fixed code so loop will terminate properly
2016-05-22 21:42:10 +02:00
Daniel Marjamäki
710e066a9a
Fixed #6406 (VarId: struct member initialization)
2016-05-22 21:18:52 +02:00
PKEuS
64d2fd2f57
Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
...
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503 )
2016-05-22 17:19:14 +02:00
PKEuS
851c6e0ed5
Improved buffer overflow checking for scanf: %c with a width ( #3494 )
2016-05-22 14:00:26 +02:00
Roberto Martelloni
dce7128f30
CWE mapping of duplicateExpression, duplicateBreak (CWE561), unreachableCode, unsignedLessThanZero, unsignedPositive, pointerLessThanZero, pointerPositive, varFuncNullUB, nanInArithmeticExpression, commaSeparatedReturn, ( #797 )
...
ignoredReturnValue
2016-05-22 13:17:38 +02:00
Daniel Marjamäki
06d5e73e88
Fixed #7471 (Tokenizer::prepareTernaryOpForAST: typedef with comma inside ?:)
2016-05-22 11:33:21 +02:00
Daniel Marjamäki
b7b92b2140
Fixed #6674 (false positive 'unusedPrivateFunction' - calling virtual function in subclass)
2016-05-21 20:07:35 +02:00
Daniel Marjamäki
c23c1f245c
Fixed #6989 (incorrect memleak error)
2016-05-21 14:03:28 +02:00
Daniel Marjamäki
a5dc76d50c
Refactoring, use ast instead of token list to find if variable is used in rhs
2016-05-21 13:45:08 +02:00
amai2012
b60b283c5b
Merge pull request #796 from simartin/ticket_7452_follow_up
...
Address comments in PR#794 and alternative fix for ticket #7500 .
2016-05-21 09:20:23 +02:00
Alexander Mai
d492500f34
#5844 False positive: returnReference fp for inner lambda function
2016-05-20 23:46:56 +02:00
Simon Martin
eb1b3db04a
Address comments in PR#794 and alternative fix for ticket #7500 .
2016-05-20 22:52:43 +02:00
Alexander Mai
303a85a930
#4195 segmentation fault of cppcheck (invalid code). Fix segfault which turned up after refactoring the enum handling code.
2016-05-17 22:19:23 +02:00
Alexander Mai
4f77a2b044
#7500 buffer overflow: encodeMultiChar lib/mathlib.cpp:343. Improve errors handling
2016-05-17 20:43:32 +02:00
Daniel Marjamäki
7453b641bd
Fixed #4839 (Variable (in array) is assigned a value that is never used)
2016-05-17 16:03:55 +02:00
Daniel Marjamäki
99fc13ee70
Fixed #6968 (unusedPrivateFunction not correct, called by inner class)
2016-05-16 20:52:50 +02:00
Daniel Marjamäki
7fffc09b17
MathLib: Add #include for VS2013
2016-05-16 20:30:53 +02:00
Daniel Marjamäki
65998f1d7c
CheckClass: previous change introduced false positives when Token::function() is wrong. Avoid those false positives.
2016-05-16 10:55:22 +02:00
Daniel Marjamäki
bce15b1ade
CheckClass: refactored the code, use symboldatabase instead of name comparisons when possible, fixed a FN.
2016-05-16 09:36:26 +02:00
amai2012
22542e7547
Merge pull request #794 from simartin/ticket_7452
...
Ticket #7452 : Properly interpret escape sequences in character literals.
2016-05-15 20:35:50 +02:00
Daniel Marjamäki
2668cee3cf
Fixed #6397 (FP deallocuse - conditional deallocation and conditional return)
2016-05-15 20:27:44 +02:00
Simon Martin
3af30e728c
Ticket #7452 : Properly interpret escape sequences in character literals.
2016-05-15 15:48:24 +02:00
Alexander Mai
9d1302d523
#7490 sizeof('a') should be sizeof(int) in C mode. Previous fix was hardcoding 4 for C.
2016-05-14 22:52:43 +02:00
Daniel Marjamäki
2cb03b3fd0
Fixed #7409 (Tokenizer: Links not set properly 'Data<T&&>')
2016-05-14 20:40:30 +02:00
Daniel Marjamäki
7591a57587
Removed redundant valuetype debug output
2016-05-14 20:11:57 +02:00
Daniel Marjamäki
5a1bea2a09
Fixed #7244 (False memory leak when POD is allocated with value initialization and pushed onto container)
2016-05-14 14:56:51 +02:00
Alexander Mai
251fc022fa
#7490 sizeof('a') should be 4 in C mode
2016-05-14 13:05:44 +02:00
Roberto Martelloni
afa8ad0ebe
CWE mapping of selfAssignment, wrongmathcall, unpreciseMathCall, memsetZeroBytes, memsetFloat, memsetValueOutOfRange, clarifyCalculation, clarifyStatement
2016-05-14 10:13:33 +01:00
Kamil Dudka
efe98883ab
checkleakautovar: do not miss 'throw' followed by ::
2016-05-13 21:37:49 +02:00
Robert Reif
5631c765a7
SymbolDatabase: better handling when array size is given with expression involving enum constants.
2016-05-13 11:40:19 +02:00
Daniel Marjamäki
1d21cf5755
Tokenizer::setVarId: Refactoring, use continue in loops
2016-05-12 18:58:24 +02:00
Daniel Marjamäki
372763c85e
Tokenizer: Refactoring, split up the big Tokenizer::setVarId() function
2016-05-12 18:20:20 +02:00
Daniel Marjamäki
b04285514f
Tokenizer: Refactoring; use early return
2016-05-12 15:51:30 +02:00
Daniel Marjamäki
613311cc57
Fixed #7493 (enumMismatch on Enum declaration)
2016-05-12 11:46:08 +02:00
Robert Reif
97bbb7da0d
Fixed #7476 (SymbolDatabase: Wrong data with single ; in line)
2016-05-12 11:35:02 +02:00
Daniel Marjamäki
99d0dbf39c
Tokenizer::setVarId: Refactoring, changed type name
2016-05-11 21:12:29 +02:00
Daniel Marjamäki
b965cf5491
Fixed #7444 (Tokenizer::varId: Wrong varid when there is anonumous union in class)
2016-05-11 20:43:23 +02:00
Daniel Marjamäki
bf8471e109
Fixed #7491 (Questionable enumMismatch)
2016-05-11 15:33:59 +02:00
Daniel Marjamäki
fb5e6d8a7d
Fixed #6960 (New check: enum variable is assigned mismatching value)
2016-05-10 20:22:35 +02:00
Daniel Marjamäki
f0fcb859c7
Tokenizer: use static keyword instead of anonymous namespace for variables
2016-05-10 16:17:52 +02:00
amai2012
3dea23c99e
Use new signature Tokenizer::createTokens
2016-05-09 17:14:51 +02:00
Daniel Marjamäki
8a13b5cd83
Fix Cppcheck warning
2016-05-09 13:08:00 +02:00
Daniel Marjamäki
9c8922541e
Avoid C++11 for-range to make AppVeyor happy
2016-05-09 13:05:08 +02:00
Robert Reif
381fa53ec6
SymbolDatabase: better handling of enum values
2016-05-09 12:40:56 +02:00
Daniel Marjamäki
eac3660f46
ValueType: Changed type info for enums to 'signed int', that is what checks wants to see mostly.
2016-05-09 11:11:13 +02:00
Daniel Marjamäki
1caa79c45f
Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code ( #6900 ). This fixes #7485 .
2016-05-08 21:32:34 +02:00
Daniel Marjamäki
e99a9b4742
SymbolDatabase: Fix cleanup (avoid dead pointers)
2016-05-08 18:34:23 +02:00
Daniel Marjamäki
6f1af2cf0a
ValueType: Set ValueType info in simplified token list
2016-05-08 17:57:26 +02:00
Daniel Marjamäki
7edb1bc2e2
Fixed #7484 (ValueType: crash with --debug --verbose)
2016-05-08 17:43:34 +02:00
Daniel Marjamäki
e355e4ac78
ValueType: Refactoring
2016-05-08 17:42:53 +02:00
Daniel Marjamäki
803b4d4cf8
ValueType: Better handling of nested types
2016-05-08 14:55:10 +02:00
Daniel Marjamäki
636e97c272
ValueType: Improved debug output for nested types
2016-05-08 13:15:20 +02:00
Daniel Marjamäki
f0953c6916
ValueType: better handling of nonstandard types
2016-05-08 11:55:25 +02:00
Daniel Marjamäki
b94eaeca6a
ValueFlow: For convenience, return constant folded value
2016-05-08 11:17:10 +02:00
Daniel Marjamäki
b26dd1ccab
ValueFlow: Handle enums
2016-05-07 20:18:07 +02:00
Daniel Marjamäki
ad2d3394c8
Tokenizer: Create syntax tree before creating symboldatabase
2016-05-07 19:56:28 +02:00
Daniel Marjamäki
be90080976
Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum)
2016-05-07 19:51:37 +02:00
Alexander Mai
4e9afac92f
Update Makefile. Replace another NULL by nullptr
2016-05-07 17:35:00 +02:00
amai2012
eba1b0881d
Minor refactoring: use nullptr (instead of 0/NULL), change signature of Tokenizer::createTokens
2016-05-07 16:30:54 +02:00
PKEuS
5d5886b464
Properly detect binary & in CheckCondition::clarifyCondition() (fixes false positives when self-checking cppcheck)
2016-05-06 17:39:41 +02:00
PKEuS
896582ce56
Fixes for CheckStl::string_c_str():
...
- Fixed false positive #7480
- Fixed false negative: Show performance message also for non-local objects
2016-05-06 17:25:00 +02:00
PKEuS
3366a74bb0
Refactorized CheckCondition::clarifyCondition():
...
- Reimplemented parts of the check based on ValueType
- Merged two loops
Fixed some type conversion messages
2016-05-06 15:22:45 +02:00
PKEuS
0bf85f9aa5
ValueType: Support integers defined in libraries ( #7394 )
2016-05-04 15:39:56 +02:00
PKEuS
6c3f0a7bb8
SymbolDatabase: Properly detect lambdas with return type ( #7473 )
2016-05-04 14:10:09 +02:00
PKEuS
f0fb7a8245
Simplify __attribute__ earlier ( #7462 )
2016-05-04 13:51:34 +02:00
PKEuS
17ccb0fbe6
CheckClass::checkMemsetType(): Skip arrays of pointers ( #7456 )
2016-05-04 13:38:36 +02:00
PKEuS
21b51dd235
Check64BitPortability::pointerassignment(): Skip over lambdas ( #7451 )
2016-05-04 13:23:50 +02:00
PKEuS
b65cacf4b1
Tokenizer::simplifyStaticConst(): Support "struct" and operator:: ( #7403 )
2016-05-04 12:33:19 +02:00
PKEuS
f23668dfcc
Fixed false positive doubleFree ( #7401 )
2016-05-04 12:14:42 +02:00
PKEuS
23202d9442
Fixed bailoutFunctionPar() for temlate functions ( #7396 )
2016-05-04 11:38:29 +02:00
PKEuS
b7d8cd69f6
Fixed false negatives in CheckStl::string_c_str():
...
- Support more complex patterns (#7385 )
- Use same logic for string_c_strReturn() as for string_c_strError()
2016-05-04 11:10:12 +02:00
Roberto Martelloni
01aaa56740
CWE mapping of redundantCopy, redundantAssignment, constStatement, charBitOp, variableScope, redundantAssignInSwitch, redundantCopyInSwitch, switchCaseFallThrough
2016-04-29 18:01:37 +01:00
amai2012
a54ec615f3
Run astyle
2016-04-25 11:12:35 +02:00
amai2012
479f00030e
Restore compatibility with current C++ language set specification (VS2010)
2016-04-24 23:02:56 +02:00
amai2012
7a8a6695a4
Merge pull request #786 from prozak/master
...
- fix for #5749 defect: internal error
2016-04-24 22:19:02 +02:00
Daniel Marjamäki
0635ceb42a
Replaced C++11 auto keyword
2016-04-23 09:18:28 +02:00
Robert Reif
ee2be81fae
enums: Fix false negatives caused by new enum handling
2016-04-22 20:26:58 +02:00
PKEuS
7ff90e7fae
Set version to 1.73.99/1.74 dev
2016-04-22 16:55:19 +02:00
prozak
6592638022
- fix for #5749 defect: internal error
...
typedef expansion in cast operator was not processed correctly
2016-04-22 21:39:03 +08:00
Daniel Marjamäki
2a719bd194
Use simpleMatch for simple pattern
2016-04-22 06:52:37 +02:00
Daniel Marjamäki
dc2a92263a
Fixed #7426 (RFC: time to replace simplifyEnum?)
2016-04-22 06:02:54 +02:00
Daniel Marjamäki
00a584d8d1
astyle formatting
2016-04-22 06:01:34 +02:00
Bartlomiej Grzeskowiak
7e020e1d92
- fix for #7428 false negative: Statement is always false
2016-04-14 14:50:08 +02:00
Roberto Martelloni
e89cd1b8a4
CWE mapping of unsafeClassCanLeak, zerodivcond, invalidPointerCast, redundantCopy, redundantAssignment, comparisonFunctionIsAlwaysTrueOrFalse, checkCastIntToCharAndBack, cstyleCast, passedByValue, clarifyCondition, exceptThrowInDestructor, exceptDeallocThrow, exceptRethrowCopy, catchExceptionByValue, fflushOnInputStream, seekOnAppendedFile, publicAllocationError
...
CWE mapping of unsafeClassCanLeak, zerodivcond, invalidPointerCast, redundantCopy, redundantAssignment, comparisonFunctionIsAlwaysTrueOrFalse, checkCastIntToCharAndBack, cstyleCast, passedByValue, clarifyCondition, exceptThrowInDestructor, exceptDeallocThrow, exceptRethrowCopy, catchExceptionByValue, fflushOnInputStream, seekOnAppendedFile, publicAllocationError
2016-04-12 19:29:40 +02:00
Daniel Marjamäki
b6d3aefba6
1.73: Set versions
2016-04-08 20:46:59 +02:00
amai2012
f5e8a72dc2
#7438 Incorrect alloca() avoidance suggestion
2016-04-08 11:21:53 +02:00
Robert Reif
47634a0ada
Fixed #7420 ((debug) Executable scope 'foo' with unknown function.)
2016-03-22 14:10:20 +01:00
Daniel Marjamäki
ac8341e3de
keep type suffixes after constant folding using bit operations
2016-03-21 21:20:02 +01:00
Daniel Marjamäki
4e4873772d
Fixed #7395 (ValueType: Result type of assignment operators)
2016-03-21 19:51:09 +01:00
Daniel Marjamäki
072120d19f
TemplateSimplifier::templateParameters: Handling r-value arguments
2016-03-18 11:09:41 +01:00
Robert Reif
100c4276ea
Fixed #7424 (value type: wrong sign)
2016-03-18 10:30:57 +01:00
Dmitry-Me
12a5f2509b
These conditions are mutually exclusive
2016-03-03 18:01:15 +03:00
Dmitry-Me
3bcd0e0535
Reduce variable lifetime
2016-03-02 19:07:20 +03:00
Daniel Marjamäki
253bfe432c
Fixed #7410 (Tokenizer: function pointer with throw())
2016-02-29 08:02:02 +01:00
Daniel Marjamäki
c5c376513b
Fixed #7102 (Preprocessor: skip __cplusplus sections in headers when .c file is checked)
2016-02-29 07:34:06 +01:00
Alexander Mai
0533d7bf9c
Run astyle + minor refactoring
2016-02-27 16:03:50 +01:00
Roberto Martelloni
d3645d874e
Mapped toomanyconfigs ,AssignmentAddressToInteger
...
,AssignmentIntegerToAddress ,CastIntegerToAddressAtReturn
,CastAddressToIntegerAtReturn ,assertWithSideEffect ,assignmentInAssert
,uselessAssignmentArg ,uselessAssignmentPtrArg
,comparisonOfFuncReturningBoolError
,comparisonOfTwoFuncsReturningBoolError ,comparisonOfBoolWithBoolError
,incrementboolean ,comparisonOfBoolWithInt ,compareBoolExpressionWithInt
,negativeIndex ,pointerOutOfBounds ,arrayIndexThenCheck
,possibleBufferAccessOutOfBounds ,argumentSize
,arrayIndexOutOfBoundsCond ,noConstructor ,copyCtorPointerCopying
,noCopyConstructor ,uninitMemberVar ,operatorEqVarError
,unusedPrivateFunction ,memsetClassFloat ,mallocOnClassWarning
,operatorEq ,thisSubtraction ,operatorEqRetRefThis ,operatorEqToSelf
,useInitializationList ,duplInheritedMember ,assignIfError
,comparisonError ,multiCondition ,mismatchingBitAnd
,oppositeInnerCondition ,incorrectLogicOperator ,redundantCondition
,moduloAlwaysTrueFalse to their CWEs ids.
2016-02-26 23:53:52 +00:00
Alexander Mai
41dee7f970
#7399 CMake error: Cannot specify link libraries for target 'testrunner' (reported by user dbuchholz). Add comment to mathlib.h
2016-02-19 21:40:31 +01:00
Alexander Mai
5c2960713f
Correct false positives compareBoolExpressionWithInt (0U)
2016-02-19 21:38:54 +01:00
Robert Reif
0fc59d0228
#7069 False positive invalidPrintfArgType_uint - %lu with 0ul
2016-02-19 10:12:47 +01:00
Daniel Marjamäki
d964825c9f
ValueType: Add debug output that is shown when --verbose is used
2016-02-15 16:18:24 +01:00
Alexander Mai
17bb07d522
#6913 max-configs=1 buggs out includefile resolving in case of circular dependency. Use simplified paths for internal list of includes parsed already
2016-02-14 11:51:18 +01:00
Daniel Marjamäki
6c324013e7
Use MAXTIME in templatesimplifier
2016-02-12 12:05:32 +01:00
Daniel Marjamäki
cef6b35bb8
Improve MAXTIME handling
2016-02-11 16:10:52 +01:00
Dmitry-Me
1f27c4b76b
Merge pull request #771 from Dmitry-Me/charUsedAsArrayIndex
...
Portability warning when 'char' type is used as array index
2016-02-10 20:11:38 +03:00
Daniel Marjamäki
3da997e163
astyle formatting
...
[ci skip]
2016-02-08 10:44:04 +01:00
Daniel Marjamäki
1ab5805d98
Fixed #6616 (valueFlowForward: for loop, variable in 3rd expression is changed in loop body)
2016-02-08 10:43:41 +01:00
Dmitry-Me
c3399493ef
Portability warning when 'char' type is used as array index
2016-02-08 10:08:35 +03:00
Daniel Marjamäki
c63d5cb1ae
CheckLeakAutoVar: fix in VarInfo::erase for referenced.
2016-02-07 19:54:32 +01:00
Daniel Marjamäki
a361f0192d
More CheckLeakAutoVar debug output
2016-02-07 19:53:55 +01:00
Daniel Marjamäki
34b5e0ce99
Fixed #6873 (False positive uninitvar - variable initialized via pointer)
2016-02-07 18:48:57 +01:00
Daniel Marjamäki
5fef7cc050
Fixed #4973 (wrong enum simplification of shadow struct variable)
2016-02-07 15:15:20 +01:00
Daniel Marjamäki
6c1012a8d6
Fixed #4625 (wrong enum simplification in shadowed enum declaration)
2016-02-07 13:51:03 +01:00
Daniel Marjamäki
f781f13997
Fixed #6806 (wrong enum simplification in initialization list)
2016-02-07 13:34:03 +01:00
PKEuS
f8bf2b5776
Removed rest of variableHidingTypedef and variableHidingEnum checking
2016-02-06 20:55:41 +01:00
Daniel Marjamäki
42278dd133
Tokenizer: skip constant folding in normal token list for C code. In C++ code we should only fold constants in template arguments.
2016-02-06 17:25:51 +01:00
amai2012
d25258359a
#7251 Remove checks variableHidingTypedef and variableHidingEnum
2016-02-06 15:37:58 +01:00
Daniel Marjamäki
7bd034c009
Fixed #7369 (False positive knownConditionTrueFalse - assertions)
2016-02-06 14:37:44 +01:00
PKEuS
b3a0d418e6
Refactorization: Compare only as much characters as necessary in Preprocessor
...
Fixed internal message
2016-02-05 21:06:07 +01:00
PKEuS
c66db46f66
Use ValueType in CheckOther::checkSignOfUnsignedVariable()
...
Fixed travis: replaced std::string::pop_back by std::string::substr
2016-02-05 20:43:06 +01:00
PKEuS
0847d3d19a
ValueType related bugfixes:
...
- ptrdiff_t is SIGNED
- Detect pointers to unknown types as pointers
- Do not identify bool* as boolean (#7381 )
2016-02-05 20:29:17 +01:00
PKEuS
b4b38fb7ce
Use ValueType in CheckOther::invalidPointerCast()
...
False negative: operator new is currently not supported by ValueType.
2016-02-05 20:28:43 +01:00
PKEuS
4b3feebbcd
Refactorization: Reordered some conditions in checktype.cpp
2016-02-05 20:28:43 +01:00
PKEuS
6215a48dc9
Support member variables in CheckBool::checkAssignBoolToFloat()
2016-02-05 20:28:42 +01:00
PKEuS
e71e9bd538
CheckBool: Rely on ValueType, removed a redundant check
2016-02-05 15:48:51 +01:00
PKEuS
618ea498e9
ValueType: Support logical operators
2016-02-05 15:15:13 +01:00
PKEuS
35317695d4
ValueType: Fixed handling of constness
2016-02-05 13:31:31 +01:00
PKEuS
792835cd9a
ValueType: Support ++/--.
2016-02-05 12:06:44 +01:00
PKEuS
2b179dc836
ValueType: Properly support ternary operator with pointers ( #7378 )
2016-02-05 09:59:48 +01:00
Daniel Marjamäki
07f3930923
report progress in TemplateSimplifier::simplifyTemplateInstantiations, as far as I see it can be very slow
2016-02-05 07:59:29 +01:00
PKEuS
3b7948fb4e
ValueType: Support ternary operator
2016-02-04 21:20:05 +01:00
PKEuS
a9f52aec04
ValueType: Support unary arithmetical/bit operators
2016-02-04 21:03:54 +01:00
PKEuS
cae19cadd3
ValueType: Added support for static member variables and simplified code
2016-02-04 20:49:13 +01:00
PKEuS
b801386ac8
Fixed bug in Token::findClosingBracket() and broken unit test ( #7277 )
2016-02-04 10:00:54 +01:00
Alexander Mai
d3546ea410
#7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration
2016-02-03 22:49:57 +01:00
Alexander Mai
cfe9c01bf8
#7257 segmentation fault in valueFlowSwitchVariable (invalid code). Correct SymbolDatabase::validateVariables() so it does not complain about function arguments for function without body
2016-02-03 21:52:02 +01:00
PKEuS
bd61b9e7b7
Merge pull request #776 from boos/cwe-mapping-0
...
Mapped 17 error ids to their CWEs …
2016-02-03 17:54:53 +01:00
Alexander Mai
d45f5c94cb
Add (disabled) function in SymbolDatabase to check variable list (e.g. find variables w/o scope). Fix some doxygen warnings.
2016-02-03 17:08:46 +01:00
Roberto Martelloni
50fc784550
Mapped error ids stlBoundaries, stlcstr, useAutoPointerContainer, useAutoPointerArray, sprintfOverlappingData, strPlusChar, shiftTooManyBits, integerOverflow, uninitstring, uninitdata, uninitvar, uninitStructMember, deadpointer, va_start_referencePassed, va_end_missing, va_list_usedBeforeStarted, va_start_subsequentCalls to their CWEs.
2016-02-03 12:53:23 +00:00
Alexander Mai
d12197ce1a
Minor refactoring, removing a redundant condition introduced in the previous changeset
2016-02-03 12:54:44 +01:00
Alexander Mai
ca2e3b9abb
#7370 False positive uselessCallsCompare on unknown type. Ensure related warnings are only issued on STL types
2016-02-02 20:26:02 +01:00
PKEuS
e063e97831
Fixed bug in Token::swapWithNext(): swap _link correctly
2016-02-02 17:47:36 +01:00
PKEuS
d8b75e3492
Fixed several bugs when deleting and swapping tokens
2016-02-02 17:30:14 +01:00
PKEuS
841f17776b
Set ValueType for assignment operators, detect division by zero for %= and /= again ( #7322 )
2016-02-02 17:17:55 +01:00
PKEuS
4b9241f643
Removed support for patterns like |a|b and a||b (equal to a|b|)
...
-> Improved performance by 1,3% (non-matchcompiled build)
2016-02-02 11:46:42 +01:00
PKEuS
d19b5031fa
Refactorization: Removed unused function.
2016-02-02 11:46:42 +01:00
Alexander Mai
89c9528fdc
Small optimization of TokenList::validateAst()
2016-02-02 08:55:26 +01:00
Daniel Marjamäki
39a5400b7d
Fix xml output for invalid chars ( #6431 )
2016-02-01 18:53:46 +01:00
Alexander Mai
a288d5eb16
#7027 TokenList::validateAst() did not detect broken AST with endless recursion
2016-01-31 22:16:58 +01:00
Daniel Marjamäki
5784aec407
Settings: fixed defaultSign, it only applies to char
2016-01-31 14:40:06 +01:00
Daniel Marjamäki
988918c9bc
ValueType: Use signed as default sign for short/int/long/longlong
2016-01-31 14:34:26 +01:00
PKEuS
c831577322
Removed handling of misspelled error ID stlBoundaries in Suppressions
2016-01-31 14:06:47 +01:00
Daniel Marjamäki
b54613a942
Fixed #7046 (constexpr value used as template parameter reported as not used)
2016-01-31 12:39:43 +01:00
PKEuS
9d2258677d
Improved CheckOther::checkUnusedLabel(): Write a warning instead of a style message if it happens inside a switch()
2016-01-31 12:07:24 +01:00
Daniel Marjamäki
c7f5ca74bd
VarId: Set varid for template parameters ( #7046 )
2016-01-31 11:07:30 +01:00
PKEuS
6d0c2f7253
Fixed false positive useClosedFile when noreturn function is called ( #7359 )
2016-01-31 10:39:35 +01:00
PKEuS
0e8777ec99
Fixed crash on garbage code ( #7356 )
2016-01-31 10:25:09 +01:00
PKEuS
c31f7c7a48
Improved flags in gui.pro:
...
- shlwapi.lib is not necessary if dynamic linking is used
- Do not define _CRT_SECURE_NO_WARNINGS explicitly, it gets defined anyway.
2016-01-31 10:10:48 +01:00
PKEuS
4d01af3fe1
Fixed false positive in CheckMemoryLeakStructMember when returning a member that has been allocated ( #7302 ).
2016-01-31 10:10:48 +01:00
Daniel Marjamäki
f6161c6f89
CheckUnusedVar: My fix for #4955 was a quick fix causing false negatives. Fix some FN and add TODO to handle other FN better.
2016-01-31 09:11:52 +01:00
Daniel Marjamäki
d5884692df
Fixed #7363 (valueflowOppositeCondition - if (size1 > size2) ... else if (size1 < size2) ...)
2016-01-30 22:13:03 +01:00
PKEuS
3b046b42a6
Support function pointers in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes() ( #7194 )
2016-01-30 20:59:55 +01:00
Daniel Marjamäki
b908bb18a9
Fixed #5503 (FP: Uninitialized variable - initialize in in if and else branch)
2016-01-30 20:48:28 +01:00
PKEuS
923f7f843d
Better distinguishing between possible and known null pointer dereferenciations ( #7157 )
2016-01-30 20:43:40 +01:00
Matthias Krüger
11be3a9265
fix internal warning: [lib/valueflow.cpp:722]: (warning) Found simple pattern inside Token::Match() call: "if ("
2016-01-30 20:34:33 +01:00
PKEuS
5d9f275ff8
Fixed false positive uninitMemberVar with member function of template ( #7205 )
2016-01-30 20:18:13 +01:00
PKEuS
23ad881c64
Fixed false positive returnLocalVariable ( #7180 )
2016-01-30 20:18:12 +01:00
Daniel Marjamäki
30f2bb7796
ValueFlow: set known value for opposite condition in else if ( #5503 )
2016-01-30 20:03:55 +01:00
Daniel Marjamäki
fd67ca146d
Fixed #4955 (false positive: Variable 'i' is assigned a value that is never used (only used in template instantiation))
2016-01-30 16:49:39 +01:00
Daniel Marjamäki
0e89620212
Fixed #4698 (False positive: Uninitialized member variable warning with confusing namespaces)
2016-01-30 14:04:48 +01:00
Daniel Marjamäki
f3f9ea2d09
TemplateSimplifier: One more fix for #3130 . Restored max recursion count to 100 and improve pattern for reference template instantiations instead.
2016-01-30 11:22:44 +01:00
Daniel Marjamäki
f116de678e
Fixed #3130 (Tokenizer: Doesn't instantiate recursive template correctly)
2016-01-30 10:33:25 +01:00
Daniel Marjamäki
fa31ebf88e
Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of())
2016-01-29 08:55:46 +01:00
Daniel Marjamäki
b5986f6ad2
Fixed #7358 (valueflow: value is not known after conditional assignment)
2016-01-27 19:20:00 +01:00
Alexander Mai
1dac1664be
7357 segmentation fault in TokenList::insertTokens
2016-01-26 19:12:57 +01:00
Daniel Marjamäki
462b98afbc
Fixed #7310 (ValueFlow: Value of NULL in function call)
2016-01-26 16:53:01 +01:00
Daniel Marjamäki
5c9be4a0df
Fixed #7216 (ValueFlow: known value in condition)
2016-01-26 16:10:15 +01:00
Daniel Marjamäki
c0056d2455
Fixed #7347 (AST: wrong ast when template variable is declared and initiailized in if 'if (A::B<C> abc = 123)')
2016-01-26 10:40:44 +01:00
Daniel Marjamäki
40e14f401f
CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems
2016-01-26 10:08:21 +01:00
Daniel Marjamäki
a391bca060
Fixed #7350 (ValueFlow: Result of 'x & 0' is always 0)
2016-01-26 10:07:42 +01:00
Daniel Marjamäki
5e10e680da
CWE: refactoring. use constants instead of magic numbers.
2016-01-25 20:01:48 +01:00
Daniel Marjamäki
0fb9ab7b4a
Refactoring CheckMemoryLeakNoVar::checkForUnusedReturnValue(). use continue
2016-01-25 10:33:11 +01:00
Daniel Marjamäki
7663b6ee75
Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;')
2016-01-25 10:29:24 +01:00
Roberto Martelloni
5ce69da02d
Mapped 26 errors to their CWEs ID.
2016-01-24 20:53:05 +00:00
Daniel Marjamäki
659cd96b03
Fixed #7209 (False positive: Array index used before limits check reported in sizeof)
2016-01-24 14:06:02 +01:00
Daniel Marjamäki
6faa637fc7
Fixed #6537 (False positive badBitmaskCheck - error in valueflow)
2016-01-24 13:45:44 +01:00
Daniel Marjamäki
a8416bfb16
Fixed #6000 (ValueFlow: conditional code in for loops)
2016-01-24 13:11:51 +01:00
Daniel Marjamäki
76cdfbf487
Fixed #6330 (valueflow: condition is always false first iteration in dowhile loop)
2016-01-24 08:57:57 +01:00
Daniel Marjamäki
26612ab846
Fixed #5332 (Tokenizer: if braces not added properly 'if (x==123) label: {}')
2016-01-23 11:43:48 +01:00
Daniel Marjamäki
3d0338e9f9
Fixed #7212 (incorrectly adding function argument with no name)
2016-01-23 09:48:21 +01:00
Daniel Marjamäki
2627aada07
Fixed #7346 (Tokenizer::setVarId: No varId for member in initialization list)
2016-01-23 08:28:04 +01:00
Daniel Marjamäki
f64930b7f5
Fixed #7343 (SymbolDatabase: handling of override)
2016-01-22 19:22:24 +01:00
Daniel Marjamäki
8568a80208
Fixed #6883 (Template parsing error)
2016-01-20 16:10:58 +01:00
Dmitry-Me
58541f7ffa
Check string has expected format before processing it
2016-01-20 16:46:15 +03:00
Daniel Marjamäki
642cc57428
CheckMemoryLeak: Fix FP when overloaded new is used
2016-01-20 10:34:03 +01:00
Daniel Marjamäki
4a3ece5847
CheckNullPointer: Fix FP for 'buf[p]' when p is NULL
2016-01-20 08:42:58 +01:00
Daniel Marjamäki
ab441f3fb1
Tokenizer:vardecl: split up reference variables declared in class better
2016-01-19 15:27:11 +01:00
Daniel Marjamäki
a434e0fb1a
Fixed #7272 (Tokenizer:setVarId: handle namespaces better)
2016-01-19 14:32:27 +01:00
Daniel Marjamäki
dc5e2d5c8d
xml: output file0 whenever it is different to filename, both for included files and when #line is used.
2016-01-19 07:01:21 +01:00
Daniel Marjamäki
79aec559d5
Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause)
2016-01-18 16:10:51 +01:00
Daniel Marjamäki
5a28bce631
Merge pull request #763 from Dmitry-Me/changeSuspiciosVariableType
...
This variable type looks very suspicious
2016-01-18 15:46:57 +01:00
Daniel Marjamäki
b9a4a950a2
Fixed #7144 (Tokenizer::isScopeNoReturn: handling '{ { throw new string(..); } }')
2016-01-18 15:39:20 +01:00
Dmitry-Me
afe659cc88
This variable type looks very suspicious
2016-01-18 09:52:35 +03:00
Daniel Marjamäki
d656e3a056
Fixed #7103 (isReturnScope: handling 'return (bstr){0};')
2016-01-17 12:38:49 +01:00
Daniel Marjamäki
522de81cc7
Refactoring: Move isReturn() to astutils and rename it to isReturnScope()
2016-01-16 18:52:34 +01:00
Daniel Marjamäki
d39097f52a
Removed redundant null pointer check
2016-01-16 14:15:51 +01:00
Daniel Marjamäki
ca7ec25b92
Merge pull request #708 from siemens/preprocessor-directives-for-addons-v2
...
Add preprocessor directives dump and Y2038 addon
2016-01-16 12:28:14 +01:00
Matthias Krüger
7b1710a44f
redundantAssignment: change from severity 'performance' to 'style' since avoiding unneccessary stores is a basic optimization done by compilers.
2016-01-15 22:01:40 +01:00
Roberto Martelloni
bb6880919c
CWE mapping
2016-01-15 17:07:14 +01:00
Akhilesh Nema
4aa2876ca0
Fixed #7278 (GUI: error rechecking with some files)
2016-01-15 16:52:22 +01:00
Dmitry-Me
26788a1dc1
Remove repeated code, better variable name
2016-01-15 17:20:40 +03:00
Albert ARIBAUD (3ADEV)
38e70dfb74
Preprocessor directives for addons
...
This patch augments the XML dumps with a 'directivelist'
subnode which lists all raw preprocessor directives met
while reading the source code in each configuration.
Also, the addons/cppcheckdata.py file has been extended
to give easy access to the list of directives and to
provide Python support for the --template (or short -t)
option.
Finally, an new addon, addons/y2038/y2038.py, is created
to detect when a glibc symbol might be Y2038-sensitive,
based on whether and how _TIME_BITS and _USE_TIME_BITS64
are defined when meeting the symbol.
2016-01-15 12:36:35 +01:00
Dmitry-Me
7bf88fbb09
Use substr() instead of assignment plus erase()
2016-01-15 14:22:08 +03:00
Robert Reif
966d078dcc
CheckIO: Fix FN when using '%x' as format specifier for a 'signed int' variable
2016-01-15 09:29:29 +01:00
PKEuS
1bbb82ab2b
Merge pull request #753 from Dmitry-Me/mergePatterns
...
Merge overlapping patterns
2016-01-14 08:25:07 +01:00
Dmitry-Me
f14814e002
Reorganize duplicated patterns
2016-01-14 10:00:07 +03:00
Daniel Marjamäki
8e2f7812fd
CheckString: Fix FP when macros are used.
2016-01-13 20:32:40 +01:00
Matthias Krüger
e9e496199c
CheckOther::memsetZeroBytesError: remove now unused parameter.
...
was:
lib/checkother.cpp:1116:76: warning: unused parameter ‘varname’ [-Wunused-parameter]
void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname)
^
2016-01-12 23:55:02 +01:00
Alexander Mai
7802517a69
#7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg.
2016-01-12 23:20:48 +01:00
Daniel Marjamäki
8e79e5c1d3
Fixed #7147 (TemplateSimplifier: specialized template class with inheritance)
2016-01-11 18:45:12 +01:00
Dmitry-Me
499e15d96a
Cleanup variable names, omit redundant actions
2016-01-11 13:04:52 +03:00
Daniel Marjamäki
f8306383b1
Remove redundant variable
2016-01-10 22:30:24 +01:00
Daniel Marjamäki
414bdc30a9
Fixed #7276 (VarId: Missing varId in template class constructor initialization lists)
2016-01-10 22:10:49 +01:00
Daniel Marjamäki
760d5ab7f9
Try to fix travis. use Token::simpleMatch instead of Token::Match.
2016-01-10 21:00:42 +01:00
Daniel Marjamäki
4269702755
Fixed #7266 (False positive shiftTooManyBits with macros)
2016-01-10 20:44:52 +01:00
Daniel Marjamäki
b3208fb4b3
Fixed #7211 (False positive: Finding the same expression on both sides of an operator (enumconstant == 0))
2016-01-10 11:21:43 +01:00
PKEuS
f47e05b6a7
Set version to 1.72.99/1.73 dev
2016-01-10 10:10:33 +01:00
Daniel Marjamäki
890ceea3bf
1.72: Set version
2016-01-09 14:41:54 +01:00
Daniel Marjamäki
7191733981
Fixed #7192 (False positive: uninitMemberVar when base class is in another namespace)
2016-01-09 12:18:36 +01:00
Daniel Marjamäki
bcba1a7130
platforms: set bit values when --platform=<file> is used
2016-01-09 10:26:48 +01:00
PKEuS
8f493612e6
Refactorization: Removed unused function declaration from Tokenizer and fixed prototype of SymbolDatabase::cppcheckError
2016-01-09 09:34:31 +01:00
PKEuS
37fefe3479
Removed non-standard code annotations with __attribute__
2016-01-09 09:33:56 +01:00
Daniel Marjamäki
0b9d8ae0f1
astyle formatting
...
[ci skip]
2016-01-08 15:24:05 +01:00
Aleksandr Pikalev
e92bbf6481
Fixed #7275 - Make GUI tests buildable
...
* Use -std=c++11 flag for gcc and clang
* Use $$PWD variable in qmake files to have correct paths
* Change tokenizer.simplifyTokenList() to tokenizer.simplifyTokenList2()
* Add build-generated files to .gitignore
* Link libpcre only if rules are enabled
2016-01-08 15:21:36 +01:00
amai2012
bd2892fde4
Ticket #7270 segmentation fault (invalid code) in Tokenizer::simplifyLabelsCaseDefault. include fix for cygwin
2016-01-08 11:59:02 +01:00
Daniel Marjamäki
794e64bb29
Platforms files: Added unix32-unsigned and unix64-unsigned. Not sure what extension to use for platform files, chose .xml now.
2016-01-08 11:17:32 +01:00
Daniel Marjamäki
ec733e7e71
CLI: added --platform=<file> interface
2016-01-07 20:19:08 +01:00
Daniel Marjamäki
a014920280
Fixed #7260 (ValueType: in C++ the result of 'sint >> unknowntype' has unknown type)
2016-01-07 10:46:19 +01:00
Daniel Marjamäki
88a525aca7
Fixed #7267 (Tokenizer::setVarId: wrongly sets varId in cast with unknown type)
2016-01-06 17:47:59 +01:00
Daniel Marjamäki
b2386fa011
minor refactoring, use 'else if' when appropriate
2016-01-06 15:49:44 +01:00
Daniel Marjamäki
c70764631f
Merge pull request #749 from Godin/master
...
"cppcheck --errorlist" should include "assignBoolToFloat"
2016-01-05 20:39:57 +01:00
Roberto Martelloni
5c1965a6e0
Added mapped CWE IDs to reportErr function calls
2016-01-05 20:37:39 +01:00
Daniel Marjamäki
58e28cb00e
ValueType: Better handling of unsigned unknown types
2016-01-05 19:47:11 +01:00
Evgeny Mandrikov
fed4bb1b8f
"cppcheck --errorlist" should include "assignBoolToFloat"
2016-01-05 18:42:49 +01:00
Daniel Marjamäki
125d2f7a36
Some initial support for platforms that doesn't have 8-bit char
2016-01-05 13:16:00 +01:00
Daniel Marjamäki
a0971355b7
Tweaked Tokenizer::simplifyAsm2()
2016-01-04 19:18:10 +01:00
Albert ARIBAUD (3ADEV)
df91caafa1
Fix trim() in lib/Preprocessor.cpp
...
Currently, if its argument is all spaces and tabs,
trim() returns it without actually trimming it.
Fix this by returning an empty string in this case.
Also, drop a useless test: if we did not return ""
then beg is not equal to std::string::npos, and in
that case, neither is end.
2016-01-04 16:37:36 +01:00
Daniel Marjamäki
1db9cf4d09
SymbolDatabase: Add '#include <cctype>' for std::isalpha
2016-01-04 14:20:07 +01:00
Daniel Marjamäki
b748453b30
Tokenizer: Improve handling of block declarations (C extension)
2016-01-04 09:59:53 +01:00
Daniel Marjamäki
036306d7c2
Refactoring Tokenizer::startOfExecutableScope(). Improve and reuse Tokenizer::isFunctionHead().
2016-01-03 22:52:24 +01:00
Alexander Mai
d6fd4705cf
#7255 segmentation fault (invalid code) in CheckMemoryLeakInFunction::getcode
2016-01-03 20:53:03 +01:00
Daniel Marjamäki
7e585d37bc
Tokenizer: Remove startOfFunction() and use isFunctionHead() instead.
2016-01-03 19:06:11 +01:00
Daniel Marjamäki
79e663dd6f
Settings: Remove '_' prefix for public member variables
2016-01-03 16:18:17 +01:00
Daniel Marjamäki
8dccbfefcf
ValueType: handle lowercase number suffix, for instance '0ll'
2016-01-03 13:34:47 +01:00
Daniel Marjamäki
cd89e68f60
Fixed #6931 (noexcept and override qualifiers plus less than operator results in a syntax error)
2016-01-03 12:22:07 +01:00
Daniel Marjamäki
91d0f0fee0
astyle formatting
...
[ci skip]
2016-01-03 09:38:03 +01:00
Daniel Marjamäki
ed12b4dc44
Fixed #7253 (AST wrong on nested reinterpret_cast)
2016-01-03 09:37:38 +01:00
Daniel Marjamäki
4ff7fa3f3b
SymbolDatabase,Tokenizer: Refactor handling of noexcept
2016-01-03 08:36:00 +01:00
Daniel Marjamäki
9dabd17eae
Tokenizer::isFunctionHead(): Handling of C++ methods only in isCPP() condition.
2016-01-03 08:23:48 +01:00
Daniel Marjamäki
be8fc0f89f
SymbolDatabase: Better handling of default and delete when reusing Tokenizer::isFunctionHead()
2016-01-03 00:01:29 +01:00
Alexander Mai
b22071cb54
#7185 : Add Assertion to detect memory corruption.
2016-01-02 23:56:40 +01:00
Daniel Marjamäki
66e047ee7d
Refactoring SymbolDatabase. Reuse Tokenizer::isFunctionHead().
2016-01-02 23:49:06 +01:00
Daniel Marjamäki
0a1d10bf2f
Tokenizer: Add &|&&| to Tokenizer::isFunctionHead()
2016-01-02 23:09:44 +01:00
Alexander Mai
1d3e39df7e
Adjust message text for signConversion for constant negative epxressions
2016-01-02 22:56:15 +01:00
Daniel Marjamäki
746d024e3d
SymbolDatabase: Fix Token::Match pattern
2016-01-02 20:00:18 +01:00
Alexander Mai
ce12e1cea6
Remove unnecessaryForwardDeclaration check. It had false positives (e.g. #3663 ), was implemented in the Tokenizer and of little value.
2016-01-02 19:14:03 +01:00
Robert Reif
db6dfa2d22
Fixed #7195 (crash: valueFlowSwitchVariable())
2016-01-02 18:53:51 +01:00
Daniel Marjamäki
599327bfb1
cmdlineparser: Added -E option
2016-01-02 11:48:36 +01:00
Alexander Mai
ee5a5e8bb5
Minor modification of previous changeset (compare token with literal using str())
2016-01-01 23:37:38 +01:00
Alexander Mai
37c3d5da7b
#6731 Tokenizer::eraseDeadCode causes heap corruption on invalid code. Better detection of invalid code inside Tokenizer::simplifyFlowControl()
2016-01-01 23:32:10 +01:00
Daniel Marjamäki
ca4f55ec4c
Cleanup Copyrights. Now all should be just for Cppcheck team.
2016-01-01 23:04:16 +01:00
Daniel Marjamäki
95009a4630
Merge pull request #745 from lanurmi/2016_ad
...
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki
416861b530
ValueType: only use default signedness for char/short/int/long/longlong
2016-01-01 20:03:31 +01:00
Daniel Marjamäki
b457ceef0e
Settings: Added defaultSign
2016-01-01 17:33:59 +01:00
Daniel Marjamäki
f5715c1496
Rename Unspecified platform type to Native
2016-01-01 16:39:41 +01:00
Daniel Marjamäki
3bd5a4d10e
CheckUnusedVar: Fix FP when there is class initialization
2016-01-01 16:04:13 +01:00
Daniel Marjamäki
2f26195b23
Fixed #7248 (crash in ValueType::str())
2016-01-01 15:13:50 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
Daniel Marjamäki
1e0979779e
Print type information in AST dump
2016-01-01 13:54:07 +01:00
Daniel Marjamäki
dea41e2390
CheckUnusedVar: Fix FP for assignment in while
2016-01-01 12:14:18 +01:00
Daniel Marjamäki
e69e952c46
Fixed #7245 (ValueType: Wrong result type for 'sint << uint')
2015-12-31 20:18:35 +01:00
Daniel Marjamäki
98756ea7f5
Fixed #7247 (False positive CastAddressToIntegerAtReturn - returning std::string)
2015-12-31 18:53:07 +01:00
Daniel Marjamäki
350908d0e9
Fix FP in CheckUnusedVar. Caused by #7230 fix.
2015-12-31 15:30:33 +01:00
Daniel Marjamäki
17ab0a4e9a
Fixed #7246 (crash: CheckType::checkLongCast())
2015-12-31 14:07:38 +01:00
Daniel Marjamäki
9f6890512c
Refactoring CheckType checkers. Use ValueType.
2015-12-31 12:05:23 +01:00
Daniel Marjamäki
5dc42ccd49
try to fix Travis. teach checkinternal about %assign%
2015-12-31 01:56:48 +01:00
Daniel Marjamäki
67435af06a
Refactor CheckType::checkTooBigBitwiseShift. Use ValueType.
2015-12-31 01:51:21 +01:00
Daniel Marjamäki
1de21a8356
try to fix Travis. teach checkinternal about %assign%
2015-12-31 01:32:34 +01:00
Daniel Marjamäki
8ee3a8d168
Updated Token::Match documentation
2015-12-31 01:25:36 +01:00
Daniel Marjamäki
8171154e12
Fixed #7230 (Confusing code snippet in error message)
2015-12-31 01:15:49 +01:00
Daniel Marjamäki
fae9c2159c
Fix Travis. The 'Assign integer to pointer' checker should allow 0.
2015-12-30 20:59:22 +01:00
Daniel Marjamäki
5216f904e7
Refactoring Check64BitPortability. Use ValueType.
2015-12-30 19:59:23 +01:00
Daniel Marjamäki
7f1b43e79c
Use simpleMatch to fix travis build
2015-12-30 12:28:55 +01:00
Daniel Marjamäki
c0e8654649
Refactor void* checking. Use ValueType.
2015-12-30 11:48:20 +01:00
Daniel Marjamäki
fdcab8f1bb
ValueType: better handling of struct member
2015-12-30 11:36:46 +01:00
Daniel Marjamäki
c5c386ceb8
ValueType: Handle void pointers
2015-12-29 19:58:51 +01:00
Daniel Marjamäki
bd1037e95b
Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument)
2015-12-29 12:06:42 +01:00
Daniel Marjamäki
83cb028963
Preprocessor: insert space between ++ or -- in macro expansion
2015-12-29 06:54:44 +01:00
Daniel Marjamäki
b38559774d
Removed the CPPCHECK2 ifdefs. I have no plan to remove simplifications anymore.
2015-12-28 16:26:51 +01:00
Daniel Marjamäki
15ecb26a6c
Tokenizer: Moved simplifyAssignmentInFunctionCall from simplifyTokenList1 to simplifyTokenList2
2015-12-28 13:58:41 +01:00
Daniel Marjamäki
0ddb5c12ce
Fixed #7238 (False positive unknownEvaluationOrder for comma operator on C code)
2015-12-28 13:45:55 +01:00
Alexander Mai
5b6758b03b
Add some debugging code (inspired by #6021 )
2015-12-27 17:38:15 +01:00
Daniel Marjamäki
f09dded7b1
TokenList: Better handling of '1++a' and 'a++1'
2015-12-27 14:57:22 +01:00
Daniel Marjamäki
908bc664a4
Evaluation order: ignore usage in sizeof
2015-12-27 14:08:16 +01:00
Alexander Mai
e9635fd393
#7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration
2015-12-26 23:51:10 +01:00
amai2012
081f443b2a
#7235 segmentation fault (invalid code) in TokenList::createAst
2015-12-26 20:26:07 +01:00
amai2012
36a6599386
#7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-12-26 20:16:01 +01:00
Daniel Marjamäki
c672210e06
Evaluation order: don't warn for 'dostuff(expr++, &expr)'
2015-12-26 15:48:43 +01:00
Daniel Marjamäki
32455e8441
Fixed #7214 (ValueType: does not handle static_cast)
2015-12-26 15:20:17 +01:00
Daniel Marjamäki
34449ae857
Use simpleMatch instead of Match for simple pattern, hope this makes Travis happy
2015-12-26 02:21:52 +01:00
Daniel Marjamäki
cea40168e0
Code fix. Used wrong variable in condition, leading to segfaults.
2015-12-26 01:52:43 +01:00
Daniel Marjamäki
293bd2eead
Fixed #6990 (false negative: Invalid abs() argument nr 1. A non-boolean value is required.)
2015-12-26 01:38:41 +01:00
Alexander Mai
87767fb666
#7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead
2015-12-26 00:21:56 +01:00
Daniel Marjamäki
e6ff77d825
Evaluation order: Don't use this checker on C++11 code
2015-12-25 18:57:59 +01:00
Daniel Marjamäki
90148ce2a1
Evaluation order: Only use this checker on non-C++11 code
2015-12-25 18:49:34 +01:00
Daniel Marjamäki
55779a5772
Evaluation order: Only use this checker on non-C++11 code
2015-12-25 18:45:46 +01:00
Daniel Marjamäki
24438c326e
Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro)
2015-12-25 18:31:21 +01:00
Daniel Marjamäki
27af1bcfd8
Fixed #7229 (Improve check; unknown evaluation order, write different message for self assignment)
2015-12-25 18:00:19 +01:00
Daniel Marjamäki
90a54b1fae
Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );)
2015-12-25 16:45:11 +01:00
PKEuS
0bdd353062
Merge pull request #744 from Dmitry-Me/useSetInsteadofList
...
Use set instead of list
2015-12-25 15:57:22 +01:00
Dmitry-Me
7fdbd8f0ca
Use set instead of list
2015-12-25 16:19:27 +03:00
Dmitry-Me
05cb4e16fe
Fix misspelled word
2015-12-25 11:51:08 +03:00
Dmitry-Me
458f0da197
Reduce variable scope, better name
2015-12-24 17:08:49 +03:00
PKEuS
940d569980
Refactorization: Removed redundant %any% patterns.
2015-12-24 14:40:48 +01:00
PKEuS
0052896c41
Merge pull request #738 from Dmitry-Me/reduceMatchCalls
...
Pre-check to reduce number of match checks
2015-12-24 13:48:56 +01:00
Dmitry-Me
7303790a73
Pre-check to reduce number of match checks
2015-12-24 13:07:47 +03:00
PKEuS
93cb73ebcf
Merge pull request #741 from Dmitry-Me/useArrowForDereferencing
...
Use arrow as in surrounding code
2015-12-24 09:37:40 +01:00
PKEuS
ae740e28fd
Merge pull request #740 from Dmitry-Me/donClearEmptyStrings
...
No need to clear empty strings
2015-12-24 09:37:20 +01:00
Daniel Marjamäki
81f0597316
Fixed #3206 and #7226 (New check: Undefined execution order)
2015-12-24 09:13:20 +01:00
Dmitry-Me
1d614f2e5b
Use arrow as in surrounding code
2015-12-24 10:21:48 +03:00
Dmitry-Me
bd45c71d8d
No need to clear empty strings
2015-12-24 10:16:58 +03:00
PKEuS
1b7f23daa5
Merge pull request #737 from Dmitry-Me/omitDeepCopy
...
Omit unneeded deep copy
2015-12-23 16:26:44 +01:00
PKEuS
d5e9bb4323
Merge pull request #739 from Dmitry-Me/repeatedSearch
...
Omit repeated search
2015-12-23 16:24:50 +01:00
Dmitry-Me
3e9ef0894f
Omit repeated search
2015-12-23 16:10:39 +03:00
Daniel Marjamäki
3f386af21c
astyle formatting
2015-12-23 10:26:12 +01:00
Dmitry-Me
5cba4ac602
Omit unneeded deep copy
2015-12-23 10:32:59 +03:00
Dmitry-Me
398da8ea7c
Cache and reuse result of expensive operation
2015-12-22 14:03:45 +03:00
Dmitry-Me
155ccecf2f
Drop useless braces
2015-12-22 10:31:49 +03:00
Alexander Mai
28a625abd8
#7218 Improve performance in TokenList::validateAst(): Keep a list of 'verified' tokens during recursion check.
2015-12-19 20:36:30 +01:00
PKEuS
a6b719eb10
Refactorization: Fixed true positive when self-checking cppcheck
2015-12-18 18:13:13 +01:00
Dmitry-Me
06ff877415
Typo in variable name
2015-12-18 15:46:12 +03:00
Dmitry-Me
166e2a2cb8
Extract duplicate code
2015-12-18 10:24:02 +03:00
orbitcowboy
4a3c61f031
Merge pull request #731 from Dmitry-Me/dontProceedToOuterScope
...
Don't proceed to outer scope once there's a match in this scope
2015-12-17 16:04:59 +01:00
PKEuS
8f22e4924c
Updated AStyle to version 2.05.1
...
Tweaked runastyle.bat a little bit.
2015-12-17 15:53:13 +01:00
Dmitry-Me
ecc2e00a38
Don't proceed to outer scope once there's a match in this scope
2015-12-17 17:31:22 +03:00
orbitcowboy
bc6ae499dc
Merge pull request #730 from Dmitry-Me/loopVariableNotUsed
...
Loop variable wasn't really used
2015-12-17 15:09:41 +01:00
Dmitry-Me
6f996142dc
Loop variable wasn't really used
2015-12-17 12:54:05 +03:00
Daniel Marjamäki
febe1c9c14
Merge pull request #729 from Dmitry-Me/removeRedundantCheck
...
Remove redundant check
2015-12-16 15:03:07 +01:00
Daniel Marjamäki
bebf8ccdd5
Revert da15efb3
and 6304a4dd
to fix FPs. See #7148 , #7179 , etc
2015-12-16 14:51:50 +01:00
Dmitry-Me
0d2edc532c
Remove redundant check
2015-12-16 16:36:06 +03:00
orbitcowboy
66897a95f4
Merge pull request #727 from Dmitry-Me/fixC4706
...
Fix C4706 assignment within conditional
2015-12-15 10:58:14 +01:00
Dmitry-Me
4a8a5d4460
Fix C4706 assignment within conditional
2015-12-15 11:34:04 +03:00
Dmitry-Me
bd4b47123a
Better variable name
2015-12-15 11:30:20 +03:00
PKEuS
18693a7fce
Refactorized token.cpp:
...
- Removed redundant overload of Token::insertToken()
- Fixed leak in Token::deleteThis()
- Moved condition out of loop in Token::tokAt()
2015-12-14 22:04:51 +01:00
Daniel Marjamäki
8f27cec991
Revert "minor tweak of comment"
...
This reverts commit b1d1869f22
.
2015-12-14 20:29:29 +01:00
Daniel Marjamäki
9acda09fa2
refactoring. combine 2 if to 1
2015-12-14 20:05:17 +01:00
Daniel Marjamäki
b1d1869f22
minor tweak of comment
2015-12-14 20:03:40 +01:00
Daniel Marjamäki
2532f94bef
Merge pull request #719 from 3adev/fix-multiple-config-dumps
...
Fix multiple config dumps
2015-12-14 20:03:09 +01:00
Albert ARIBAUD (3ADEV)
e7fdb1c825
Fix multiple config dumps
...
With multiple configurations, option --dump only dumps
the last configuration.
Fix it to dump every configuration.
Also update all Python addons so that they can handle
multiple-configuration dumps.
Additionally run autopep8 on addons/*.py.
The results of 'make test' before and after applying
this commit are identical.
2015-12-14 18:20:35 +01:00
Dmitry-Me
182877df88
Variable name consistent with other code
2015-12-14 17:35:32 +03:00
Daniel Marjamäki
0baad496f2
Fixed #6383 (FP shiftNegative - value converted to unsigned in function argument)
2015-12-14 10:55:23 +01:00
Daniel Marjamäki
0cc003830a
Revert "Fix Compiler warnings."
...
This reverts commit cbb7c8b854
.
2015-12-13 19:58:27 +01:00
Albert ARIBAUD (3ADEV)
58031147b2
Optimize tokenizing
...
Reorganize cppcheck.cpp to separate actual checking from
tokenizing and XML dumping. This implies splitting checkFile()
in three parts, checkRawTokens, checkNormalTokens() and
checkSimplifiedTokens().
2015-12-13 09:29:47 +01:00
Alexander Mai
96531d6ffe
TokenList::createAst() doesn't validate itself anymore. Remove some duplicated code and fix glitch in TestGarbage::garbageCode162
2015-12-12 20:01:03 +01:00
Daniel Marjamäki
9cb8e9a07e
Revert "Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else)"
...
This reverts commit 04f9b71281
.
2015-12-12 16:50:02 +01:00
Alexander Mai
5b2dacb4b4
Correct travis and compiler warnings and comments
2015-12-12 16:08:52 +01:00
Daniel Marjamäki
04f9b71281
Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else)
2015-12-12 15:50:33 +01:00
Alexander Mai
9a847d7b14
#7208 Cppcheck hangs with 100% CPU load in CheckOther::checkNegativeBitwiseShift (invalidcode). TokenList::validateAst() is running consistency checks on AST
2015-12-12 15:39:38 +01:00
PKEuS
51bb76c5b5
Optimization: Skip over expression in brackets in Tokenizer::isFunctionParameterPassedByValue()
2015-12-10 15:53:14 +01:00
PKEuS
37572dc109
Small refactorizations:
...
- Improved formatting of unhandled-char-constant message (Side-effect: fixes #7206 )
- Replace nr="-1" by nr="any" in windows.cfg
2015-12-10 15:47:46 +01:00
Daniel Marjamäki
61da95010c
Removed unused CppCheck::replaceAll()
2015-12-10 13:32:36 +01:00
Daniel Marjamäki
1f16e72b19
Removed --debug-fp. The reduce tool should be used instead.
2015-12-10 10:44:36 +01:00
Akhilesh Nema
932f6ea81b
Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode)
2015-12-09 14:00:40 +01:00
Dmitry-Me
28bf944d81
Remove redundant checks
2015-12-09 11:10:56 +03:00
orbitcowboy
eead6862cc
Merge pull request #718 from Dmitry-Me/cacheAndReuse3
...
Cache and reuse value
2015-12-08 15:07:59 +01:00
Daniel Marjamäki
e88a1b0915
astyle formatting
2015-12-08 14:23:26 +01:00
Dmitry-Me
f96484b609
Cache and reuse value
2015-12-08 10:36:03 +03:00
Albert ARIBAUD (3ADEV)
b8dd71c577
Factorize toxml() into a single member function
...
lib/symboldatabase.cpp and lib/tokenize.cpp both
define a static toxml() function. Make it a single
static ErrorLogger::toxml() member function.
2015-12-07 18:21:01 +01:00
Akhilesh Nema
ca3c19c63d
GUI: Fixed compiler warnings
2015-12-07 11:24:54 +01:00
PKEuS
57e9954390
Merge pull request #715 from Dmitry-Me/eliminateRepeatedLookup3
...
Remove repeated lookup
2015-12-07 10:47:37 +01:00
amai2012
7129b1c5b3
Merge pull request #716 from Dmitry-Me/betterVariableName7
...
Better variable name
2015-12-07 10:35:34 +01:00
Dmitry-Me
67f0301f0b
Better variable name
2015-12-07 12:21:17 +03:00
Dmitry-Me
f00a73f1a1
Remove repeated lookup
2015-12-07 11:57:04 +03:00
Alexander Mai
26b699fd30
Fix compiler warnings about incomplete handling of library error codes
2015-12-06 12:52:49 +01:00
Alexander Mai
9d8dffbd79
#6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments()
2015-12-06 12:50:05 +01:00
PKEuS
eb27d3b877
Refactorization: Moved condition out of loop and ran AStyle
2015-12-06 10:40:22 +01:00
Alexander Mai
98f2cd021e
#7199 SymbolDatabase::validate() should be run in debug mode and print debug messages. In turn correct some test examples with invalid code.
2015-12-06 08:14:04 +01:00
Alexander Mai
5cf923d091
Don't run SymbolDatabase::validate on --debug. Replace some NULL by nullptr
2015-12-05 21:07:03 +01:00
Alexander Mai
ba0859e838
#6981 crash in checkvaarg.cpp (with possible fix). Avoid segfault. Add SymbolDatabase::validate() to allow validating smyboldatabase
2015-12-05 20:55:26 +01:00
Alexander Mai
5ddc5c0798
#7187 internal error; unhandled char constant \e. Support \e char literal support by clang,gcc,tcc
2015-12-05 18:53:03 +01:00
Alexander Mai
86c9387987
#7182 crash: CheckMemoryLeak::functionReturnType()
2015-12-05 18:43:29 +01:00
Alexander Mai
e69377d5a8
#7183 CheckClass::checkMemset() uint overflow. Plus some minor refactoring
2015-12-05 18:22:01 +01:00
Alexander Mai
6ae1533cb4
#7190 Cppcheck hangs with 100% CPU load in Tokenizer::simplifyAttribute (invalidcode). Call validate() once more in Tokenizer::simplifyTokenList1 to trigger invalid code exception
2015-12-05 13:55:33 +01:00
PKEuS
308fd1ba50
Fixed false positive 'noCopyConstructor' for static member variable ( #7198 )
2015-12-04 18:26:49 +01:00
PKEuS
46d6623182
Refactorization: Improved performance of Tokenizer::isFunctionParameterPassedByValue()
...
- Skip it for C code
- Improved performance by around 80% on C++ code (3,5% of entire runtime)
2015-12-03 14:44:59 +01:00
PKEuS
70767a30c4
Small refactorizations:
...
- Avoid calling c_str() for functions that take std::string
- Avoid copying std::list
2015-12-03 14:19:30 +01:00
Daniel Marjamäki
7f4dae8de4
Merge pull request #714 from Dmitry-Me/betterVariableNames
...
Better variable names, more linear code
2015-12-03 13:46:28 +01:00
PKEuS
32e2fb2f78
Refactorization: Prefer Token::simpleMatch over Token::Match also for non-const patterns.
2015-12-03 13:04:55 +01:00
PKEuS
00662ec484
Refactorization: Improve performance of simplifyTypedef by using Token::simpleMatch by ~15% (forgotten in b8d39a2229
)
2015-12-03 12:50:42 +01:00
Dmitry-Me
cb84b88cb1
Better variable names, more linear code
2015-12-03 14:20:46 +03:00
amai2012
f624f6fc25
Merge pull request #713 from Dmitry-Me/eliminateRepeatedLookup2
...
Eliminate repeated lookup
2015-12-03 10:18:08 +01:00
Dmitry-Me
be49abf460
Eliminate repeated lookup
2015-12-03 11:03:18 +03:00
Daniel Marjamäki
a51df5f00d
Removed unused CppCheck::analyseFile
2015-12-03 08:42:12 +01:00
PKEuS
b8d39a2229
Refactorizations:
...
- Improve performance of simplifyTypedef by using Token::simpleMatch by ~15%
- Simplified code in simplifyTypedef
- Ran AStyle
2015-12-02 23:32:50 +01:00
PKEuS
7ea9e3ca4f
Refactorization: Improve performance of simplifyTypedef by adding a pre-check for Token::link() by ~25%
2015-12-02 22:41:09 +01:00
Dmitry-Me
0a3959f201
Remove duplicate check
2015-12-02 17:28:21 +03:00
PKEuS
423b254772
Merge pull request #711 from Dmitry-Me/moreInterlockedCases
...
Detect more non-interlocked accesses
2015-12-02 14:13:53 +01:00
orbitcowboy
1a94b876f1
preprocessor: Improved constness of local variable.
2015-12-02 13:58:24 +01:00
Dmitry-Me
8f8a0097fe
Detect more non-interlocked accesses
2015-12-02 10:58:57 +03:00
PKEuS
c79bc6c59d
Refactorization: Call std::string::find_first_of() only once.
2015-12-01 23:11:24 +01:00
Daniel Marjamäki
508b06abaa
Fixed #6973 (ValueFlow: dont set possible tokvalues in unreachable code)
2015-12-01 07:49:19 +01:00
Alexander Mai
f762affea0
Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart'
2015-11-30 22:13:49 +01:00
Matthias Krüger
c7bbc27130
Preprocessor: run paths of some error messages through Path::simplifyPath()
...
teach Path::simplifyPath() to recursively remove "./././" from beginning of paths.
2015-11-30 19:30:37 +01:00
Daniel Marjamäki
9c3f25603e
CheckBufferOverrun: Remove old checking of strings and use new ValueFlow-based checking instead ( #6973 )
2015-11-30 16:36:52 +01:00
Daniel Marjamäki
8fb6f33aca
ValueFlow: dont set dynamic values in unreachable code ( #6973 )
2015-11-30 16:15:58 +01:00
Daniel Marjamäki
1b0bb02f1d
invalidTestForOverflow: Fixed some false negatives ( #7184 )
2015-11-30 11:12:51 +01:00
Daniel Marjamäki
fb8cce647c
invalidTestForOverflow: Refactor; move from checkother to checkcondition
2015-11-30 08:51:15 +01:00
Daniel Marjamäki
f6f4f27636
CheckOther::checkInvalidTestForOverflow: minor fix, only warn when warnings are enabled.
2015-11-29 22:03:42 +01:00
Daniel Marjamäki
26a07265a8
Fixed #7184 (Invalid test for overflow 'p + x < p')
2015-11-29 20:59:50 +01:00
Daniel Marjamäki
4fa888ec44
Warn when shifting a negative value, it is UB. ( #4931 )
2015-11-29 16:28:55 +01:00
Daniel Marjamäki
8a9e068129
Fixed #7119 (Cppcheck hangs with 100% CPU load in Tokenizer::copyTokens (invalidcode))
2015-11-29 14:56:15 +01:00
Alexander Mai
53dbcb956f
Small refactoring: use a single complete set for reserved for each C/C++. Replace NULL by nullptr
2015-11-29 13:23:13 +01:00
Alexander Mai
f5194accfd
Run dmake. Add missing include to lib/checkinternal.cpp
2015-11-29 11:09:21 +01:00
PKEuS
e8522c7883
Small refactorizations:
...
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki
8bb8290a6f
Fixed GCC warnings. unused variable, shadow variable.
2015-11-28 18:15:47 +01:00
Alexander Mai
78489f4293
MathLib::characterLiteralToLongNumber can encode unicode char literals, though it's incompatible to gcc/clang
2015-11-28 16:37:26 +01:00
Daniel Marjamäki
5fabe66ff7
simplifyCalculations: better handling of && and || in conditions ( #4931 )
2015-11-28 15:00:41 +01:00
PKEuS
ac17541ca9
Refactorizations:
...
- Fixed a few more MSVC warnings by using correct types
- Store severity as enum instead of string in Settings::Rule
2015-11-28 12:30:21 +01:00
PKEuS
93c02ce826
Fixed compiler error introduced in previous commit and several MSVC warnings
2015-11-28 10:49:08 +01:00
Daniel Marjamäki
6b124a37d8
Cleanup some casts
2015-11-28 10:11:07 +01:00
Daniel Marjamäki
8689693d6c
Fix Travis
2015-11-28 09:26:44 +01:00
Daniel Marjamäki
c0da6c1541
simplifyCalculations: handle '(4%1<<1&4!=1)' better. must combine '!' '=' before constant folding. fixed the operator precedence for comparison operators. ( #4931 )
2015-11-28 09:04:22 +01:00
Alexander Mai
44305fd98e
#6940 Unsigned overflow in TestBufferOverrun::negativeArraySize. Don't try to calculate size of array with negative array size
2015-11-28 07:27:52 +01:00
Alexander Mai
c70b71e353
#5888 fsanitize=undefined: signed integer overflow: 4611686018427387904 * 2 cannot be represented in type 'long long int' in valueflow.cpp
2015-11-27 21:45:08 +01:00
Alexander Mai
c6ec5ca734
Fix MathLib::characterLiteralToLongNumber for LP64 again.
2015-11-27 21:43:51 +01:00
Alexander Mai
d4749c3377
Fix excessive left shift of signed integer and some doxygen errors
2015-11-27 19:32:28 +01:00
Daniel Marjamäki
1bf547c716
Fixed #4931 (Wrong calculation for '2|0*0&2>>1+0%2*1')
2015-11-27 15:02:49 +01:00
Daniel Marjamäki
1977a18a1e
simplifyNumericCalculations: Don't fold negative constants in shift/bitmask calculation. Behaviour is not well defined.
2015-11-27 14:16:49 +01:00
PKEuS
3b4160600d
Fixed crash in CheckMemoryLeak::functionReturnType() for unary operator:: ( #7172 )
2015-11-27 11:18:40 +01:00
PKEuS
0ba3d25917
CheckMemoryLeak: Correctly detect new char[...]() as array allocation ( #7164 )
2015-11-27 11:04:18 +01:00
Frank Zingsheim
70c20515a9
Cmake object linkage. Fix #7128 : (cppcheck 1.70 doesn't report any warnings)
2015-11-26 20:25:09 +01:00
Matthias Krüger
87ce88d6ab
CheckFunctions::checkProhibitedFunctions(): don't warn about alloca when --enable=warning is not given.
2015-11-25 22:05:51 +01:00
Daniel Marjamäki
2737f63f71
Wrong calculation of constants (simplifying: +,<<,% operations)
2015-11-25 16:46:39 +01:00
Benjamin Bannier
e84fe33ad0
Include cmath for std::fabs
2015-11-25 10:16:41 +01:00
Alexander Mai
a7ab5ecf08
Fix some compiler in MathLib::characterLiteralToLongNumber + some small refactoring
2015-11-23 20:41:21 +01:00
Daniel Marjamäki
5135bae777
Tokenizer: Cleanup the Tokenizer::tokenizeCondition used by the preprocessor
2015-11-23 16:53:30 +01:00
Alexander Mai
b7030fcfa1
Fix compiler error (VS2010) and warning
2015-11-22 16:56:44 +01:00
Daniel Marjamäki
d93cf96a29
Fixed #6769 (false positive: Uninitialized struct member: epoch.integer)
2015-11-22 16:20:46 +01:00
Alexander Mai
63b7700660
Use clang/gcc-conforming encoding of multicharacter literals
2015-11-22 14:20:36 +01:00
PKEuS
f516de8633
Moved a few checks from CheckOther to CheckFunctions
2015-11-22 13:49:10 +01:00
Alexander Mai
9ca6704c81
#7162 Support multicharacter char literals.
2015-11-22 13:31:31 +01:00
Matthias Krüger
a610ef9ce8
fix internal warning:
...
[lib/checkfunctions.cpp:44]: (warning) Found simple pattern inside Token::Match() call: "alloca ("
2015-11-22 11:00:36 +01:00
Alexander Mai
b1385dd951
Run dmake to update Makefile etc.
2015-11-22 10:40:48 +01:00
PKEuS
57d1196386
Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library ( #6529 )
2015-11-22 09:18:07 +01:00
Alexander Mai
517922feb6
MathLib::characterLiteralToLongNumber now reports more specific error messages for unsupported unicode literals (see #7162 )
2015-11-22 07:38:38 +01:00
Alexander Mai
714579401f
#7160 Internal error: Unhandled char constant '\1'. Correct MathLib::toLongNumber. Create new utility function MathLib::characterLiteralToLongNumber
2015-11-21 22:35:58 +01:00
Daniel Marjamäki
5f68f3ddf6
Fixed #6264 (FP: gimp: struct initialized via pointers to member variables)
2015-11-21 19:31:18 +01:00
Daniel Marjamäki
fb0477affd
CheckUninitVar: Fixed false negatives when there are conditions
2015-11-21 10:00:21 +01:00
Daniel Marjamäki
d301cf28ec
CheckUninitVar: Small logical fixes in conditions handling.
2015-11-21 08:32:25 +01:00
PKEuS
12af125fd3
Fixed false positive stlIfStrFind for function call inside condition.
...
Removed unnecessary suppressions in .travis_suppressions
2015-11-20 20:08:53 +01:00
Daniel Marjamäki
8fd62e0cf9
Fixed #4931 (Wrong calculation of constants (simplifying: +,<<,% operations))
2015-11-20 19:43:11 +01:00
Daniel Marjamäki
79a70c1277
MathLib::toLongNumber: Better handling of '\x12' and '\000' char constants
2015-11-20 18:57:48 +01:00
PKEuS
6590d46013
Added missing functionality to <container> elements in Librarie, completed STL container definitions in std.cfg
2015-11-20 18:22:55 +01:00
Daniel Marjamäki
4abc0b7c1f
Partial fix for #4931 (Wrong calculation of constants (simplifying: +,<<,% operations))
2015-11-20 16:09:47 +01:00
PKEuS
c0e33e20b4
Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries
2015-11-20 15:53:14 +01:00
PKEuS
53b2eca983
Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries
2015-11-20 15:53:14 +01:00
PKEuS
00bdc89f98
Refactorizations:
...
- Rely on SymbolDatabase to detect string types
- Loop over variable list instead of token list
- Fixed two comments claiming that the AST is experimental
2015-11-20 11:20:42 +01:00
Daniel Marjamäki
52b5446d86
Improve handling of various standard character constants
2015-11-20 10:23:38 +01:00
Daniel Marjamäki
86957214ae
Remove redundant comparisons
2015-11-20 10:11:58 +01:00
Daniel Marjamäki
0022ce8075
Refactor handling of char constants
2015-11-20 10:10:38 +01:00
PKEuS
2e7c5d37df
Refactorizations in checkmemoryleak.cpp:
...
- Rely more on <alloc> declarations in Libraries
- Removed unreachable debug message
- Simplified code
2015-11-19 17:34:17 +01:00
PKEuS
0d25a43a5d
checkmemoryleak.cpp: Refactorized CheckMemoryLeakNoVar::check() and replaced a redundant whitelist by CheckMemoryLeakInFunction::test_white_list()
2015-11-19 17:34:17 +01:00
Matthias Krüger
8faf8e2b25
fix internal warning:
...
[lib/checkmemoryleak.cpp:2722]: (warning) Found simple pattern inside Token::Match() call: "> ("
2015-11-19 17:03:55 +01:00
Daniel Marjamäki
40851a12ef
Fixed #4627 (Tokenizer::setVarId: function declaration in function body)
2015-11-19 16:27:16 +01:00
PKEuS
ab171fc027
Fixed false negatives in CheckMemoryLeakStructMember::checkStructVariable():
...
- Use generic detection of allocation/deallocation (#4770 )
- Make the checker usable for C++ by checking for destructors
- Reduced unit test duplication
2015-11-19 16:10:26 +01:00
PKEuS
db6174bb60
Refactorization: Support Types that consist of more than a single token in CheckMemoryLeakNoVar::checkForUnsafeArgAlloc
...
Removed obsolete comments
2015-11-19 16:10:26 +01:00
Daniel Marjamäki
4d3e231bd0
Fixed #3948 (False positive: variable not initialised - used in multi-condition if-clause)
2015-11-19 13:09:45 +01:00
PKEuS
87d3ed91ab
Refactorization:
...
- Improved and cleaned up CheckMemoryLeak::functionReturnType()
- Cleaned up whitelist from functions declared as <leak-ignore/> in std.cfg
2015-11-18 22:09:27 +01:00
PKEuS
1566b72c5b
Fixed broken AST for simple expressions with delete operator.
...
Fixed cppcheck internal warning
2015-11-18 21:37:37 +01:00
PKEuS
4957e48d7c
Refactorization: Removed std::string overload of CheckMemoryLeak::getDeallocationType(), improved varid overload to handle member variables
2015-11-18 21:17:50 +01:00
PKEuS
e990cfb76b
Fixed setVarId() for destructors
2015-11-18 21:13:58 +01:00
PKEuS
6ee4cf80dc
Improved detection of new operator in checkmemoryleak.cpp, fixed TODO unit test
2015-11-18 20:33:39 +01:00
Daniel Marjamäki
0f9d90d2be
Changed Copyrights. Removed my name.
2015-11-18 20:04:50 +01:00
Daniel Marjamäki
5772bbd206
Fix Cppcheck warning 'explicit constructor'
2015-11-18 15:56:48 +01:00
Daniel Marjamäki
6b9c12e806
CheckUninitVar: Refactoring and gcc-compatibility fix
2015-11-18 15:16:50 +01:00
Daniel Marjamäki
e6ceae213e
CheckUninitVar: Improving multi-variable value handling
2015-11-18 14:56:45 +01:00
Daniel Marjamäki
04ecbba361
Fixed #7135 (ValueFlow: Wrong pointer alias set for 'p = &p[x];')
2015-11-15 23:38:23 +01:00
Daniel Marjamäki
71bf0f076f
CheckAutoVariables: Handle 'x-y' better in isAutoVarArray
2015-11-15 19:34:36 +01:00
Alexander Mai
65666a1ba4
Makefile: explicit list directories which should be used with ctags. Run astyle.
2015-11-15 19:03:18 +01:00
amai2012
f0bf749621
#7133 crash: Variable::declarationId().
2015-11-15 19:01:29 +01:00
Daniel Marjamäki
ca8b15cd6b
Fixed #7124 (int32_t etc are recognised as fundamental types, but std::int32_t etc are not)
2015-11-15 17:51:27 +01:00
Daniel Marjamäki
2a4cceae9e
Library: Refactor handling of comma-separated names
2015-11-15 15:24:10 +01:00
PKEuS
25749ab19f
Fixed another crash in clang test suite and let two times two functions in std.cfg share same configuration
2015-11-15 14:55:30 +01:00
Daniel Marjamäki
4e578af603
CheckAutoVar: Improved usage of AST and ValueFlow
2015-11-15 14:48:13 +01:00
PKEuS
481d800d5a
Fixed crash in clang test suite.
2015-11-15 14:40:31 +01:00
PKEuS
3f255e7685
Use Library information in Tokenizer::sizeOfType()
2015-11-15 14:37:02 +01:00
PKEuS
da6b17d176
Refactorizations in CheckStl:
...
- Improved detection of "auto" iterators in CheckStl::iterators()
- Improved performance of CheckStl::pushback()
- Added more containers to std.cfg
2015-11-15 14:04:39 +01:00
Daniel Marjamäki
c10a10c26f
CheckAutoVariables: use ValueFlow to detect more errors when pointer aliases are used
2015-11-15 12:10:35 +01:00
PKEuS
573edb4c92
Refactorization: Added utils.h to VS solution and renamed dependency to pcre.lib to pcre64.lib for x64 configuration.
2015-11-15 11:21:48 +01:00
PKEuS
41fbc5355d
Revert "Partially reverted 5cd36d6f8a
for upcoming release."
...
This reverts commit 5f8a8aba6d
.
2015-11-15 10:04:27 +01:00
PKEuS
80c89e7a38
Set Version to 1.71.99/1.72 dev
2015-11-15 09:57:57 +01:00
Alexander Mai
835c234e18
#7131 crash: Tokenizer::setVarId()
2015-11-14 21:22:53 +01:00
Alexander Mai
bda9c8c2d5
--exception-handling now prints callstack on SIGINT, allows to debug program hangs. Also add handler for some more signals.
2015-11-14 19:59:22 +01:00
Daniel Marjamäki
5df2f9c6cf
1.71: Set version
2015-11-14 18:57:42 +01:00
PKEuS
5f8a8aba6d
Partially reverted 5cd36d6f8a
for upcoming release.
2015-11-14 18:53:49 +01:00
Daniel Marjamäki
ad0d23036c
Fixed some cppcheck warnings about methods that can be static/const
2015-11-14 18:43:07 +01:00
PKEuS
bdd57e6913
Revert "Fix multi-threading by converting static member variables to instance variables"
...
This reverts commit 598809a834
.
The problem does not exist in practice and the theoretical issue will be fixed as soon as the check is rewritten to make use of Libraries.
2015-11-14 12:07:00 +01:00
Daniel Marjamäki
b10110b5ac
CheckClass: Removed noExplicitCopyMoveConstructorError after discussion in http://sourceforge.net/p/cppcheck/discussion/general/thread/b2ce9d3d/ .
2015-11-13 12:48:26 +01:00
PKEuS
f9bc229d4b
Support varids in nested classes that are declared outside of outer class ( #7127 )
2015-11-13 10:07:57 +01:00
Daniel Marjamäki
595f1e1a27
ValueFlow: set value for char literals
2015-11-12 16:38:58 +01:00
Daniel Marjamäki
34dbc3c00c
ValueFlow: Improved handling of a[i]
2015-11-12 16:14:27 +01:00
Daniel Marjamäki
4ec333dbb6
Fixed #7007 (ValueFlow: value is not known, modified by subfunction)
2015-11-12 14:59:35 +01:00
PKEuS
1589841cb6
Fixed crash in clang test suite with member variable pointers
2015-11-11 18:26:59 +01:00
PKEuS
36c5815ddb
Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block ( #6555 )
2015-11-11 17:21:55 +01:00
PKEuS
a8cf63239a
Fixed false positive autovarInvalidDeallocation if deallocting result of member function ( #6551 )
2015-11-11 16:59:31 +01:00
Daniel Marjamäki
b9b0964dab
Fixed #7006 (False positive Mismatching assignment and comparison (variable is changed in loop))
2015-11-11 13:45:28 +01:00
PKEuS
ee00925dc5
setVarId: Support throw() in constructor implementations ( #7123 )
2015-11-11 11:01:49 +01:00
PKEuS
03d52de74b
Treat "class" keyword similar to "struct" or "union" on C++ code ( #6696 )
2015-11-10 17:03:27 +01:00
PKEuS
cc9a1f4375
Fixed setVarId() for template in initializer list ( #7122 )
2015-11-10 16:14:53 +01:00
PKEuS
feae241fc0
Fixed simplification of pointers ( #6829 )
2015-11-10 14:45:24 +01:00
PKEuS
6336372fb4
Apply same heuristics in CheckMemoryLeakNoVar::checkForUnusedReturnValue() as in CheckOther::checkIgnoredReturnValue(): Ensure that a defined function has non-void return value. ( #6693 )
2015-11-10 14:19:45 +01:00
PKEuS
06780b5eaa
Merge pull request #704 from simartin/warn
...
Silence clang warning.
2015-11-10 13:35:12 +01:00
Daniel Marjamäki
459a4e0cbe
Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference)
2015-11-10 10:18:24 +01:00
Simon Martin
1ec3175c99
Silence clang warning (-Wparentheses mode).
2015-11-10 08:12:36 +01:00
PKEuS
5cd36d6f8a
Refactorization: Use varid instead of variable name in CheckClass::initializeVarList() and fixed issue in setVarId().
...
Fixed internal warning.
2015-11-09 23:00:14 +01:00
PKEuS
49a9b011eb
Fixed handling of this-> and (*this). in setVarId()
2015-11-09 21:43:40 +01:00
PKEuS
db342ea910
Handle alias variables in CheckClass::initializeVarList() ( #6921 )
2015-11-09 21:02:06 +01:00
PKEuS
aca8a69f5e
Skip over lambdas in CheckClass::checkPureVirtualFunctionCall() ( #4992 )
2015-11-09 20:15:26 +01:00
PKEuS
f15f8514f6
Fixed crash on garbage code ( #7120 )
2015-11-09 17:25:20 +01:00
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
Daniel Marjamäki
72706cd0b8
Fixed #6868 (Tokenizer: wrong simplification of the unlikely keyword)
2015-08-08 12:49:42 +02:00
Daniel Marjamäki
7ec8adeb93
Fixed #6701 (Uninitialized variable warning when header could not be found)
2015-08-08 08:53:08 +02:00
Daniel Marjamäki
c9e239afbf
Fixed #6908 (False positive: Same expression on both sides of '+='.)
2015-08-07 20:28:25 +02:00
Daniel Marjamäki
ec3d76be5e
astyle formatting
2015-08-07 20:27:32 +02:00
PKEuS
48c6b30d1a
Merge pull request #634 from Dmitry-Me/avoidDeepCopy
...
Avoid deep copying std::string
2015-08-07 19:38:38 +02:00
Dmitry-Me
d81776b8c8
Avoid deep copying std::string
2015-08-07 17:16:41 +03:00
Dmitry-Me
ce96a5e84f
Run cheaper checks first
2015-08-07 16:25:47 +03:00
Dmitry-Me
c85112bdad
Break list traversal once first match is found
2015-08-06 17:10:43 +03:00
amai2012
53feb88614
Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
...
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Daniel Marjamäki
07a064aab0
Fixed #6910 (ValueFlow: variable incremented as macro argument is not known)
2015-08-05 14:08:57 +02:00
Daniel Marjamäki
a51acc8abd
minor tweak of 'Redundant condition' error message
2015-08-05 11:30:58 +02:00
Dmitry-Me
43800a9419
Detect non-interlocked check after InterlockedDecrement()
2015-08-05 12:20:28 +03:00
Daniel Marjamäki
eda5272dfd
Fixed #6875 (Improve 'Redundant condition' error message)
2015-08-05 11:15:54 +02:00
Daniel Marjamäki
4bebb80300
Fixed #6869 (False positive: uninitvar, array passed to function)
2015-08-05 10:19:17 +02:00
Daniel Marjamäki
e598b07a6d
Moved functions to astutils
2015-08-03 09:20:50 +02:00
amai2012
b8bb939e32
Add new files to VS project
2015-08-03 08:38:38 +02:00
Alexander Mai
4dc8e89327
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-08-02 21:57:42 +02:00
Alexander Mai
96c3c111fc
Refactoring: Move some AST related functions to distinct source file
2015-08-02 21:57:32 +02:00
Daniel Marjamäki
8d3f7e36e9
Fixed #6911 (valueflow: comparison of string and NULL)
2015-08-02 18:12:03 +02:00
Frank Zingsheim
7021cb2c6b
Fixed #6284 (Token::Match called with varid 0. Constants)
2015-08-02 09:11:51 +02:00
Alexander Mai
965a034afd
Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral
2015-08-01 18:42:17 +02:00
Alexander Mai
f91ad9bbf6
5402 false positive: (error) Division by zero -- with boost::format
2015-08-01 17:28:54 +02:00
Martin Ettl
b7ea311123
Running astyle. No functional changes.
2015-08-01 12:31:16 +02:00
amai2012
b182edddda
#6909 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-08-01 12:24:22 +02:00
Alexander Mai
acf050793e
#6907 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-08-01 07:39:56 +02:00
Alexander Mai
4400f2ac85
#6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks.
2015-07-31 20:24:06 +02:00
Matthias Krüger
8bfbb5d09c
CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes
2015-07-31 15:29:07 +02:00
Matthias Krüger
83ee640977
Tokenizer::syntaxError: put the character that we have an invalid number of into singlequotes instead of parentheses.
2015-07-31 15:28:59 +02:00
Matthias Krüger
87891b4128
CheckCondition::checkIncorrectLogicOperator put conditions in single quotes
2015-07-31 15:28:48 +02:00
Matthias Krüger
21ed807f8d
CheckCondition::alwaysTrueFalseError: put condition in single quotes.
2015-07-31 15:28:37 +02:00
Daniel Marjamäki
251f6d2a15
Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented)
2015-07-31 07:03:52 +02:00
amai2012
249a05126b
#6895 segmentation fault (invalid code) in CheckCondition::isOppositeCond
2015-07-30 17:19:19 +02:00
Daniel Marjamäki
503fb485cf
Removed hardcoding of functions from checkZeroDivision
2015-07-30 13:48:51 +02:00
Daniel Marjamäki
1752c4f4f0
Avoid 'Condition always true/false' FP when part of the condition is an expanded macro
2015-07-30 13:30:16 +02:00
amai2012
c5673612e2
#6069 False positive incorrectLogicOperator due to dynamic_cast. Run CheckCondition::checkIncorrectLogicOperator on non-simplified tokenlist.
2015-07-30 10:30:30 +02:00
Daniel Marjamäki
9085fdc156
Fixed #6887 (False positive eraseDereference - container is member of member variable)
2015-07-30 10:13:49 +02:00
Daniel Marjamäki
594d30f7ae
Fix Cppcheck warning about unused variable
2015-07-29 20:26:00 +02:00
Daniel Marjamäki
6790d91fbb
Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884 .
2015-07-29 19:54:57 +02:00
PKEuS
738057229c
Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
...
Handle sizeof in isSameExpression() (#6851 )
2015-07-29 14:28:24 +02:00
Daniel Marjamäki
120f3072eb
alwaysTrueFalse: Dont write warning when comparison is made in macro
2015-07-29 12:51:00 +02:00
Daniel Marjamäki
fc25ed8c86
Fixed #6879 (valueflow in do-while(++i))
2015-07-29 11:55:07 +02:00
Daniel Marjamäki
bf75ee9aed
Fixed #6885 (valueflow ignores assignment of variable via function call)
2015-07-29 10:49:17 +02:00
amai2012
1f43550688
#6880 , 6881 Crashes on invalid code. Fix null pointer access
2015-07-28 18:41:50 +02:00
Dmitry-Me
544932734f
VS: Disable 4482 warning
2015-07-28 18:33:45 +02:00
Daniel Marjamäki
0e82730ee4
addons/naming.py: fixed error report for function name
2015-07-28 14:34:37 +02:00
Daniel Marjamäki
5a57e4030a
dump: Add Function name attribute
2015-07-28 14:18:58 +02:00
Daniel Marjamäki
a1dfd6cf73
astyle formatting
2015-07-28 12:47:08 +02:00
Daniel Marjamäki
a17f4d0a2d
CLI: Added --debug-normal option that will show --debug output after 1st simplifications. This output is relevant for the 'normal' checkers.
2015-07-28 12:46:32 +02:00
Daniel Marjamäki
e759710198
Fixed #6743 (valueFlowAfterCondition: wrong value when variable is changed in conditional code)
2015-07-28 08:58:05 +02:00
Daniel Marjamäki
c5bbea2994
Fixed #6816 (FP: buffer overflow, checkminsizes of array with string value)
2015-07-27 16:39:41 +02:00
Daniel Marjamäki
f449e91d43
made valueFlowSwitchVariable faster when there are many 'case %num%:'
2015-07-27 14:57:02 +02:00
Daniel Marjamäki
05a21d45eb
Fixed #6670 (Analysis failed when there are {} in LHS in compound assignment)
2015-07-27 13:44:35 +02:00
Daniel Marjamäki
35eb1a393d
AST: handle concatening of strings better. this is not ideal but better.
2015-07-27 13:13:30 +02:00
Daniel Marjamäki
64b72bd6e5
Fixed #6227 (False positive (oppositeInnerCondition) - if (!dynamic_cast<>))
2015-07-27 10:43:52 +02:00
Daniel Marjamäki
5cc744b941
Fixed #6872 (Major performance regression - valueFlowSwitchVariable)
2015-07-27 06:45:06 +02:00
Daniel Marjamäki
389aec51ae
Fixed #6598 (False positive zerodivcond - cast to double ignored)
2015-07-26 22:08:36 +02:00
Daniel Marjamäki
ed1c6e41d9
Fixed #6876 (valueFlowForward: lambda function)
2015-07-26 19:28:42 +02:00
Alexander Mai
7c48bf3ca5
MathLib::isFloat now detects C99 hexadecimal float literals. MathLib::isDecimalFloat was added for C++ and pre-C99 compatibility.
2015-07-26 19:21:53 +02:00
Daniel Marjamäki
190550f9f9
Fixed #6877 (ValueFlow: valueFlowForward, after goto label the value is not known)
2015-07-26 17:05:21 +02:00
Daniel Marjamäki
ae124cb365
ValueFlow: Attempt to make --debug output easier to understand by using words
2015-07-26 16:32:31 +02:00
Daniel Marjamäki
9197e70a8d
ValueFlow: Changed --debug output so we can see if a variable is known or possible
2015-07-26 15:36:09 +02:00
PKEuS
7f9a313b94
Fixed hang in VS10 debug mode (AppVeyor)
2015-07-26 14:20:18 +02:00
Daniel Marjamäki
7f1af06df0
Preprocessor: fixed gcc -Wreorder warning
2015-07-26 13:48:01 +02:00
PKEuS
2342b604b0
Refactorized preprocessor (speedup of preprocessing time by ~10%):
...
- Reduced memory usage of PreprocessorMacro by 87,5% (removed redundant or unused members)
- Use char overload of std::string::find where possible
- Reordered conditions
2015-07-26 12:03:40 +02:00
Daniel Marjamäki
4e293d47c5
CheckMemoryLeak: Fix handling of comparisons after simplifyIfNotNull is removed, detected problem with run_more_tests
2015-07-26 11:27:52 +02:00
Alexander Mai
bbec54db8e
Implement MathLib::isFloatHex to detect C99 hexadecimal floating pointer literals. Rename MathLib::isHex to MathLib::isIntHex
2015-07-26 08:06:56 +02:00
Daniel Marjamäki
afd9f071c0
simplified the code for ValueFlow Known/Possible values
2015-07-25 19:36:29 +02:00
PKEuS
92b867dd2c
Fixed behaviour of --quiet/-q and its description
2015-07-25 17:55:12 +02:00
Daniel Marjamäki
acc1566f64
uninitvar: Improved condition handling. Fixes one problem when running 'tools/run_more_tests.sh test/testuninitvar.cpp'
2015-07-25 17:55:01 +02:00
PKEuS
8ed0180279
Use C++11 string.back() instead of string[string.length()-1]
2015-07-25 17:19:53 +02:00
Daniel Marjamäki
b0df668975
fix VS warning
2015-07-25 13:23:48 +02:00
Daniel Marjamäki
e5151a13ab
Fixed #6867 (False positive memleak)
2015-07-25 11:37:03 +02:00
PKEuS
53d7620b1a
VS solution: Use check.h as precompiled header (reduces build time for core by 50%)
2015-07-25 11:13:19 +02:00
Daniel Marjamäki
f939381673
Preprocessor: Fix buffer overflow if line is empty
2015-07-24 19:19:07 +02:00
Simon Shanks
9910c1fa0c
Fixed #6617 (preprocessor performance improvement)
2015-07-24 13:30:41 +02:00
Daniel Marjamäki
8ffa917fa2
Fixed #6863 (AST: wrong handling of assignment between ? and :)
2015-07-24 13:02:00 +02:00
Daniel Marjamäki
234669b02b
Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected.
2015-07-24 08:30:38 +02:00
PKEuS
795e5de903
Refactorization: Cleaned up after ExecutionPath removal
2015-07-23 20:37:09 +02:00
Daniel Marjamäki
367eecf0db
Fixed Cppcheck internal warning, simpleMatch can be used instead of Match
2015-07-23 19:13:50 +02:00
Daniel Marjamäki
c2a15ac286
Removed ExecutionPath
2015-07-23 19:01:12 +02:00
Daniel Marjamäki
3dbf290220
Refactor CheckStl::erase so it doesn't use ExecutionPath
2015-07-23 18:53:31 +02:00
Daniel Marjamäki
ea933e9873
CheckUninitVar: Removed ExecutionPath based checker
2015-07-23 17:28:18 +02:00
PKEuS
d45021673e
Assign different IDs for different nullPointer messages ( #6166 )
2015-07-23 14:53:18 +02:00
Daniel Marjamäki
0b81a267f4
uninitvar: handling arrays in non-executionpath checker
2015-07-23 14:51:38 +02:00
PKEuS
ce9272a4ed
Refactorized file listing code (CLI):
...
- Apply PathMatch in FileLister::recursiveAddFiles() already to avoid touching directories that are ignored (#5775 )
- Simplified code to warn about header exclusion; use Path::isHeader() instead of custom header filename detection
2015-07-23 14:28:17 +02:00
PKEuS
229d488048
Fixed build
2015-07-23 13:15:58 +02:00
Frank Zingsheim
1c12378ce9
Simplified pattern in Tokenizer::simplifyExternC() ( #5544 )
2015-07-23 13:04:25 +02:00
Daniel Marjamäki
eda3fdc96a
CheckCondition: Refactoring function parameter lookup
2015-07-23 12:06:33 +02:00
Frank Zingsheim
907dea92b1
Fixed #6844 (CMake with matchcompiler)
2015-07-23 10:49:53 +02:00
Frank Zingsheim
6485339d66
Support lambdas in "else if" simplification ( #6860 )
2015-07-23 09:41:35 +02:00
Daniel Marjamäki
8d8c03dad8
uninitvar: removed returns from new checking to fix 'more' tests. these returns should be readded when the executionpath checking is removed.
2015-07-23 09:21:53 +02:00
Daniel Marjamäki
79067ac031
uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases.
2015-07-23 08:46:59 +02:00
Daniel Marjamäki
1de1aaa2f4
CheckUninitVar: Fix crash when AST is not created properly
2015-07-22 22:17:12 +02:00
Daniel Marjamäki
1f5eea98b5
CheckUninitVar: Fix a FP reported for invalid code
2015-07-22 21:58:06 +02:00
Daniel Marjamäki
42ed436e9d
Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath
2015-07-22 20:31:58 +02:00
Daniel Marjamäki
75f922e799
cleanup checkother
2015-07-22 18:48:43 +02:00
Daniel Marjamäki
b38062743d
Refactoring handling of if conditions in CheckMemoryLeak
2015-07-22 16:45:14 +02:00
PKEuS
258e3b9dc3
Refactorization: Renamed Token::isOperator() to Token::isOperatorKeyword() to avoid confusion with Token::isOp(), use Token::isOperatorKeyword() in setVarId().
2015-07-22 13:57:51 +02:00
Robert Reif
4e693f1620
Fixed #6827
2015-07-22 13:57:51 +02:00
PKEuS
ab1113fb16
Fixed crash on garbage code #6859
2015-07-22 13:33:24 +02:00
Daniel Marjamäki
b2b4bb49fa
Refactoring handling of comparisons
2015-07-22 12:31:18 +02:00
Daniel Marjamäki
c67776c04d
Testing: extract testcases, edit comparisons, run cppcheck, compare results
2015-07-22 09:52:24 +02:00
Daniel Marjamäki
6313304f77
Fix Travis build
2015-07-22 01:52:24 +02:00
Daniel Marjamäki
c6cadf5252
Fix Travis build
2015-07-22 01:41:01 +02:00
Daniel Marjamäki
350cba1c59
CheckLeakAutoVar: updated handling of comparisons after Tokenizer::simplifyIfNot was removed
2015-07-22 01:24:07 +02:00
Daniel Marjamäki
f711520892
Fixed #6852 (false negative: logical conjunction 'x == 0')
2015-07-21 22:26:22 +02:00
Daniel Marjamäki
f9d22f70db
Removed simplifyIfNot simplification ( #6072 )
2015-07-21 20:56:47 +02:00
Daniel Marjamäki
24269b1061
Refactoring CheckMemoryLeak::notvar, use AST instead of token parsing
2015-07-21 20:27:59 +02:00
Daniel Marjamäki
1b8252181d
Tokenizer: Removed Tokenizer::simplifyIfNotNull ( #6072 )
2015-07-21 17:58:44 +02:00
Daniel Marjamäki
ffc707246b
ValueFlow: Better handling of Known/Possible values after conditional unknown function call
2015-07-21 17:56:40 +02:00
PKEuS
7f6b6e43b1
Support strings in CheckStl::mismatchingContainers() ( #6839 )
2015-07-21 14:13:26 +02:00
PKEuS
a3eb725c3f
Support C++03-style of declaring a copy ctor as deleted ( #6585 )
2015-07-21 13:46:50 +02:00
amai2012
e8ac4d8e87
#6847 segmentation fault (invalid code) in Token::multiCompare. Fix and simple refactoring in Tokenizer
2015-07-21 13:40:50 +02:00
PKEuS
bdd53b4142
Fixed false positive #6717
2015-07-21 12:13:59 +02:00
PKEuS
dd9cb929bf
Refactorization in Preprocessor: Support beginning/end of file in removeSpaceNearNL(), avoid string copying when calling replaceIfDefined()
2015-07-21 12:13:58 +02:00
Daniel Marjamäki
2e2735518e
AST: Updated printAst
2015-07-21 11:54:11 +02:00
Daniel Marjamäki
8a72bb8aa8
AST: Fixed AST for struct initialisation
2015-07-21 11:40:42 +02:00
PKEuS
149d11d9ad
Improved handling of inline assembly ( #6813 ):
...
- Add ; after asm {} block if required
- Fixed inline suppressions
2015-07-20 23:09:54 +02:00
PKEuS
a0890ecd2c
Fixed false positive: Do not print useClosedFile on arrays ( #6823 )
2015-07-20 22:40:19 +02:00
PKEuS
c987a99ac8
Fixed hang on garbage code ( #6824 )
2015-07-20 22:33:32 +02:00
Daniel Marjamäki
749bb34deb
Fixed #6830 (ValueFlow: value of switch-variable inside switch)
2015-07-20 19:45:38 +02:00
Alexander Mai
defee734f5
#6846 segmentation fault (invalid code) in CheckClass::hasAssignSelf
2015-07-20 19:04:34 +02:00
Daniel Marjamäki
c0880c8d79
ValueFlow: Values that are assigned in switch are possible after switch
2015-07-20 09:36:56 +02:00
Frank Zingsheim
8416be4d9d
#6345 Tokenizer::simplifyTypedef() adds redundant 'typename' to declaration
2015-07-20 07:55:22 +02:00
amai2012
af9b67562b
Merge pull request #626 from simartin/ticket_6648
...
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after
2015-07-19 18:04:47 +02:00
Simon Martin
fa94f2e0f4
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after in CheckLeakAutoVar.
2015-07-19 17:37:50 +02:00
Alexander Mai
8b97f04de4
Try to address some Coverity issues. Add TODO testcase for #5783 . Introduce TODO_ASSERT macro.
2015-07-19 15:03:35 +02:00
Daniel Marjamäki
ce7e879460
ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction
2015-07-18 15:35:39 +02:00
Daniel Marjamäki
5aa0b284dc
ValueFlow: Evaluate more calculations when operands have known values
2015-07-18 15:03:57 +02:00
Simon Martin
1f73d71542
Ticket #5776 : Simplify (&a)->b into a.b
2015-07-17 23:27:35 +02:00
Simon Martin
af1b0cfddf
Ticket #6835 : Don't get confused by parentheses while detecting template parameter default values.
2015-07-17 21:30:34 +02:00
Daniel Marjamäki
25d9ebedd8
ValueFlow: fixed known/possible value of static variable
2015-07-17 20:48:37 +02:00
Daniel Marjamäki
f1e410a878
ValueFlow: value that is changed in do while loop must be possible instead of known.
2015-07-17 20:30:34 +02:00
Daniel Marjamäki
69c1a7ecb1
ValueFlow: default argument values are not known, they are possible
2015-07-17 16:05:07 +02:00
Daniel Marjamäki
cb04dfbd37
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-17 15:30:23 +02:00
Daniel Marjamäki
577ab1c2ac
ValueFlow: result of ? is not 'known'
2015-07-17 15:22:24 +02:00
Daniel Marjamäki
61cf224f32
ValueFlow: Make known loop value possible
2015-07-17 10:24:24 +02:00
Daniel Marjamäki
9bdee7fce9
ValueFlow: Refactoring setTokenValue()
2015-07-17 09:46:31 +02:00
Daniel Marjamäki
3d5781743c
ValueFlow: Restore handling of not
2015-07-16 21:17:44 +02:00
Daniel Marjamäki
15a8e4d2df
Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
...
This reverts commit a3fbad50cb
.
The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki
09efe140fe
ValueFlow: Change value to 'Possible' after conditional assignment in inner loop
2015-07-16 21:08:32 +02:00
Daniel Marjamäki
38214b6907
ValueFlow: function arguments only has 'possible' values
2015-07-16 20:49:14 +02:00
Daniel Marjamäki
fa13179c68
Fixed Cppcheck warning, condition is always true
2015-07-16 20:23:25 +02:00
Daniel Marjamäki
a3fbad50cb
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-16 20:17:57 +02:00
Daniel Marjamäki
88491267d6
ValueFlow: Added Value::valueKind that says if value is known or possible
2015-07-16 17:33:16 +02:00
Alexander Mai
d45aa6170b
Minor refactoring in Tokenizer: Optimize for C code and use nullptr instead of 0
2015-07-16 00:29:48 +02:00
Simon Martin
2d8993319c
Ticket #6810 : Avoid infinite loop upon invalid typed enum declaration.
2015-07-15 21:39:15 +02:00
Daniel Marjamäki
b821e996e1
MathLib: Add TEST_MATHLIB_VALUE that is used to test MathLib::value
2015-07-15 17:36:41 +02:00
Alexander Mai
b604d63dd8
#6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code
2015-07-15 15:19:48 +02:00
Alexander Mai
b30d9ffe98
#6838 cppcheck hangs on some strange input code. Token::astOperand1/2 throw internal error on garbage code instead of creating endless recursion in AST
2015-07-14 21:07:10 +02:00
Daniel Marjamäki
177fd9c79d
MathLib: make isinf and isnan more portable
2015-07-14 20:48:08 +02:00
Antti Tuppurainen
a75872a15e
Fix uniform init in out-of-class ctor-initer
2015-07-14 18:09:07 +02:00
Daniel Marjamäki
405a1fba11
ValueFlow: set values for false/true
2015-07-14 18:02:26 +02:00
Daniel Marjamäki
1a872a2c9f
Fixed #6019 (false negative: Expression is always true/false '!(v!=10) && !(v!=20)')
2015-07-13 20:53:49 +02:00
Daniel Marjamäki
7ccd30362c
Fixed #6826 (False positive: ValueFlow conditional value used in condition)
2015-07-12 19:35:47 +02:00
Daniel Marjamäki
a4a866ab07
Fix Cppcheck warning about non-explicit constructor for MathLib::value
2015-07-10 21:17:17 +02:00
Daniel Marjamäki
ac04541d56
MathLib: Add value class. this will allow more type-independant value handling.
2015-07-10 20:36:38 +02:00
Daniel Marjamäki
f36f1e8952
MathLib: Minor tweaks. Use toDoubleNumber instead of std::atof. Only use clang workaround with clang.
2015-07-10 18:34:28 +02:00
Daniel Marjamäki
81d9c90890
Fixed Cppcheck warning caused by a redundant null pointer test.
2015-07-08 21:04:38 +02:00
Daniel Marjamäki
0dd008e068
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 16:06:35 +02:00
Daniel Marjamäki
5a9328f26a
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 13:41:27 +02:00
Simon Martin
7bfb1fb545
Simplify the code handling C++0x typed enumerations.
2015-07-06 23:37:16 +02:00
Boris Egorov
f7c6140e1a
checkautovariables: Simplify some conditions
2015-07-05 17:15:13 +02:00
Daniel Marjamäki
f3b4c1d0db
Remove some useless casts, probably added to avoid false positives.
2015-07-04 13:19:21 +02:00
Daniel Marjamäki
b8e77c8005
valueflow: fix for ?:. the condition result is not a result of the ?.
2015-07-04 11:17:38 +02:00
Daniel Marjamäki
fef251ac76
negative array size: fixed noise when array is not vla
2015-07-04 09:42:42 +02:00
Daniel Marjamäki
7e1ddea653
One more fix for #6811 (ValueFlow: result of ?:)
2015-07-02 20:52:04 +02:00
Daniel Marjamäki
c751039612
Fixed #6811 (ValueFlow: result of ?:)
2015-07-02 20:11:27 +02:00
amai2012
4a1695c879
#6807 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #6808 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw InternalError on garbage code
2015-07-01 16:31:49 +02:00
Alexander Mai
6e03e7dca2
Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0
. Run astyle
2015-07-01 07:50:13 +02:00
amai2012
480a5672b0
#6298 stack overflow in Scope::findFunctionInBase (endless recursion). Fix handling of circular class hierarchy
2015-07-01 00:04:01 +02:00
amai2012
1604e751e5
Fix some compiler warnings which got introduced recently
2015-06-30 20:11:51 +02:00
amai2012
99dfd55d0c
#6804 segmentation fault (invalid code) in Token::getValueTokenDeadPointer. Fix null pointer access
...
TestGarbage: Increase coverage by running all code snippets as C as well as C++ code. (inspired by #6800 )
2015-06-30 19:40:22 +02:00
amai2012
c0b91662ba
#6803 segmentation fault (invalid code) in Token::findClosingBracket.
2015-06-30 12:16:55 +02:00
amai2012
0849deed01
#6801 C: FN variable scope, FP unused value?. Fix typo from d7aa65c1fc
2015-06-30 08:46:30 +02:00
amai2012
11538c84f6
Refactoring: Distinguish between C and C++ code
...
Refactoring: Replace CheckNonReentrantFunctions::initNonReentrantFunctions by static initialization
2015-06-29 21:17:15 +02:00
Alexander Mai
d7aa65c1fc
#6800 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix null pointer access for invalid C code
2015-06-29 19:56:02 +02:00
Martin Ettl
b8e08ca5d8
Code cleanup.
2015-06-28 19:27:23 +02:00
Martin Ettl
7ff4d10c43
Astyle formatting, no functional changes.
2015-06-28 19:25:13 +02:00
amai2012
5814c3b84c
Fix some compiler warnings with VS
...
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai
0b225fa02f
2nd attempt to fix crash in CheckUnusedFunctions::check. CheckBufferOverrun::checkBufferAllocatedWithStrlen: Don't check for 'new' in C code.
2015-06-28 18:34:09 +02:00
Alexander Mai
02a3a01eca
Fix compiler warnings
2015-06-28 18:07:31 +02:00
Alexander Mai
2c73518e29
Fix platform-dependent test result, formatting and crash in whole program analysis
2015-06-28 17:54:48 +02:00
amai2012
4a47b8b3ae
Refactoring: Better distinguish between C and C++ in a few checks.
2015-06-28 16:49:16 +02:00
Alexander Mai
56e90f95d9
Corrections for non-Microsoft compilers
2015-06-28 12:34:08 +02:00
amai2012
649a89d308
Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
...
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
Alexander Mai
e75662aaf1
#6792 segmentation fault (invalid code) in TemplateSimplifier::templateParameters. Avoid null pointer access
2015-06-25 20:48:05 +02:00