Daniel Marjamäki
15d814e609
classPublicInterfaceDivZero: Try to make the error message a bit better. Added variable name and what the bad input value is.
2017-10-21 13:00:52 +02:00
Daniel Marjamäki
299835da2f
classPublicInterfaceDivZero: don't warn in overloaded operators. It is normal behaviour that these are not protected.
2017-10-21 08:56:23 +02:00
Daniel Marjamäki
8a7411abdb
CheckClass: Fix wrong 'public interface' warnings
2017-10-20 22:10:55 +02:00
Dmitry-Me
5bf29fae49
Tests for unrecognized conversion specifiers
2017-10-20 21:46:24 +03:00
Dmitry-Me
4e881e98cc
Improve test coverage for %I used with printf
2017-10-20 21:13:14 +03:00
Daniel Marjamäki
1d5e3e4f0c
Fixed #8247 (False positive knownConditionTrueFalse)
2017-10-20 17:31:58 +02:00
Daniel Marjamäki
86c84029e3
New check: Check public interface of classes ( #8248 )
2017-10-20 02:02:51 +02:00
Dmitry-Me
7e2cef4952
Improve test coverage for %z used with printf
2017-10-19 19:05:16 +03:00
Dmitry-Me
f070fa1977
Improve test coverage for passing pointers into printf
2017-10-19 19:03:12 +03:00
Dmitry-Me
975132bc62
Improve test coverage for %td used with printf
2017-10-18 19:00:40 +03:00
Dmitry-Me
b278436069
Improve test coverage for %j used with printf
2017-10-18 18:22:51 +03:00
Dmitry-Me
a7d58a2468
Fix macro parameters list
2017-10-17 23:53:14 +03:00
Dmitry-Me
35a4822b77
Initial test coverage for %td used with scanf
2017-10-17 18:09:10 +03:00
Dmitry-Me
5beea50d3f
Improve test coverage for %ld, %lld, %I64x used with scanf
2017-10-17 18:07:42 +03:00
Daniel Marjamäki
ad1749738e
Fixed #6153 (ValueFlowBeforeCondition: Handle global variables)
2017-10-17 16:55:37 +02:00
Daniel Marjamäki
6d59290858
Fixed #10 (ValueFlow: condition variable has known value in switch case)
2017-10-16 21:51:30 +02:00
Dmitry-Me
f27e98f910
Fix macro parameters list
2017-10-16 18:49:53 +03:00
Daniel Marjamäki
0425f1d46d
Fixed #8241 (FP: Same expression on both sides of operator)
2017-10-16 17:39:50 +02:00
Dmitry-Me
2c61f40c35
Initial test coverage for %hd, %hhd, %jd, %I64d, %I32d used with scanf
2017-10-16 18:07:08 +03:00
Dmitry-Me
0ed8126b15
Tests for missing width specifier for scanf
2017-10-16 17:53:46 +03:00
Dmitry-Me
d6cac72784
Test for %I without width specifier used with printf
2017-10-16 17:51:38 +03:00
Robert Reif
69b75c43b4
SymbolDatabase: fix wrong type in union test.
2017-10-15 09:45:02 -04:00
IOBYTE
352fd7a381
SymbolDatabase: Add support for functions in unions. ( #973 )
2017-10-15 11:49:36 +02:00
Dmitry-Me
cad30446e4
Resolve C4800
2017-10-14 22:50:56 +03:00
Dmitry-Me
2c040096ca
Improve test coverage for va_end() called before va_start()
2017-10-14 19:28:26 +03:00
Dmitry-Me
b678f3c4c4
Improve test coverage for %c used with scanf_s
2017-10-13 19:08:14 +03:00
Dmitry-Me
d32a8884bf
Initial test coverage for %lx, %ld, %llx, %lld, %hx, %hhx, %Lx, %jx, %zx and %tx used with scanf
2017-10-13 18:36:12 +03:00
Dmitry-Me
7a7f34fb11
Improve test coverage for %zx, %zu used with printf
2017-10-13 18:17:33 +03:00
Dmitry-Me
d4a435a520
Tests for %Id, %Ld, %I32x used with scanf
2017-10-12 18:18:38 +03:00
Dmitry-Me
2a6f63d995
Resolve C4305 - double constant truncated to float
2017-10-11 23:36:51 +03:00
Dmitry-Me
d12db51771
Function parameter was not used
2017-10-11 00:43:50 +03:00
Daniel Marjamäki
f9d8dd9f4d
testsuite: don't compare doubles with !=
2017-10-10 22:40:49 +02:00
Dmitry-Me
e59ebed3b0
Remove rather unexpected empty line
2017-10-10 23:18:30 +03:00
Dmitry-Me
bef6d6f446
Improve test coverage for %I used with scanf
2017-10-10 17:27:33 +03:00
Dmitry-Me
fcba5b88c2
Improve test coverage for string literals passed as read target into scanf
2017-10-09 18:50:24 +03:00
Dmitry-Me
9c0e6986da
Passing string literals into printf as %p is fine
2017-10-08 11:14:10 +03:00
Ayaz Salikhov
be2c65eb58
Simplify int vs bool
2017-10-08 07:54:39 +02:00
Daniel Marjamäki
92673afc8f
fixed 'make checkcfg'
2017-10-06 15:16:25 +02:00
Daniel Marjamäki
e4676b70dd
Remove wrong testcase test/cfg/windows.cpp, there is missing configuration for that given code
2017-10-06 14:42:19 +02:00
Daniel Marjamäki
2a6fbe2e3c
astyle formatting
...
[ci skip]
2017-10-05 23:01:42 +02:00
hexcoder
051a18b120
pull request for ticket 8180 (better diagnostic output for bailouts) ( #964 )
...
* sync build instructions from readme.txt
* refactored the patch from ticket 8180. Moved logic from macros to the bailoutInternal function
* adapt to new bailout message format
* adapt to new bailout message format
* adapt to new bailout message format
* compile fix for Microsoft platform
* remove directory part from file locations in bailout message (normalize)
* remove directory part from valueflow message filter
* adapt tests to file format without directory part
* adapt tests to file format without directory part
* new line number agnostic assert_equals methods
* new line number agnostic assert_equals methods
* adapt to new method assertEqualsWithoutLineNumbers()
* adapt to new method assertEqualsWithoutLineNumbers()
* Bugfix: do not replace line number with spaces, remove it
* review changes: const char * -> std::string, size_t -> int, std::to_string() -> MathLib::toString()
* set #line at the beginning to guard against insertions from match compiler
* Bugfix: counting lines can be difficult :-) #line 1 -> #line 2
* added method stripDirectoryPart()
* added method stripDirectoryPart()
* used new method Path::stripDirectoryPart()
* new dependency path.h in lib/valueFlow.cpp
* code cleanup, removing redundant temporary objects and casts
2017-10-05 23:03:13 +02:00
Dmitry-Me
d170b496ba
Improve test coverage for wide string literals passed into printf
2017-10-05 17:45:06 +03:00
orbitcowboy
00bff02e13
Formatted the code. There are no functional changes [ci skip].
2017-10-05 09:02:55 +02:00
Dmitry-Me
da0185387f
Improve coverage for %j used with printf
2017-10-04 17:51:35 +03:00
Alexey Eryomenko
22483baf72
missed simplification in parsing of std function declaration resulted in ( #967 )
...
wrong type detection
2017-10-03 22:10:13 +02:00
Dmitry-Me
9564442167
Improve test coverage for detecting wrong file mode
2017-10-03 18:25:15 +03:00
Dmitry-Me
2b7ef7156a
Improve test coverage for accessing closed files
2017-09-29 17:12:50 +03:00
Daniel Marjamäki
04c2be33a6
Unit testing visual studio import
2017-09-24 22:57:24 +02:00
Daniel Marjamäki
5993c40d5b
Improve 'opposite inner condition' check
2017-09-22 14:01:20 +02:00
Daniel Marjamäki
411c5e5f7e
Fixed #8190 (False positive constStatement - return (struct media_frames_per_second) {0};)
2017-09-21 22:50:46 +02:00
Daniel Marjamäki
71d207c034
Fixed #8226 (Tokenizer: Wrong handling of string literal u"abc")
2017-09-21 13:33:14 +02:00
Daniel Marjamäki
e61222126f
Fixed #8176 (ValueFlow: variable might be changed if it's passed by reference to method)
2017-09-20 22:09:09 +02:00
Daniel Marjamäki
5f4b06c0f4
isVariableChangedByFunctionCall: Fix FN when constructor argument is const reference
2017-09-20 14:03:56 +02:00
Daniel Marjamäki
4318521fc1
Fixed #8187 (isVariableChangedByFunctionCall: Constructor reference argument)
2017-09-20 12:53:25 +02:00
Daniel Marjamäki
b73f5fec7d
Fix invalid code in TestStl test case
2017-09-19 23:22:17 +02:00
Daniel Marjamäki
1a057bc23a
Revert "Remove redundant safety logic (CID 1368511)"
...
This reverts commit d892031f28
.
2017-09-19 23:13:31 +02:00
Daniel Marjamäki
d892031f28
Remove redundant safety logic (CID 1368511)
2017-09-19 23:07:02 +02:00
Daniel Marjamäki
840c7eb258
checkFloatToIntegerOverflow: check all calculations, not only in function bodies
2017-09-19 19:30:24 +02:00
Daniel Marjamäki
9268c2034a
checkSignConversion: check all calculations, not only in function bodies
2017-09-19 19:25:33 +02:00
Daniel Marjamäki
f6e30eee19
checkIntegerOverflow: handle long and long long also
2017-09-19 19:14:29 +02:00
Daniel Marjamäki
cac7146cac
checkIntegerOverflow: check all calculations, not only in function bodies
2017-09-19 14:43:48 +02:00
Daniel Marjamäki
6bc0df2908
checkTooBigBitwiseShift: Separate id for signed shift overflow
2017-09-19 09:21:20 +02:00
Daniel Marjamäki
be0ad20a04
checkTooBigBitwiseShift: bitshift overflow when lhs is signed
2017-09-19 09:08:44 +02:00
Daniel Marjamäki
fe0a514a7c
Fix testrunner
2017-09-16 02:13:48 +02:00
Daniel Marjamäki
2e6d78bd08
Fixed #8184 (Syntax error: case outside switch)
2017-09-15 22:37:31 +02:00
Daniel Marjamäki
1dbcba4dd6
Fixed #8221 (ValueFlow: value for static variable that is not written)
2017-09-15 15:58:19 +02:00
Daniel Marjamäki
d79762cfc3
Fixed #7449 (reademptycontainer (inconclusive) when variable changed in function )
2017-09-15 10:49:58 +02:00
Daniel Marjamäki
ef1f3fbee6
Fixed #8173 (ValueFlow: use AST when setting values in assignment RHS ((n=42) && n=='A'))
2017-09-14 22:49:47 +02:00
Daniel Marjamäki
927b14b60f
Fixed #8217 (Crash in isVariableChanged())
2017-09-14 15:45:15 +02:00
Dmitry-Me
6cfcf8610d
Improve coverage for operator= return type detection.
...
This adds a testcase with parameter being a reference to non-const.
2017-09-14 00:12:10 +03:00
Daniel Marjamäki
bb20c0504e
CheckCondition: Fix FP in daca (iqtree) 'in >> ch'
2017-09-13 22:46:36 +02:00
Daniel Marjamäki
8f6c98e3d6
Remove TestGarbage testcase with unhandled characters
2017-09-12 22:48:30 +02:00
Daniel Marjamäki
5c7cf584ef
bump simplecpp
2017-09-12 22:42:10 +02:00
Daniel Marjamäki
56544ac936
Fixed #8211 (Crash on incomplete code in isVariableChanged ())
2017-09-11 13:45:36 +02:00
Daniel Marjamäki
9f4fc7b323
Rename sameConditionAfterEarlyExit to identicalConditionAfterEarlyExit
2017-09-10 22:59:39 +02:00
Daniel Marjamäki
db321c2617
CheckCondition: Fix FP when there is increment/decrement in condition (daca icu)
2017-09-10 22:58:05 +02:00
Daniel Marjamäki
c34fdd1905
CheckCondition: Fix FP for undeclared variables (daca)
2017-09-10 22:30:41 +02:00
Daniel Marjamäki
b9b47809f9
Fixed #8197 (iscast: '(b)&1' is not a cast)
2017-09-08 22:52:16 +02:00
Daniel Marjamäki
899ad8479d
CheckCondition: Fixed FP when condition contains global static variable
2017-09-08 15:44:56 +02:00
Daniel Marjamäki
d9adb5432a
astyle formatting
...
[ci skip]
2017-09-08 15:41:14 +02:00
Nekto89
9cbfa0e383
Fix #7803 : false negative: condition is always true 'if (flags & A)' ( #938 )
2017-09-08 14:30:42 +02:00
Daniel Marjamäki
58db814d72
Rephraze /Same/Identical/
2017-09-08 12:41:33 +02:00
Daniel Marjamäki
97125acabd
Fixed #7365 (False positive: Use of erased iterator)
2017-09-08 09:45:30 +02:00
Daniel Marjamäki
57004ed533
Fixed #7663 (False positive: uninitialized variable (multi variables in inner scopes))
2017-09-07 23:08:55 +02:00
Daniel Marjamäki
120d0f86d0
CheckCondition: Fix FP about same condition when switch case is used (daca)
2017-09-07 22:05:01 +02:00
Daniel Marjamäki
f2d56363d3
CheckCondition: Fix TODO assertion
2017-09-06 22:53:36 +02:00
Daniel Marjamäki
e0c7f7f8f2
CheckCondition: Fix FP when there are method calls in condition
2017-09-06 22:26:00 +02:00
Daniel Marjamäki
35736364f8
Fixed #8199 (false negative: (warning) Same condition '...', second condition is always false)
2017-09-05 22:45:28 +02:00
Daniel Marjamäki
e5e6f37e41
Fixed #7405 (false positive: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.)
2017-09-05 22:03:29 +02:00
Daniel Marjamäki
c1000998f0
CheckCondition: Fix FP found in daca results (ace)
2017-09-05 09:33:35 +02:00
Daniel Marjamäki
d82805b7fe
CheckCondition: Improved checking for same conditions
2017-09-04 22:40:34 +02:00
Daniel Marjamäki
abae5e0156
Fixed #8198 (false positive: (warning) Same condition, second condition is always false)
2017-09-04 22:25:20 +02:00
Daniel Marjamäki
ad494b996c
TestCondition: break out tests to functions
2017-09-04 22:11:53 +02:00
Daniel Marjamäki
d838dc2129
CheckCondition::multiCondition2: Fix FN for pointers
2017-09-04 15:58:22 +02:00
Daniel Marjamäki
9465dca583
CheckCondition: Fix FPs for aliased variables (daca)
2017-09-04 09:34:03 +02:00
Daniel Marjamäki
a02fd54a69
ValueFlow: Avoid FPs for aliased variables
2017-09-03 23:24:55 +02:00
Daniel Marjamäki
ef4a7ba7f2
Fix FP in CheckCondition::multiCondition2
2017-09-03 14:46:37 +02:00
Daniel Marjamäki
b9849d9e4e
CheckCondition::multiCondition2: Handle loops better
2017-09-03 11:03:01 +02:00
Daniel Marjamäki
01e65d3e00
Improved CheckCondition::multiCondition2 so deeper bugs are found
2017-09-03 10:44:22 +02:00
Daniel Marjamäki
f2ec5f24ce
Fixed #5845 (new check: same condition after noreturn conditional code => second condition is always false)
2017-09-03 10:34:34 +02:00
Hinterwaeldlers
8aa568f085
Corrected noexcept constructor delegating handling ( #948 )
2017-09-02 22:54:23 +02:00
Daniel Marjamäki
1ecefa045a
Fixed #8194 (False positive reademptycontainer - range based loop)
2017-09-02 22:22:32 +02:00
Daniel Marjamäki
30f04a5a96
Fixed #8195 (False positive uninitvar (regression) - valueflow misses variable initialization via istringstream >>)
2017-09-02 21:53:51 +02:00
Daniel Marjamäki
0b751dcc1b
Opposite conditions: Better matching when outer condition uses &&
2017-09-01 23:24:15 +02:00
Daniel Marjamäki
3b4f60fd21
Updated error message
2017-09-01 13:33:47 +02:00
Daniel Marjamäki
7fad1b9a36
Improved checking for opposite conditions
2017-08-31 22:53:21 +02:00
Daniel Marjamäki
dce942197c
Fixed #8186 (Inner condition always false inside for loop)
2017-08-31 16:00:12 +02:00
Daniel Marjamäki
82527422a8
Fixed #5614 (Incorrect syntax error with function pointer typedef and dependent template types)
2017-08-30 19:18:05 +02:00
Daniel Marjamäki
9c99bc43c2
ValueFlow: Skip wrong handling of lambda functions. TODO: handle lambda functions properly.
2017-08-28 22:39:12 +02:00
Daniel Marjamäki
02a1b7cd2d
Fixed #7965 (valueFlowForward: Improved handling of correlated variables)
2017-08-27 19:50:44 +02:00
Daniel Marjamäki
713f607168
Fixed #8156 (wrong ast for 'z = (x & (unsigned)1) | (y & (unsigned)2);')
2017-08-26 23:25:45 +02:00
Daniel Marjamäki
e74e4c6934
Fixed #8030 (False positive 'constStatement' when indexing with {})
2017-08-26 11:59:09 +02:00
Daniel Marjamäki
529b255e99
ValueFlow: Better errorpath for increment/decrement
2017-08-25 23:07:26 +02:00
Daniel Marjamäki
b1b8e5270a
ValueFlow: Better errorpath for increment/decrement
2017-08-25 22:15:52 +02:00
Heiko Eißfeldt
bab2b26d10
Fixed #8154 (heap use after free in tokenlist)
2017-08-25 17:17:19 +02:00
Daniel Marjamäki
50636f75ba
ValueFlow: Improved error path for compound assignments
2017-08-24 22:02:49 +02:00
Daniel Marjamäki
d160d27417
Fixed #8172 (False positive uninitvar on sizeof *ptr)
2017-08-23 22:17:49 +02:00
Daniel Marjamäki
f10634c021
ValueFlow: Dont try to evaluate '/=0;'
2017-08-23 17:53:05 +02:00
Daniel Marjamäki
167cfb1ac5
valueFlowForward: improve handling of compound assignments
2017-08-23 11:13:47 +02:00
Daniel Marjamäki
71b0370389
Fixed #1793 (CheckType::checkFloatToIntegerOverflow: assignments)
2017-08-23 05:34:47 +02:00
Daniel Marjamäki
2679b576c2
Fixed #1693 (false negative: std::vector, negative index)
2017-08-22 11:04:02 +02:00
Heiko Eißfeldt
04bcc86d59
Fixed #439 (Patch: Cppcheck reports wrong filename for filenames containing 8-bit ASCII)
2017-08-21 12:52:15 +02:00
Daniel Marjamäki
3abb62a6d1
Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);)
2017-08-20 19:47:26 +02:00
Daniel Marjamäki
94c5c3703c
astyle formatting
...
[ci skip]
2017-08-16 18:56:02 +02:00
Daniel Marjamäki
92e9744020
Fixed #8148 (Tokenizer: Braces are not added properly in do while)
2017-08-16 18:55:34 +02:00
Martin Güthle
1d491bd332
Treat noexcept correctly
...
Converts the noexcept to the already correctly handled noexcept(true)
2017-08-16 11:31:19 +02:00
Daniel Marjamäki
5c733c8f22
Fixed #8152 (Garbage code cause crash '0|\0|0>;')
2017-08-15 23:19:42 +02:00
Hinterwaeldlers
705e5e3468
Fix for http://trac.cppcheck.net/ticket/8151 ( #942 )
...
* Taking care of incorrect template syntax (missing close)
Forward the incorrectness via throw, as there is no direct access to the
syntaxError method, without converting the function to a member function
2017-08-15 22:40:55 +02:00
Dmitry-Me
6303437163
Resolve C4800
2017-08-15 17:42:56 +03:00
orbitcowboy
61e47208eb
Removed hard coded avr8 platform and moved it into a platform file (avr8.xml).
2017-08-09 11:58:27 +02:00
amai2012
39955973e9
Merge pull request #931 from IOBYTE/master
...
Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='
2017-08-02 21:16:29 +02:00
Daniel Marjamäki
e6f6efc684
astyle formatting
...
[ci skip]
2017-08-02 07:48:38 +02:00
Robert Reif
f5044bb65f
Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='.)
...
Do not count static member variables when trying to figure out if
'operator =' is needed.
2017-08-01 19:52:41 -04:00
Daniel Marjamäki
9ef9d0e4a8
Fixed #8128 (False negative: variable is assigned value that is not read)
2017-08-01 14:56:53 +02:00
Daniel Marjamäki
91eb0f1fad
Removed XML version 1
2017-07-29 18:56:22 +02:00
Simon Martin
aa35462add
Ticket #8091 : Don't replace std types within enum definitions. ( #922 )
2017-07-29 11:56:09 +02:00
Daniel Marjamäki
515e84ed00
Renamed PathMatch::Match to PathMatch::match
2017-07-28 11:27:04 +02:00
Daniel Marjamäki
eb288ec2a1
CheckStl: Use AST to handle iterator comparisons better
2017-07-26 23:13:01 +02:00
Andreas Pokorny
b802b98136
Do not warn when unique pointers are passed by value
...
A unique pointer should only be passed by value or by const reference.
Passing by value means transferring ownership it makes no sense to have a pass by value Warning for unique_ptr
Signed-off-by: Andreas Pokorny <andreas.pokorny@siemens.com>
2017-07-25 11:17:56 +02:00
Daniel Marjamäki
0a03bbb320
Fixed #6315 (false positive - unreadVariable - variable is used via pointer)
2017-07-23 23:32:14 +02:00
Daniel Marjamäki
e58344c2c9
Fixed compiler warning
2017-07-22 16:23:33 +02:00
Daniel Marjamäki
bf5040e3d6
Fixed #7701 (ValueFlow: handle 64-bit unsigned values )
2017-07-22 12:19:46 +02:00
Daniel Marjamäki
12b7843937
astyle formatting
...
[ci skip]
2017-07-21 09:17:25 +02:00
Daniel Marjamäki
255d0410a4
Fixed #8085 (Token::expressionString: unsigned long long)
2017-07-21 09:16:42 +02:00
Robert Reif
354a773bfe
Fix #8020 (ValueType: no value type for iterator + constant)
2017-07-16 11:27:32 -04:00
Daniel Marjamäki
fabe07ffd6
Merge pull request #924 from IOBYTE/master
...
Fixed #6985 (SymbolDatabase: Function pointer not set when calling bas…
2017-07-16 14:04:25 +02:00
Robert Reif
b0aec042a6
Fixed #6985(SymbolDatabase: Function pointer not set when calling base class function)
...
Use using namespace when looking up types.
2017-07-15 19:14:15 -04:00
Daniel Marjamäki
814d2ae2a4
Fixed #7028 (False positive: opposite conditions (const method modifies variable))
2017-07-10 23:12:45 +02:00
Daniel Marjamäki
f85e43d21f
Fixed #8059 (Tokenizer::simplifyWhile0: for loop that modifies local variable)
2017-07-09 22:44:10 +02:00
Daniel Marjamäki
dff9d13758
Fixed #8115 (Tokenizer: links not properly set in r-value template 'Foo<int> && foo')
2017-07-09 13:26:59 +02:00