Daniel Marjamäki
3f55707b30
Fixed #8064 (Taking the address of a moved variable is not accessing it)
2018-11-11 12:47:27 +01:00
Paul Fultz II
e46691597e
Fix issue 8841: FP knownConditionTrueFalse - Dont treat unknown function as noreturn ( #1474 )
...
* Fix issue 8841: Dont treat unknown function as noreturn
* Add a parameter to set default value when the function is unknown
2018-11-11 08:04:01 +01:00
Daniel Marjamäki
ee2dfb6604
Fixed #8058 (False positive returnAddressOfAutoVariable within lambda)
2018-11-11 07:52:38 +01:00
Daniel Marjamäki
93cde415a7
Fixed #7988 (variable in condition gets wrong varid)
2018-11-11 07:50:25 +01:00
Daniel Marjamäki
148f257c6b
Fixed #8838 (False positive on overridden virtual function that is marked both const and final)
2018-11-10 21:57:50 +01:00
Daniel Marjamäki
8327aab127
Fixed #8628 (Wrong AST in case)
2018-11-10 21:32:06 +01:00
Daniel Marjamäki
d5a478d5c5
astyle formatting
...
[ci skip]
2018-11-10 21:30:01 +01:00
Daniel Marjamäki
4cef2e94e7
Fixed #8368 (FP redundantAssignment - assignment has unknown side-effects)
2018-11-10 18:42:13 +01:00
IOBYTE
69e6e11844
Fix a template simplifier namespace bug in #7145 ( #1473 )
...
* Fix a template simplifier namespace bug in #7145
* Refactor template simplifier to only call getTemplateDeclarations once per loop.
2018-11-10 16:41:14 +01:00
Paul Fultz II
1ffcc6b730
Add initial lifetime checker ( #1448 )
...
* Inital valueflow lifetime checker
* Forward values
* Add initial tests
* Fix deplicate messages
* Fix traversing nested lambdas
* Turn test case into a todo
* Skip if returning a container
* Fix FP when using references
* Add missing header
* Fix FP from broken scopes
* Fix FP with static variable
* Add test for more FPs
* Parse lambda functions
* Check for capture by value
* Add tests for using a container and lambda together
* Fix cppcheck errors
* Add test for nextAfterAstRightmostLeaf
* Add valueflow tests
* Update error message
* Check for correct lambda token
* Improve error path reporting
* Fix hang when parsing arrays that look almlost like lambdas
2018-11-10 16:40:40 +01:00
IOBYTE
e302e6e7a1
Fix symbol database argsMatch to skip all redundant type information (class, struct, union, enum) ( #1472 )
2018-11-09 15:54:17 +01:00
IOBYTE
67fe99fcd9
Fix symbol database argsMatch function and its usage so qualified types are handled properly. ( #1470 )
...
* Fix symbol database argsMatch function and its usage so qualified types are handled properly.
* Remove assert.
2018-11-09 06:11:48 +01:00
Paul Fultz II
36e663e250
Fix issue 8839: FP knownConditionTrueFalse - condition inside a while-clause ( #1469 )
2018-11-09 06:09:51 +01:00
IOBYTE
17a8a4898d
Fix another template simplifier namespace bug. ( #1467 )
...
* Fix another template simplifier namespace bug.
* Add missing forward declarations caused by token bug.
2018-11-07 21:25:42 +01:00
Paul Fultz II
7373be2bfa
Add a pass in valueflow for terminating conditions ( #1323 )
...
* Add valueflow for terminating conditions
* Add valueflow test
* Dont check for same expressions for now to avoid double diagnostics
* Check nesting
* Add more tests
* Ensure conditions happen in order
* Check for null
* Add error path
* Support same expression check as well
* Use early continue
* Skip checking the same token
* Avoid double condtion diagnosis
* Fix FP when in switch statements
* Fix FP when time function
* Skip conditional escapes
* Use simpleMatch
* Fix naming
* Fix typo
2018-11-07 06:49:07 +01:00
IOBYTE
c966f31183
Fixed #8835 (friend class and non-empty constructor: Uninitialized members not reported) ( #1466 )
2018-11-06 06:44:08 +01:00
Daniel Marjamäki
00340efc57
ValueFlow: Refactoring valueFlowCallFunction
2018-11-06 06:38:26 +01:00
IOBYTE
9b67e680ae
Fix template simplifier namespace support. ( #1464 )
2018-11-05 19:55:21 +01:00
Paul Fultz II
d62ed420d8
Add a check target to cmake ( #1465 )
2018-11-05 18:13:04 +01:00
Daniel Marjamäki
ca19894a04
ValueFlow: In evaluate handle correlated values
2018-11-05 18:07:35 +01:00
IOBYTE
2275f05f65
Fixed #8833 (false negative: No 'return' statement in non-void function causes undefined behavior.) ( #1463 )
2018-11-05 06:55:30 +01:00
Daniel Marjamäki
8a54420274
ValueFlow: Try to handle multiple argument values in <returnValue> evaluation
2018-11-04 20:52:12 +01:00
orbitcowboy
1d5e797e6d
testother: Fixed typos in tests. Replaced 'voif' with 'void'.
2018-11-04 14:46:22 +01:00
Daniel Marjamäki
6878de2c5e
ValueFlow: getExpressionRange, valueFlowRightShift
2018-11-03 23:25:46 +01:00
Daniel Marjamäki
f8b0584f6a
replace 'constexpr' with 'const'
2018-11-03 19:22:51 +01:00
Daniel Marjamäki
66ca03fa0c
Fixed #8826 (false negative: Invalid memory address freed)
2018-11-03 18:55:20 +01:00
Daniel Marjamäki
ef35b86b4a
Multipass Valueflow
2018-11-03 15:53:24 +01:00
Daniel Marjamäki
6138294e3d
Fixed #8818 (AST broken: restrict)
2018-11-03 11:05:38 +01:00
Daniel Marjamäki
9741239b2f
Fixed #8824 (False positive: uninitialized variable (regression))
2018-11-03 10:31:55 +01:00
Daniel Marjamäki
a4afcb5995
Revert "Fixed #8818 (AST broken: restrict)"
...
This reverts commit e7d61f399a
.
2018-11-02 21:07:37 +01:00
Daniel Marjamäki
0cc4555337
Revert "Tokenizer: Do not remove 'constexpr'"
...
This reverts commit 2f400b40ba
.
2018-11-02 21:07:24 +01:00
Daniel Marjamäki
2f400b40ba
Tokenizer: Do not remove 'constexpr'
2018-11-02 20:32:12 +01:00
Daniel Marjamäki
e7d61f399a
Fixed #8818 (AST broken: restrict)
2018-11-02 20:28:49 +01:00
Daniel Marjamäki
5de683ec49
Container size: Fix false positive
2018-11-02 20:10:40 +01:00
Daniel Marjamäki
e53be26f48
Try to fix Travis
2018-11-02 19:04:21 +01:00
Daniel Marjamäki
16cc20a232
ValueFlow: Better handling of container size values
2018-11-02 18:28:32 +01:00
Daniel Marjamäki
3798feecad
TemplateSimplifier : Remove 'class|struct' in template arguments
2018-11-02 14:49:40 +01:00
rikardfalkeborn
869e4ba6ab
Add check for return value of boolean function ( #1451 )
...
* Add check for return value of boolean function
The rule for converting an integer to a boolean is that 0 is mapped to
false and everything else is mapped to true. There is nothing wrong with
the following code (according to the standards):
bool f()
{
return -1;
}
and neither gcc nor clang will warn about it. However, it's a bit
confusing. This commit adds a check that warns when a value other than 0
or 1 is returned from a boolean function (similar to the existing check
that functions with boolean arguments are only passed 0 or 1). Since the
code is perfectly legal, set the severity to "Style".
* Use early continue and remove some braces
* Add testcase with multiple returns
* Avoid null pointer dereference in case of return without operand
* Skip lambdas
Add TODO-test cases that shows FPs when the return type of lambdas are
specified explicitly (this is a problem with findLambdaEndToken).
* Enable testcases
2018-11-01 11:08:16 +01:00
rikardfalkeborn
88008fedb1
findLambdaEndToken handle explicit type ( #1458 )
...
* findLambdaEndToken: Add tests
* Add handling of explicit return in findLambdaEndToken()
* Use AST in findLambdaEndToken()
* Fix ast when lambda is mutable
2018-10-31 12:36:08 +01:00
Paul Fultz II
fafd0742d4
Fix FPs with return conditions ( #1455 )
...
* Fix 8815: FP with identical inner conditions
* Fix issue 8801: FP when not returning a bool
* Fix FP
* Add missing semicolon
* Move returnVar
2018-10-31 09:47:48 +01:00
amai
3032ac4619
Fix compile error in test code
2018-10-28 21:36:28 +01:00
Daniel Marjamäki
c03d32b429
ValueFlow: Improve containerSize handling of string like classes
2018-10-28 19:14:00 +01:00
Daniel Marjamäki
8beb42cc90
astyle formatting
...
[ci skip]
2018-10-28 17:37:19 +01:00
Paul Fultz II
2b6cc33dc6
Fix issue 8757: Throw syntax error on invalid code ( #1378 )
...
* Fix issue 8757: Throw syntax error on invalid code
* Fix FP with lambda returns
* Remove double percent
* Check more keywords
* Skip preprocessor directives
* Check for valid PP directive
* Fix preprocessor check
* Dont check for preprocessor directives
2018-10-28 17:17:53 +01:00
Paul Fultz II
f5811c6818
Fix issue 8732: Syntax error when using enable_if ( #1453 )
...
* Fix issue 8732: Syntax error when using enable_if
* Fix FPs
* Use simpleMatch
2018-10-28 17:16:31 +01:00
Daniel Marjamäki
06ede9c239
ValueFlow: handle x+=y for containers
2018-10-27 18:38:04 +02:00
orbitcowboy
b998dcb5aa
gnu.cfg: Added support for '__builtin_memset'.
2018-10-27 18:25:05 +02:00
IOBYTE
adbbadec7f
Fixed #8798 (template simplifier: wrong simpifications for namespaces) ( #1452 )
2018-10-26 14:20:13 +02:00
Daniel Marjamäki
ab08801dc4
Remove header tests from testconstructors, because they were invalid (using preprocessor directive)
...
The checker does not care if it's a header or source file. So I guess these tests were added to test
some parsing problem. Nowadays, #line is removed by simplecpp::preprocess, but there is no proper
testing for it in simplecpp.. I will add some testing for #line asap.
2018-10-26 07:03:15 +02:00
Kamil Dudka
d206047b84
Fixed #8794 - Memory leak false positive triggered by !(x != NULL) ( #1450 )
2018-10-26 06:21:45 +02:00
Daniel Marjamäki
b8e8b12783
Fixed #8797 (exprDependsOnThis handle method call in non-inline method)
2018-10-24 20:17:00 +02:00
Daniel Marjamäki
2348dcde6c
#8801 : Quick fix for false positives
2018-10-24 19:57:50 +02:00
IOBYTE
0763fdbfad
Copy template default argument values from forward declaration to declaration. ( #1447 )
...
It is possible to define default template parameter values in forward
declarations and not define any in the actual declaration. Cppcheck
ignores forward declarations and only uses the default values in the
actual declaration so default values in forward declarations are copied
to the actual declaration when necessary.
2018-10-24 14:38:59 +02:00
Daniel Marjamäki
15160f1691
Fixed #8788 (AST Broken error from assigning lambda to variable)
2018-10-22 17:25:01 +02:00
Daniel Marjamäki
dc38681a56
Remove FIXME in AST validation. Ticket #8749
2018-10-22 11:37:24 +02:00
Daniel Marjamäki
c483bcb12b
Fixed testrunner
2018-10-22 00:28:09 +02:00
Daniel Marjamäki
f9b132e831
Tokenizer::simplifyTypedef: Fix bug with arrays
2018-10-21 21:15:34 +02:00
Paul Fultz II
edde0eedaa
Fix FP issue 8801: Condition 'a+b' is always true ( #1444 )
2018-10-21 08:04:00 +02:00
Paul Fultz II
2989c44f59
Enable checking duplicate expressions across associative operators ( #1445 )
...
* Enable checking duplicate expressions across associative operators
* Remove bitshift operators and check for streamRead
2018-10-21 07:09:20 +02:00
Daniel Marjamäki
14afc3fd3a
Fixed #8796 (Tokenizer::simplifyCompoundAssignment: Wrong simplification of return)
2018-10-20 21:33:43 +02:00
Daniel Marjamäki
29feaa5a51
Tokenizer: Avoid constant folding
2018-10-20 10:51:50 +02:00
Daniel Marjamäki
d265a0d6ab
Fixed #8798 (SymbolDatabase: Inner unnamed union)
2018-10-20 09:43:08 +02:00
orbitcowboy
0858488825
insecureCmdLineArgs: Fixed FN in case strdup() copies argv[]. ( #1438 )
...
* insecureCmdLineArgs: Fixed FN in case strdup() copies argv[].
* Formatted the code. There are no functional changes intended.
* Changes due to review comments from Daniel.
2018-10-19 11:04:15 +02:00
rikardfalkeborn
402d0c565f
Fix false positive: Invalid string argument with array ( #1439 )
2018-10-19 07:48:47 +02:00
Paul Fultz II
40cb9cb1bc
Check conditions in return statements ( #1411 )
...
* Identify return conditions in multiconditions
* Improve error messages
* Check return statements are always true or false
* Add more tests for FPs
* Fix FP when returning const like variables
* Fix FP when returning pointers or classes
* Fix FP with member variable access
* Check non-local variables
* Use simplematch
* Check for null
2018-10-18 21:01:47 +02:00
Daniel Marjamäki
465db2dff7
Fixed #8786 (internalAstError on valid code with C style cast)
2018-10-18 20:17:23 +02:00
Daniel Marjamäki
4983a6a5dc
astyle formatting
2018-10-18 20:08:32 +02:00
Paul Fultz II
16c62281d0
Use followVar in checking duplicateBranch ( #1423 )
...
* Use isSameExpression for duplicate branches
* Add errorPath
* Add another test
2018-10-18 11:56:23 +02:00
Paul Fultz II
58d1de5814
Expand the duplicate variable assignment warnings when the inconclusive flag is used ( #1433 )
...
* Warn for more duplicate var expressions when inconclusive is set
* Fix issue with missing function name
2018-10-17 06:57:33 +02:00
Igor
0a9be3e734
Improve STL iterators checking ( #1380 )
...
* Improve STL interators checking
* Improve error messages for container iterators from different scopes
* Mini refactoring
* Replace hardcoded pattern to ValueType::Type::ITERATOR
* Error messages improvements, more tests and refactoring
* Refactoring after code review
* Put getting operand data into separate function
* Update getErrorMessages and iterator errors ids
* Refactoring
* Fix error
* Refactoring, early return implementation
* Delete redundant code
* Tiny changes in comments
2018-10-17 06:36:51 +02:00
Daniel Marjamäki
1245a036f7
Add check for shadow variables
2018-10-16 20:17:27 +02:00
rikardfalkeborn
f1074ea1ab
Fix false positive: Invalid string argument with pointer to pointer ( #1427 )
...
If the address is taken inside an array, the address is not of a single
character, so do not warn about this.
2018-10-16 06:54:25 +02:00
IOBYTE
290563b964
Fix specialized template regression. ( #1425 )
...
* Fix specialized template regression.
Only check for instantiation of template being processed rather than
count of all instantiations.
* Add 2 more tests.
2018-10-15 19:35:26 +02:00
orbitcowboy
a6e8270474
insecureCmdLineArgs: Fixed false negatives in case arguments are const. ( #1419 )
...
* insecureCmdLineArgs: Fixed false negatives in case arguments are const.
* Formatted the code, there are functional changes.
* Simplified matching as suggested by Daniel.
2018-10-15 10:05:43 +02:00
rikardfalkeborn
613dc19b68
#4241 : Check for address of single character passed as string ( #1381 )
...
* #4241 : Check for address of single character passed as string
Add a check that address of a single character is not passed as argument
to argument marked as strings (using strz). The check does not warn if
the address of a character with known value '\0'.
Since ValueFlow currently does not handle global constants (see #7597 ),
do not warn if the variable is global to avoid FPs when the address of
a global variable assigned to '\0' is passed to a function expecting a
string.
Remove comment in docs saying strz is unused.
* Change asdf to Hello world
* Add test of address to first element in string
* Add error reporting function to getErrorMessages
* Fix strings in test
2018-10-14 18:49:34 +02:00
IOBYTE
0a30768b59
Fixed #8693 (Template specialization: Constructor detected as normal … ( #1418 )
...
* Fixed #8693 (Template specialization: Constructor detected as normal function (functionStatic error))
Refactor template simplifier to remove the existing full specialization
function expandSpecialized and allow full specializations to use the
existing function expandTemplate. The function expandTemplate was
modified to either expand the template like it originally did by copying
it or to modify the template in place. Both instantiated and
uninstantiated full specializations are modified in place. This also
fixes #8692 and probably other related tickets as well.
The function simplifyTemplates now tries twice to simplify templates so
more templates can be simplified. We should try as many times as
necessary to find all possible templates. We can't do that now because
uninstantiated templates are left unchanged. It is relatively straight
forward to have the new code also expand in place uninstantiated
templates with their symbolic types but namespaces are not handled
properly (ticket #8671 ) and it would introduce regressions.
* Fix travis warnings.
2018-10-14 16:57:07 +02:00
Daniel Marjamäki
140b0b5ae9
astyle formatting
...
[ci skip]
2018-10-13 18:42:09 +02:00
Paul Fultz II
9cf092657c
Skip some ast errors to avoid regressions ( #1422 )
...
* Skip some ast errors to avoid regressions
* Use simpleMatch
* Skip operator functions
* Add a test for issue 8788
2018-10-13 18:38:44 +02:00
Daniel Marjamäki
7833ade128
Updated copyright year
2018-10-13 18:20:31 +02:00
Daniel Marjamäki
7eb5ebe17e
Fixed #7887 (User function 'search' is wrongly mixed with std function)
2018-10-10 17:35:53 +02:00
Daniel Marjamäki
c048bd45f6
Refactor test code
2018-10-10 14:35:58 +02:00
Daniel Marjamäki
25cbfe27cf
Partial fix for #7887 , Improved tokenizer simplification of 'using namespace std;' - do not simplify user functions
2018-10-10 14:28:53 +02:00
Daniel Marjamäki
053b0d1654
STL: enable inconclusive warnings with --inconclusive
2018-10-09 20:10:43 +02:00
rikardfalkeborn
75caf8e4de
Fix #8230 : FP unknown evaluation order on comma expression in while clause ( #1415 )
...
The while part of a do-while loop looks almost like a function call, so
extend the check for function calls to ignore while-statements.
Note that there was only an FP when checking c-code, since the check is
disabled for c++-code. Therefore, make sure the test cases are run on a
c-file.
2018-10-09 14:44:01 +02:00
Daniel Marjamäki
20121b34d8
Fixed #7718 (False positive: out of bounds of already resized std::string)
2018-10-09 06:53:26 +02:00
Daniel Marjamäki
aa58f41e6d
Fixed #7152 (False positive for redundantAssignment after calling a lambda function)
2018-10-08 21:07:21 +02:00
PKEuS
86a1b84b0c
Fixed handling of macros with known value defined in header file in configuration splitting ( #8404 )
...
Added proper unit test for configuration validation to ensure that it actually works when cppcheck is executed
2018-10-08 16:38:47 +02:00
Daniel Marjamäki
c3e6e7c338
Fixed #8664 (setVarId: Wrongly set varid for lambda argument)
2018-10-07 20:40:59 +02:00
Daniel Marjamäki
f961324d45
Fixed #8735 (FP oppositeInnerCondition - regression)
2018-10-07 18:30:29 +02:00
orbitcowboy
54c5d09ed3
test:std.cpp: Removed duplicate include <csetjmp>.
2018-10-06 00:23:14 +02:00
Paul Fultz II
e170a45230
Enable followVar for opposite expressions ( #1404 )
...
Enable followVar for opposite expressions
2018-10-04 21:17:47 +02:00
Daniel Marjamäki
a31db92918
Fixed #8669 (operator>> causes wrong style message)
2018-10-03 13:00:11 +02:00
Paul Fultz II
1fe1ec09a8
Reenable follow var for logical conjunction ( #1400 )
2018-10-01 14:40:03 +02:00
Paul Fultz II
2c91b95d2a
Reenable followVar for multicondition ( #1401 )
2018-10-01 14:34:55 +02:00
Paul Fultz II
4598995564
Enable followVar for duplicate ternary expressions ( #1406 )
2018-10-01 14:31:06 +02:00
rikardfalkeborn
b3fef7957a
Fix FP with fclose after comma ( #7525 ) ( #1407 )
2018-10-01 11:58:27 +02:00
Paul Fultz II
4ed22f1ff8
Fix some FPs in mismatchingContainerExpression ( #1402 )
2018-09-30 14:49:58 +02:00
amai
5c0fd0d5b4
Skip some test on cygwin since interface is not available
2018-09-29 16:49:12 +02:00
Paul Fultz II
f65cf220ba
Fix false positives in unknownEvaluationOrder when using followVar ( #1391 )
...
Fix false positives in unknownEvaluationOrder when using followVar
2018-09-28 08:38:24 +02:00
Daniel Marjamäki
9dccc4037b
Fixed #8747 (Syntax error, AST broken (a = --*b))
2018-09-27 19:26:08 +02:00
IOBYTE
33b74a04ab
Add union support to template simplifier. ( #1398 )
2018-09-26 06:23:12 +02:00
orbitcowboy
2bbe73e04a
Fixed compiler warning from VS2017: testsuppressions.cpp(450): warning C4458: declaration of 'errmsg' hides class member. ( #1397 )
2018-09-25 17:19:25 +02:00
orbitcowboy
879803c90f
gnu.cfg: Fixed FP (nullpointer) when third parameter of epoll_ctl is set to NULL.
2018-09-25 09:07:49 +02:00
rikardfalkeborn
5e120b567c
isVariableDeclaration: Handle pointer to const pointer ( #1395 )
...
isVariableDeclaration did not handle pointer to const pointer, or
pointer to volatile pointer. This resulted in FPs in examples like the
following:
class Fred {
public:
const char *const *data;
const char *const *getData() { return data; };
}
where cppcheck would say getData could be static, since it didn't
recognize const char *const *data as a variable declaration.
2018-09-25 06:19:26 +02:00
orbitcowboy
2f032d8fa7
Improved const correctness of local variables. ( #1396 )
...
* Improved const correctness of local variables.
* Running astyle [ci-skip].
* Removed duplicate 'const'-keyword.
2018-09-24 15:08:16 +02:00
Paul Fultz II
5bebeec224
Fix issue 8775: Dont follow aliased variables ( #1390 )
2018-09-24 06:37:47 +02:00
Daniel Marjamäki
afe09f4d7a
Temporarily comment out the followVariable() handling
2018-09-23 16:03:18 +02:00
Simon Martin
6bde2445a6
Ticket #8632 : Parenthesize ternary operator operands containing < to avoid wrongly thinking a template instantiation is met. ( #1389 )
2018-09-23 10:27:38 +02:00
Simon Martin
915acac0b8
Ticket #8734 : Skip static member variables in CheckUninitVar. ( #1388 )
2018-09-22 16:52:34 +02:00
Paul Fultz II
d43cd56afd
Show line number when suggesting std::transform ( #1385 )
2018-09-21 10:38:30 +02:00
orbitcowboy
a26ac4d266
Running astyle. There is no functional change intended.
2018-09-21 08:53:09 +02:00
Paul Fultz II
1e347f6cde
Initial check for recommending algorithms ( #1352 )
...
Add initial check for loop algorithms
2018-09-19 18:58:59 +02:00
shikamu
83cb0b3394
--suppress on line 0 ( #1354 )
...
Fixed --suppress on line 0
2018-09-18 12:58:14 +02:00
IOBYTE
e9a44f70b2
Remove out of line member functions of instantiated template classes. ( #1377 )
...
* Remove out of line member functions of instantiated template classes.
2018-09-14 14:16:34 +02:00
Paul Fultz II
4e7ed9ea6e
More robust checking for crashes in followVar ( #1375 )
...
More robust checking for crashes in followVar
2018-09-13 09:19:15 +02:00
Paul Fultz II
eb07280075
Fix issue 8743: FP when derefencing iterators ( #1376 )
2018-09-12 17:33:53 +02:00
Paul Fultz II
90a29d986b
Fix issue 8730: Dont follow variables with unknown symbols ( #1374 )
2018-09-12 17:30:18 +02:00
orbitcowboy
399a90c00e
#8383 : Segmentation fault on garbage code. Added regression test.
2018-09-10 16:28:32 +02:00
orbitcowboy
95da9f77c4
#8385 : Segmentation fault on garbage code. Added regression test.
2018-09-10 16:24:09 +02:00
orbitcowboy
bc84ce43ec
#8265 : Segmentation fault on garbage code. Added regression test.
2018-09-10 16:17:44 +02:00
amai2012
4b249877f1
#8709 Add stability regression test
2018-09-10 08:40:53 +02:00
Daniel Marjamäki
523a9c1c4a
Fixed #8746 (Syntax error, AST broken (using a::operator=))
2018-09-09 21:11:45 +02:00
Daniel Marjamäki
404eb6c746
Fixed #8745 (Syntax error: AST broken (or))
2018-09-09 16:41:06 +02:00
Daniel Marjamäki
772939476d
Remove inconclusive warnings about reading empty stl container. We have better ValueFlow-based checking.
2018-09-09 11:25:04 +02:00
Daniel Marjamäki
b3f12fcc7e
astyle formatting
...
[ci skip]
2018-09-09 07:10:37 +02:00
Paul Fultz II
f4f3f81e8f
Fix issue 8741: Require pure when following variables in isSameExpression ( #1373 )
2018-09-09 07:08:32 +02:00
Paul Fultz II
fa40b821e6
Fix issue 8740: Add a pass to check for valid operators ( #1372 )
2018-09-08 21:10:34 +02:00
Daniel Marjamäki
509cb35168
astyle formatting
...
[ci skip]
2018-09-08 15:19:32 +02:00
tam do thanh
7ad09b44c3
Ticket 7792: Suppression both exit_code and syntaxError when call cppcheck suppressions ( #1345 )
2018-09-08 11:09:49 +02:00
Daniel Marjamäki
d7de46f50e
ValueFlow: Fix false positive for container size
2018-09-08 10:43:08 +02:00
Daniel Marjamäki
738fb1b23a
Disabled CheckClass::checkCopyCtorAndEqOperator because of FP ( #8388 )
2018-09-08 09:14:02 +02:00
Paul Fultz II
cb03b9883f
Fix issue 8737: FP with identical inner condition due to followVar ( #1371 )
2018-09-07 20:16:38 +02:00
Paul Fultz II
5a2362b2a0
Fix issue 8738: Dont warn about multiconditions when value is known ( #1369 )
2018-09-07 15:02:34 +02:00
Paul Fultz II
f7e7e9bd3c
Fix issue 8736: Iterators to containers from different expressions (a.begin().x == b.begin().x) ( #1370 )
2018-09-07 07:08:02 +02:00
Paul Fultz II
2da958efb5
Fix issue 8722: Avoid duplicate messages due for followVar ( #1367 )
2018-09-06 06:55:36 +02:00
Paul Fultz II
b46e25c18e
Fix issue 8730: False positive: Opposite expression on both sides of && ( #1366 )
2018-09-05 18:07:01 +02:00
Simon Martin
1d85a78874
Ticket #8654 : Properly setup links for variadic template bases. ( #1357 )
2018-09-05 14:10:56 +02:00
Paul Fultz II
08f301a0de
Reenable followVar ( #1363 )
...
Reenable followVar
2018-09-05 05:53:33 +02:00
Daniel Marjamäki
c6d43506b6
ValueFlow: Fix FP in switch
2018-09-04 20:28:48 +02:00
Daniel Marjamäki
3a8bdad20a
Fixed #8232 (segmentation fault on valid C++ code in isOppositeCond())
2018-09-04 18:10:31 +02:00
orbitcowboy
361ae311f6
cmdlineparser: Stop processing in case an invalid path for --includes-file=<PATH> and --config-excludes-file=<PATH> is provided.
2018-09-04 16:37:43 +02:00
Daniel Marjamäki
5afb755a3c
SymbolDatabase: Fix variable matching
2018-09-04 06:39:02 +02:00
Paul Fultz II
93be440f92
Fix issue 8709: crash with switch statement with followVar ( #1362 )
...
* Fix crash with switch statement
* Update comment
2018-09-03 19:54:14 +02:00
Paul Fultz II
0e5fabf4dc
Dont follow volatile variables ( #1365 )
2018-09-03 19:51:48 +02:00
Daniel Marjamäki
756c1d8de7
Fixed #8341 (error:iterators not correct)
2018-09-02 21:04:45 +02:00
IOBYTE
7224ee27d9
Fixed #8122 (simplifyTemplates: constructor outside template class not simplified properly) ( #1361 )
2018-09-02 17:49:13 +02:00
Daniel Marjamäki
cc402869a6
Fixed #8689 (False positive: containerOutOfBounds after function call)
2018-09-02 14:08:34 +02:00
IOBYTE
341dee4a07
Fixed #8725 (Template out of line function return type missing when instantiated.) ( #1360 )
2018-09-02 08:35:05 +02:00
Paul Fultz II
8353f94b93
Fix crashes in followVarExpression ( #1358 )
...
* Fix crashes in followVarExpression
* Add a regression test for issue 8717
* Skip reference declarations
2018-09-02 08:28:53 +02:00
IOBYTE
508e8c234b
Fixed #8683 (Using deleted token with multiple template instantiations.) ( #1353 )
...
* Fixed #8683 (Using deleted token with multiple template instantiations.)
* Fixed #8321 (heap use after free: templatesimplifier)
* Add a flag to Token indicating that it has a pointer to it.
* Run dmake
* Fix one source of list pointers to deleted tokens.
Refactor TemplateSimplifier class to get access to template lists.
Remove many function parameters now that they are class variables.
Fix one source of list pointers to deleted tokens.
Add tests with no output to catch crashes.
* Run dmake again.
* Make 2 more functions private.
* Make requested changes.
* Missed one change request.
* Use TokenList rather than Tokenizer.
* Move TokenAndName constructor to cpp file so token.h is not needed in header file.
2018-09-01 11:26:10 +02:00
Daniel Marjamäki
a331206b44
Temporarily disable followVariableExpressions(), there are problems that should be fixed.
2018-09-01 08:32:06 +02:00
Daniel Marjamäki
f388c77042
Fixed #8721 (Regression: False positive array index out of bounds)
2018-08-31 18:25:43 +02:00
Daniel Marjamäki
7591616f43
Fixed #8710 (Update message duplicateExpression when operand is integer literal)
2018-08-30 18:28:34 +02:00
Daniel Marjamäki
27aae8d032
Fixed #8644 (crash (CheckBufferOverrun::checkGlobalAndLocalVariable): local function)
2018-08-30 10:04:07 +02:00
Daniel Marjamäki
6223204a06
Fixed #8708 (FP: Accessing an item in container that is empty)
2018-08-27 13:49:47 +02:00
Paul Fultz II
fc135e1087
Check if member function modifies the variable ( #1350 )
...
* Check if member function modifies the variable
* Check for const pointer
* Add test for const condition
* Add more null checking
* Add todo assert for FN
2018-08-27 11:09:09 +02:00
Simon Martin
acb0b9f07e
Ticket #8679 : Add support for C++11 thread_local and GCC's (among others) __thread extension. ( #1351 )
2018-08-26 19:46:36 +02:00
Paul Fultz II
a5f4c5d0eb
Improve message for same expressions ( #1349 )
...
* Improve message for same expressions
* Update message
2018-08-25 14:25:31 +02:00
Paul Fultz II
f79849f6ba
Diagnose mismatching iterators used together in operators ( #1343 )
...
* Diagnose mismatching iterators used together in operators
* Fix fp getting iterator expression in function call
2018-08-21 06:34:30 +02:00
Daniel Marjamäki
866d198756
Fixed #8697 (noreturn output stream)
2018-08-21 06:32:33 +02:00
Daniel Marjamäki
4d78a2e178
Fixed #7790 (Wrong order of <location> XML-elements for error duplInheritedMember)
2018-08-19 14:13:58 +02:00
Daniel Marjamäki
43233e72b2
Fixed #8691 (False negative for uselessAssignmentArg)
2018-08-17 19:56:36 +02:00
Kevin Kendzia
c5ebf26f9f
cppcheck.cpp: fix suppression of syntaxError ( #1333 )
...
* cppcheck.cpp: fix suppression of syntaxError
* test: add supression test for syntaxError while file read
2018-08-17 10:05:25 +02:00
Sylvain Joubert
13617375df
missingOverride: False positive with cv-ref mismatch ( #1340 )
2018-08-17 08:42:22 +02:00
Sebastian
78715d3eff
bsd.cfg: Add arc4random* functions with tests. ( #1344 )
...
Reference: https://www.freebsd.org/cgi/man.cgi?query=arc4random
2018-08-16 21:37:40 +02:00
tam do thanh
f33c09f1a7
Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" ( #1334 )
...
* Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" for some old libraries
https://trac.cppcheck.net/ticket/7792
* Unnecessary check of "tokOffset", match-function already checks if it is null
* add testcase ticket #7792 : simplifyTypedef124
2018-08-16 14:30:28 +02:00
Daniel Marjamäki
fc97a5b11c
Uninitalized variables: Fixed false positive
2018-08-15 18:04:36 +02:00
Daniel Marjamäki
2f834c3c3b
Fixed #8688 (False positive: containerOutOfBounds)
2018-08-13 21:27:29 +02:00
Paul Fultz II
c5154286da
Fix issue 8687: false positive with same expression ( #1336 )
2018-08-13 12:55:41 +02:00
Daniel Marjamäki
55ab842083
valueFlowSizeForward: Bailout when function calls modify the container size
2018-08-13 06:54:18 +02:00
Daniel Marjamäki
183345a939
valueFlowContainerSize: Fix FP when container size is changed
2018-08-12 22:23:19 +02:00
Daniel Marjamäki
7074eeb869
valueFlowContainerSize: assignment of string-like containers
2018-08-12 22:01:58 +02:00
Daniel Marjamäki
189ea5003a
valueFlowContainerSize: empty container variables
2018-08-12 14:41:00 +02:00
Daniel Marjamäki
be4ae66e36
Fix wrong message
2018-08-12 08:01:15 +02:00
Daniel Marjamäki
0e30bdef9d
containerAccessOutOfBounds: Fix FPs for maps etc
2018-08-11 18:57:21 +02:00
Daniel Marjamäki
811a71aa06
valueFlowContainerSize: Handle guard logic
2018-08-11 15:08:54 +02:00
Daniel Marjamäki
6008bbdfb4
valueFlowContainerSize: Fix wrong value after condition if conditional code escapes
2018-08-11 13:49:42 +02:00
Daniel Marjamäki
1f427eda8f
CheckStl: rewrite and refactor out of bounds checker
2018-08-11 11:40:48 +02:00
Daniel Marjamäki
10461e5429
valueFlowContainerSize: forward analysis inside conditional code
2018-08-10 22:18:38 +02:00
Daniel Marjamäki
4a502a7f6b
valueFlowContainerSize: add simple forward analysis
2018-08-10 22:06:23 +02:00
Daniel Marjamäki
2b10e38eec
valueFlowContainerSize: handling of 'v.size() == 10'
2018-08-10 21:43:47 +02:00
Paul Fultz II
3947c23290
Fix issue 8369: False negative: Condition 'condition' is always true ( #1325 )
...
* Fix issue 8369: False negative: Condition 'condition' is always true
* Use simpleMatch
* Add iterator header
* Cleanup
* Remove unused variable
2018-08-10 18:05:23 +02:00
Daniel Marjamäki
907f81d059
ValueFlow: Improved analysis of container size
2018-08-10 11:53:56 +02:00
Daniel Marjamäki
81f54f7094
Fixed #8681 (ValueFlow: Container size)
2018-08-10 11:29:16 +02:00
Daniel Marjamäki
f2e7071922
Fix FP, conversion of char literal '\0' to boolean is not true
2018-08-08 19:04:10 +02:00
Daniel Marjamäki
1f1c44a04f
Fixed #8677 (False positive: unused method)
2018-08-08 11:31:35 +02:00
Paul Fultz II
80290a15e0
Fix FP with duplicate assign ( #1330 )
2018-08-08 08:31:31 +02:00
Daniel Marjamäki
c3a44ce56b
astyle formatting
...
[ci skip]
2018-08-07 18:06:51 +02:00
Daniel Marjamäki
78df7f98dd
Fixed #8674 (False positive: Method that returns const should not be const)
2018-08-07 18:06:14 +02:00
Paul Fultz II
f603b529df
Fix issue 8413: Condition is always false 'i=expr; if (i != expr) {}' ( #1295 )
...
* Follow variables when comparing same expression
* Remove assert include
* Dont follow function arguments
* Improve the checking to check more cases
* Add more tests
* Check if the variable is used inside a loop
* Follow both variables
* Only skip loops when variable is modified in scope
* Fix FP when followed variable is modified
* Dont follow arrays
* Skip pointer indirection
* Make recursive
* Improve checking more variables
* Fix test with sizeof
* Skip following operators
* Fix test when using sizeof
* Dont check every step
* Use early returns
* Update test to use a loop instead of conditional
* Add static
* Check variables are global
* Check local variables in another scope
* Fix issue with const pointers
* Distinguish between pointer indirection and multiply
* Use simple match
* Prevent crash with uniform initialization
* Use unary op and ast to detect pointer indirection
* Expand error message when expression do not match exactly
* Add errorpath to issameexpression
* Revert "Clarify warning message for 'Same expression on both sides of operator'"
This reverts commit 0e491b41a8
.
* Check if the tokens are the same
* Report the operator and not the expressions
2018-08-07 09:32:16 +02:00
Daniel Marjamäki
1b933f4dd1
astyle formatting
...
[ci skip]
2018-08-05 22:40:21 +02:00
Paul Fultz II
b839ad60dd
Fix issue 6856: add checks in isOppositeCond when using == and < or > ( #1298 )
...
* Fix issue 6856: add checks in isOppositeCond when using == and < or >
* Move tests to testcondition
* Fix some more tests
* Fix test messages
* Remove the float check
2018-08-05 22:39:40 +02:00
Daniel Marjamäki
d8997bb43f
Fix testrunner
2018-08-05 14:01:24 +02:00
Daniel Marjamäki
0e491b41a8
Clarify warning message for 'Same expression on both sides of operator'
2018-08-05 10:48:02 +02:00
Paul Fultz II
ed197f235a
Fix issue 4693: Diagnostic when using the same iterators to an algorithm ( #1326 )
...
* Fix issue 4693: Diagnostic when using the same iterators to an algorithm
* Update classinfo
2018-08-05 09:10:54 +02:00
rikardfalkeborn
710d7ce015
Add checks of log2 and log1p range ( #1324 )
...
* Add tests for log10{,f,l} valid arguments
* Add log2{,f,l} to checkfunctions
* Add log1p{,f,l} to checkfunctions
* checkfunctions: Simplify check for log function limit out of range
The conditions for negative and non-negative int and float were
identical so the call to isNegative can be removed and the if-statements
be simplified.
2018-08-03 12:14:39 +02:00
Paul Fultz II
0d35a96594
Improve checking of mismatch iterators ( #1293 )
2018-07-26 22:00:48 +02:00
Daniel Marjamäki
54e2726bf3
Fixed #8636 (Misleading verbose message if virtual method called from destructor)
2018-07-26 09:16:17 +02:00
Daniel Marjamäki
fc5d8e5082
TestSuite: Allow that verbose messages are reported in a test
2018-07-26 09:15:33 +02:00
Daniel Marjamäki
c666f74755
astyle formatting
...
[ci skip]
2018-07-25 23:02:16 +02:00
Paul Fultz II
f093692551
ValueFlow: Set values in else branch even when the first branch modifies the value ( #1309 )
...
* Set values in else branch even when the first branch modifies the value
* Move tests
* Add check for goto
* Remvoe todo
* Also check scope is noreturn
* Use isEscapeScope when variables are changed
2018-07-25 22:59:54 +02:00
Daniel Marjamäki
f9a5a114bb
astyle formatting
...
[ci skip]
2018-07-25 07:44:06 +02:00
Paul Fultz II
9895ea5ff2
Fix issue 470: Condition is always true or false on logical operators ( #1294 )
...
* Fix issue 470: Condition is always true or false on logical operators
* Dont warn on literals
* Compute logical operators using valueflow
* Fix FP when using literals
* Always warn on subconditions that are always true
* Use percent matches first
* Add test for logical operators
* Check if parent is null
2018-07-23 08:51:59 +02:00
lordylike
12e58c8521
fix ticket 8570: passedByValue with member initializer list and std::move ( #1316 )
...
* fix ticket 8570
allow member initializer list variables that are moved to be non-const
* review feedback
* replace tabs with spaces in test code
2018-07-22 15:01:18 +02:00
Daniel Marjamäki
77b653bf94
Clarify warnings when char literals are converted to bool in conditions
2018-07-21 18:40:06 +02:00
Sebastian
f862cf603f
posix.cfg: Add some pthread_mutex_* functions. ( #1320 )
...
References:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html
2018-07-21 17:52:12 +02:00
rikardfalkeborn
30a8d953e3
Move sqrt{,f,l} argument checks to cfg file ( #1313 )
2018-07-20 20:56:39 +02:00
Sebastian
4ef452132c
posix.cfg,gnu.cfg: Add (get|set)hostname functions. ( #1315 )
...
Reference for POSIX gethostname:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html
Reference for sethostname:
http://man7.org/linux/man-pages/man2/gethostname.2.html
2018-07-18 09:40:06 +02:00
Daniel Marjamäki
7c4820e047
Rename Library::isargvalid()
2018-07-15 23:05:48 +02:00
rikardfalkeborn
491ee577c6
Support floats in valid config ( #1297 )
...
* Add tests for invalid ranges
* Refactor loadLibErrors
This reduces the amount of code slightly and will simplify adding
more tests.
* Handle empty valid field
Before this change, the sequence <valid></valid> in a config file would
result in a segmentation fault. Now an empty field results in the error
message:
cppcheck: Failed to load library configuration file 'mycfg.cfg'. Bad attribute value '""'
* Add support for valid for floating point arguments
Previously, it was not possible to add valid ranges to floating point
arguments since it only handled integers. This made ranges not work well
for floating point arguments since arguments were cast to integers
before the ranges were handled.
Fix this by using doubles instead of integers if the argument is a float.
Add some tests for this and make sure errors are printed with enough
precision (somewhat arbitrarily chosen).
Note that it is still only possible to add integer ranges (i.e. -1:1).
* Add support for floats in configuration valid range
Now that it is possible to handle decimal arguments, there is no reason
to not allow non-integer ranges. Take care to not allow broken
configurations.
* Move check to within if-clause
* Move asin{,f,l} and acos{,f,l} input checks to config file
2018-07-15 22:47:56 +02:00
rikardfalkeborn
0e639ea7c9
runtest.sh: Bugfix cfg dir when run in test/cfg ( #1311 )
...
Commit 5cc8da2db4
introduced syntax checking of xml-files. This broke
running the file directly in the test/cfg folder since it assumed the
config files to check were located in cfg in the current working
directory. Fix this by adding a variable that holds the correct path.
2018-07-15 22:24:31 +02:00
Paul Fultz II
5d1fdf7958
Fix issue 7904: Handle double nots in isSameExpression ( #1305 )
...
* Fix issue 7904: Handle double nots in isSameExpression
* Skip checking double nots in assignments
* Use ast to check for double not
2018-07-15 11:30:02 +02:00
Paul Fultz II
42f075c3fa
Skip literals for always true/false ( #1304 )
2018-07-12 23:06:47 +02:00
Sebastian
5cc8da2db4
cfg/runtests.sh: Check syntax of defines in configuration files. ( #1303 )
...
travis: Add xmlstarlet package used by cfg/runtests.sh
2018-07-12 08:40:26 +02:00
Daniel Marjamäki
b398398dec
Fixed #8360 (false positive "Ineffective call of function 'empty()'")
2018-07-10 22:58:02 +02:00
Daniel Marjamäki
7e2858f158
astyle formatting
...
[ci skip]
2018-07-10 22:56:18 +02:00
Daniel Marjamäki
03faa25d12
Conditions: Better handling of function calls
2018-07-08 15:58:04 +02:00
amai2012
c2f0828a61
#6645 false negative: condition is always false. Add a regression test
2018-07-03 08:25:37 +02:00
Daniel Marjamäki
24dd4c9c26
Restore code in checkVariableScope. Fixes false negative
2018-07-01 22:31:45 +02:00
Daniel Marjamäki
60ac463a79
CheckClass: Restore a few warnings about member initialization of classes
2018-06-29 22:54:12 +02:00
Alexander Mai
320a957bbc
Extend TestSymbolDatabase::findFunction19 to outline different results depending whether char is signed or unsigned on compile time
2018-06-28 22:16:18 +02:00
Daniel Marjamäki
61c56eda44
Tweak the CheckClass::constructors() check
2018-06-27 14:02:57 +02:00
Daniel Marjamäki
10e693a8c3
Revert "SymbolDatabase: Improved lookup of function calls"
...
This reverts commit 3c87d60d5d
.
2018-06-26 23:14:12 +02:00
Daniel Marjamäki
3c87d60d5d
SymbolDatabase: Improved lookup of function calls
2018-06-26 22:12:12 +02:00
Daniel Marjamäki
c583fb9186
Revert "SymbolDatabase: Improved lookup of function calls"
...
This reverts commit e4a70f87e6
.
2018-06-26 13:05:33 +02:00
Daniel Marjamäki
e4a70f87e6
SymbolDatabase: Improved lookup of function calls
2018-06-26 11:38:45 +02:00
Daniel Marjamäki
33493883b2
TestSymbolDatabase: Remove unused variable
2018-06-24 17:13:27 +02:00
Daniel Marjamäki
ea6a9c965d
TestSymbolDatabase: Code cleanup
2018-06-24 17:06:51 +02:00
Daniel Marjamäki
cde63c7573
Use Variable::valueType instead of Variable::typeStartToken in auto variables
2018-06-24 08:25:19 +02:00
Daniel Marjamäki
655a8b21b6
Fix false positive 'passedByValue' when address of argument is used
2018-06-23 23:25:06 +02:00
Daniel Marjamäki
2a8296879c
CheckOther: Use Variable::valueType() instead of Variable::typeStartToken
2018-06-23 16:42:36 +02:00
Daniel Marjamäki
d0614b9b36
varScope: Fix false negatives for references
2018-06-22 22:51:03 +02:00
Daniel Marjamäki
10fc070f44
SymbolDatabase: Better handling of type aliases in ValueType
2018-06-20 14:49:55 +02:00
Daniel Marjamäki
b4cb2505c3
SymbolDatabase: Add Variable::valueType(). First step to reuse ValueType handling in Variable
2018-06-20 10:00:15 +02:00
Daniel Marjamäki
610b26bfbc
Rename private member _platform_types
2018-06-17 16:58:28 +02:00
Daniel Marjamäki
074177fc6e
Rename private member variables
2018-06-17 16:55:02 +02:00
Daniel Marjamäki
e08859e329
Fix testrunner compiling
2018-06-16 22:28:14 +02:00
Daniel Marjamäki
76280fe847
Fix testrunner
2018-06-16 21:36:30 +02:00
Daniel Marjamäki
593f7eee38
Fixed #8624 (Crash below CheckOther::checkDuplicateExpression)
2018-06-14 22:39:26 +02:00
Daniel Marjamäki
45379a3aa6
Updated copyright year for modified files
...
[ci skip]
2018-06-10 22:07:21 +02:00
Paul Fultz II
daacf27c2e
Fix false positive from issue 8612 ( #1285 )
2018-06-10 00:05:23 +02:00
Daniel Marjamäki
03b2e0eee7
inline suppressions: treat arithmetic operators as start-of-comment
2018-06-09 22:50:51 +02:00
Paul Fultz II
8d53bcfd63
Fix FP when using non-const members and also check return type of function ( #1283 )
2018-06-09 08:05:19 +02:00
orbitcowboy
d10788164a
windows.cfg: Added support for _locale_t
2018-06-08 14:41:56 +02:00
orbitcowboy
c56033f998
test/windows.cfg: Fixed wrong test case.
2018-06-08 14:33:37 +02:00
Daniel Marjamäki
84f0a18053
passedByReference: avoid false positives for std::pair
2018-06-08 10:19:02 +02:00
Daniel Marjamäki
44c78d1770
passedByReference: avoid false positives for std::function
2018-06-08 08:40:14 +02:00
Daniel Marjamäki
de09c117bf
Fixed #8618 (False positive: shared_ptr is passed by reference by intention)
2018-06-07 22:39:21 +02:00
Daniel Marjamäki
1abc9008d8
Fixed #8573 (FP noCopyConstructor - derive from noncopyable class)
2018-06-06 16:02:25 +02:00
Daniel Marjamäki
b9c1308a81
Fixed #8575 (false positive: longCastAssign)
2018-06-04 22:51:21 +02:00
orbitcowboy
74b18d7fd9
windows.cfg: Added support for _strncpy_s_l().
2018-06-04 16:58:09 +02:00
Daniel Marjamäki
7b106c067a
Fixed #8603 (SymbolDatabase: 2 scopes with same function)
2018-06-03 23:14:24 +02:00
orbitcowboy
55ff7c0823
test std.cfg: Updated tests for strncpy_s().
2018-05-31 11:23:54 +02:00
Daniel Marjamäki
ccbfd623d5
astyle formatting
...
[ci skip]
2018-05-31 07:02:08 +02:00
amai2012
8d55d361ae
#8602 Template default parameter without name yields syntax error
2018-05-30 17:09:31 +02:00
orbitcowboy
c7993c38b5
bsd.cfg: Added support for strlcat().
2018-05-30 16:47:00 +02:00
orbitcowboy
d412c3908f
test std.cfg: Fixed introduced regression.
2018-05-30 16:30:00 +02:00
orbitcowboy
39feb150c0
std.cfg and windows.cfg: Added support for wcscat_s() and _tcscat_s().
2018-05-30 16:25:09 +02:00
orbitcowboy
ef82477d11
std.cfg: Do not take the return value of std::locale::global() into account.
2018-05-30 16:04:40 +02:00
IOBYTE
7681bbf227
Fixed #8146 (false positive: enum initialized using class member initializer syntax in struct in struct) ( #1270 )
2018-05-30 15:40:16 +02:00
orbitcowboy
d06eb3eb8f
std.cfg: Added support for strcat_s() (since C11).
2018-05-30 14:30:26 +02:00
IOBYTE
3982c81394
Add support for C++ attribute nodiscard for functions. ( #1269 )
2018-05-29 21:43:56 +02:00
Daniel Marjamäki
7d4a80fbd2
astyle formatting
...
[ci skip]
2018-05-29 16:30:33 +02:00
orbitcowboy
976e9e2544
Cleared -Wshadow warnings.
2018-05-29 11:54:07 +02:00
orbitcowboy
53c53db312
windows.cfg: Added support for _mbscat_s().
2018-05-28 21:52:44 +02:00
orbitcowboy
75e28e46c5
windows.cfg: Added support for _mbscat().
2018-05-28 10:08:11 +02:00
IOBYTE
36f7585798
Fixed #8600 (false-positive/regression: confusion between copy constructors of internal classes and lack of explicit keyword) ( #1266 )
2018-05-27 10:53:34 +02:00
orbitcowboy
5b6e6db376
test std.cfg: Added more test cases for strcat() functions.
2018-05-27 10:16:02 +02:00
orbitcowboy
3407f3e932
windows.cfg: Added test cases for CreateThread().
2018-05-25 11:50:12 +02:00
orbitcowboy
d7c8c46c10
test std.cfg: Improved testing for strcat() and wcscat().
2018-05-25 08:36:47 +02:00
rebnridgway
42a65c5160
Fix crash bug #8579 ( #1238 )
...
* Added declaration for deletePrevious function
* Added definition for deletePrevious function
* Fixed crash from deleteThis invalidating pointers
The crash was caused by deleteThis() invalidating the pointer to a constant variable usage. This happened when a usage followed an assignment. This fixes bug #8579 .
* Added tokensFront to match tokensBack
This means deletePrevious can set the list's front if necessary.
* Initialised tokensFront in appropriate places
* Switched to using default Token constructor
* Switched to using Token default constructor
* Switched to using default constructor for Token
* Added missing argument to Token constructor
* Changed to use default constructor for Tokens
* Switched to using default constructor for Tokens
* Switched to using default constructor for Token
* Added new test for deleting front Token
Also made sure to use the correct constructor for Token in other tests.
* Syntax error
* Replaced tokensFront and tokensBack with a struct
This decreases the size of the Token class for performance purposes.
* Replaced tokensFront and tokensBack with a struct
* Added tokensFrontBack to destructor
* Reworked to use TokensBackFront struct
Also ran astyle.
* Reworked to use TokenList's TokensFrontBack member
* Reworked to use TokensFrontBack struct
* Reworked to use TokensFrontBack struct
* Reworked to work with TokensFrontBack struct
* Removed unnecessary scope operator
* Added missing parentheses
* Fixed syntax error
* Removed unnecessary constructor
* Default constructor now 0-initialises everything
This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.
* Fixed unsafe null check
* Added missing explicit keyword
* Fixing stylistic nits
Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.
* Fixing stylistic nits
Removed default constructor and replaced it with a single-argument constructor with a default value.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
Sebastian
8b94bfaf0a
windows.cfg: Add macros SUCCEEDED() and FAILED(). ( #1264 )
...
Somehow the opposite inner condition is not detected when macros are used. I created this ticket: https://trac.cppcheck.net/ticket/8596
2018-05-24 14:52:32 +02:00
orbitcowboy
3311307227
windows.cfg: Added test cases for toupper/tolower functions.
2018-05-24 10:05:56 +02:00
IOBYTE
fc1d62fd45
Fixed #7406 (Tokenizer::simplifyTypedef: array typedef used as template parameter) ( #1257 )
2018-05-22 17:31:58 +02:00
umanamente
a3b02d6ece
Fixed #8262 : false positive memleak (`shared_ptr` in function argument) ( #1249 )
...
* Fixed #8262 .
checkleakautovar.cpp:
* added `isFunctionCall` (supports template functions)
* smart pointer check in `functionCall`
* updated test case
* Renamed "bracket" to "parenthesis"
* (#8262 ) Fixed broken test
* (#8262 ) Code review comments
* (#8262 ) Renamed `tokOpeningBr` to `tokOpeningPar`
2018-05-22 09:08:23 +02:00
IOBYTE
8320be203d
Fixed #8258 (Incorrect diagnostics when using delegating consturctor with default values) ( #1255 )
2018-05-22 06:42:37 +02:00
IOBYTE
5c15cd3981
Fix DACA2 SymbolDatabase bailout; unhandled code for final class ( #1253 )
...
* Fix DACA2 SymbolDatabase bailout; unhandled code for final class
* Replace Match with simpleMatch
2018-05-21 21:23:21 +02:00
Paul Fultz II
406aa6cf1c
Improve support of using a lambda as a deleter ( #1246 )
...
* Improve support of using a lambda as a deleter
* Use simple match
2018-05-21 08:22:18 +02:00
IOBYTE
42ed5a6b98
Fixed #8581 (Delegating contructor warns for unintialized variables) ( #1250 )
...
* Fixed #8581 (Delegating contructor warns for unintialized variables)
* Replace Token::Match with isStandardType
2018-05-20 22:58:05 +02:00
Sebastian
aa3722feea
windows.cfg: Add lstrlen() configuration and tests. ( #1239 )
...
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms647492(v=vs.85).aspx
2018-05-17 15:43:01 +02:00
orbitcowboy
3ad8fa5288
windows.cfg: Improved support for more types.
2018-05-16 16:26:40 +02:00
IOBYTE
d567b878ba
Fix template instantialion failure for qualified template type. ( #1237 )
2018-05-16 15:24:23 +02:00
orbitcowboy
4e38627a3d
windows.cfg: Improved support for Windows types (ref. https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx ).
2018-05-16 09:16:12 +02:00
Daniel Marjamäki
21ab5c7591
Removed the generated cfg tests, these are not used.
2018-05-16 07:09:08 +02:00
IOBYTE
ce50df8047
Fix override warnings. ( #1234 )
2018-05-15 16:37:40 +02:00
Daniel Marjamäki
6bd4bdb0f9
Updated 'noValidConfiguration' message. It should not write this message when there is no code. It should be possible to see the preprocessor errors otherwise it is hard to fix the configuration.
2018-05-15 15:42:54 +02:00
Daniel Marjamäki
f7746e4fb6
Revert "Missing override specifier warning on a pure virtual function makes no sense. ( #1230 )"
...
This reverts commit 348eb1c5c9
.
2018-05-15 10:48:34 +02:00
orbitcowboy
d0089fe305
windows.cfg: Added missing PFLOAT definition.
2018-05-15 09:43:28 +02:00
IOBYTE
348eb1c5c9
Missing override specifier warning on a pure virtual function makes no sense. ( #1230 )
...
This fixes a large number of false positives for cppcheck source code.
2018-05-14 23:08:40 +02:00
Daniel Marjamäki
66599b4ade
astyle formatting
...
[ci skip]
2018-05-14 22:48:37 +02:00
umanamente
d2d1bf900b
( #8262 ) Added TODO test for "False positive: memory leak with shared_ptr stored in container" ( #1228 )
2018-05-14 13:08:33 +02:00
PKEuS
090a178ed6
Refactorization in SymbolDatabase: Do not redundantly store name in FriendInfo, and store FriendInfo in vector instead of list
2018-05-14 12:18:59 +02:00
PKEuS
4d549553b0
Small optimization in checkmemoryleak.cpp: Allow passing literals to addtoken()
...
Ran AStyle
2018-05-14 10:15:50 +02:00
Paul Fultz II
7ef714b0c6
Fix FP with duplicate assignments by checking if the expression is unique ( #1223 )
...
* Fix FP with duplicate assignments by checking if the expression is unique
* Use array of pointers
* Reorder scope condition
2018-05-13 20:20:55 +02:00
IOBYTE
5c06d08bfb
Fix many DACA2 SymbolDatabase bailout; unhandled code false positives ( #1225 )
2018-05-13 19:00:42 +02:00
IOBYTE
9ee6068e20
Remove duplicate namespace aliases so they don't produce syntax errors. ( #1222 )
...
* Remove duplicate namespace aliases so they don't produce syntax errors.
DACA2 results showed new SymbolDatabase syntax errors when duplicate
namespace aliases were simplified improperly. The solution is to remove
them in the tokenizer when found.
* Add tests for deleting namespace aliases at end of token list.
* Use eraseTokens to delete multiple tokens at once.
2018-05-13 08:29:40 +02:00
Simon Martin
16e1e1d8f9
Ticket #8550 : Properly simplify "typedef class A B;". ( #1224 )
2018-05-12 10:20:33 +02:00
Daniel Marjamäki
98e3f373e9
Revert "Optimize usage of TemplateSimplifier::simplifyCalculations"
...
This reverts commit 3044612fe9
.
I got a report about a significant slowdown for a code.
2018-05-11 21:26:28 +02:00
Daniel Marjamäki
3044612fe9
Optimize usage of TemplateSimplifier::simplifyCalculations
2018-05-11 14:48:59 +02:00
Paul Fultz II
c520735009
Improve checking of size condition against empty to avoid FPs ( #1213 )
...
* Improve checking of size condition against empty to avoid FPs
* Add const and todo for reverse conditions
2018-05-11 10:22:06 +02:00
Daniel Marjamäki
1e7c1841f7
Fixed #8515 (Wrong info message about unmatched suppression)
2018-05-11 09:01:24 +02:00
IOBYTE
9d30496ea1
Extend symbol database test for const volatile member function. ( #1220 )
2018-05-11 08:15:46 +02:00
IOBYTE
184537884f
Don't remove the volatile keyword so we can properly overload functions. ( #1218 )
...
* Don't remove the volatile keyword so we can properly overload functions.
I fixed all the checks that had tests that use volatile. There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.
* Fix unused private function warning.
2018-05-10 07:40:01 +02:00
IOBYTE
5452c4dc4a
Fixed #8560 (Symboldatabase lacks entry for C++11 overloaded member function) ( #1217 )
2018-05-09 20:16:08 +02:00
Sebastian
50aa3620da
posix.cfg: Add minsize to readlink[at] function configurations ( #1216 )
2018-05-09 18:20:45 +02:00
Paul Fultz II
0197343e0c
Fix false positive when using null arithmetic with class type ( #1214 )
2018-05-09 09:06:49 +02:00
Paul Fultz II
f5dbfce8ff
Fix false positive with oppositeExpression when using binary op ( #1211 )
...
* Fix false positive with oppositeExpression when using binary op
* Simplify conditional
2018-05-08 20:43:57 +02:00
IOBYTE
8b0b659965
Add support for namespace aliases and C++17 nested namespaces. ( #1210 )
...
* Add support for namespace aliases and C++17 nested namespaces.
These are implemented as tokenizer simplifications so changes are not
needed to the tokenizer and symbol database.
* Fix codacy warning.
2018-05-08 06:35:51 +02:00
Daniel Marjamäki
8c2a5c9813
astyle formatting
...
[ci skip]
2018-05-06 09:50:53 +02:00
Paul Fultz II
0561877182
Fix false positive with negative array index in issue 8536 ( #1202 )
...
* Fix FP with negative array index in valueflow
* Remove values when valueflow fails
* Add valueflow test
2018-05-06 08:35:29 +02:00
Paul Fultz II
067d82f0ea
Check for smart pointer release ( #1206 )
2018-05-05 18:06:49 +02:00
Daniel Marjamäki
4408628107
Fixed #8538 (SymbolDatabase: wrong parsing of noexcept)
2018-05-05 08:31:56 +02:00
Daniel Marjamäki
64b85b474c
Fixed #8542 (False positive: noOperatorEq)
2018-05-05 07:46:58 +02:00
Daniel Marjamäki
7fb28b05f6
Check Class: Try to clarify the warnings for noCopyConstructor/noOperatorEq/noDestructor.
2018-05-04 15:39:23 +02:00
Daniel Marjamäki
99003c2084
CheckClass: Better handling of defaulted and deleted functions in the noCopyConstructor/noOperatorEq/noDestructor
2018-05-04 14:58:38 +02:00
Paul Fultz II
cac68c6b81
Fix FP when using - as a binary operator ( #1201 )
2018-05-04 07:58:30 +02:00
IOBYTE
f94e9c5447
Fix #8540 (Syntax error involving forward-declared 'enum class') ( #1203 )
2018-05-04 07:56:20 +02:00
Daniel Marjamäki
59cc479855
Save bitfield bit counts
2018-05-02 20:55:11 +02:00
Daniel Marjamäki
7dfbe7389b
Clarify null pointer arithmetic message
2018-05-02 12:57:24 +02:00
Paul Fultz II
f191a3e753
Improve checking of opposite expressions ( #1199 )
...
* Improve checking of opposite expressions
* Fix some formatting
2018-05-02 06:32:33 +02:00
Daniel Marjamäki
b2343a2d4b
Fixed #8518 (Clarify warning for a NULL pointer which is received by a function call parameter.)
2018-05-01 17:30:29 +02:00
Daniel Marjamäki
31148fdfed
Fixed #8523 (Clarify warning: noConstructor)
2018-05-01 15:50:03 +02:00
Daniel Marjamäki
40b6f6b3dd
CheckClass: Fix the noDestructor warning
2018-05-01 15:31:13 +02:00
Daniel Marjamäki
9710e819be
CheckClass: Disable noDestructor for now, we need to handle new better
2018-05-01 09:26:03 +02:00
Daniel Marjamäki
42100fdf11
CheckClass: Better handling of non-copyable classes in the noCopyConstructor check
2018-05-01 08:33:23 +02:00
Sebastian
b370861bed
test/cfg/std.c: Cleaning up function names and redundant tests ( #1198 )
...
Make the names of uninitvar_* functions consistent and fix typos.
Remove completely redundant functions/tests. Combine according tests if
they are not completely redundant.
2018-05-01 07:33:43 +02:00
IOBYTE
c3c1abd05e
SymbolDatabase: improve checking of uninstantiated templates ( #1196 )
...
* SymbolDatabase: improve checking of uninstantiated templates
* Add bailout and debug warning for '>' token without a link in SymbolDatabase::findFunction()..
Don't crash on bad code simplification from tokenizer.
2018-05-01 07:32:19 +02:00
Daniel Marjamäki
73b41455dd
CheckClass: If class has memory management it should have copy constructor, operator= and destructor
2018-04-30 23:13:33 +02:00
Daniel Marjamäki
7015fb097e
SymbolDatabase::isFunction: better handling of return types
2018-04-29 15:35:31 +02:00
Paul Fultz II
e571e598b6
Fix false positive with inner conditions when using pointers ( #1195 )
2018-04-28 18:56:13 +02:00
Daniel Marjamäki
ca8e19c96d
SymbolDatabase: Refactor SymbolDatabase: variable list
2018-04-28 09:38:33 +02:00
Sebastian
6208ee4af1
std.cfg: Add asctime_s function configuration with tests ( #1191 )
...
* std.cfg: Add asctime_s function configuration with tests
* std.cfg: Remove redundant/not needed not-bool attributes.
2018-04-27 23:51:16 +02:00
Daniel Marjamäki
1a9e8c158d
CheckClass::copyconstructors: Use library to determine if function is a allocation function
2018-04-27 23:20:04 +02:00
Daniel Marjamäki
f336c2efe7
Refactoring; Renamed Scope::classStart and Scope::classEnd
2018-04-27 22:36:30 +02:00
Daniel Marjamäki
e6a37ec0b7
Fixed #8531 (false positive: (style) The function 'foo' overrides a function in a base class but is not marked with a 'override' specifier.)
2018-04-27 21:49:18 +02:00
Daniel Marjamäki
25599a76a7
Handle 'final' specifier better.
2018-04-27 14:57:43 +02:00
Daniel Marjamäki
b830f462e6
Added missingOverride checker; Function 'f' overrides function in base class but does not have the 'override' keyword.
2018-04-27 11:12:09 +02:00
Daniel Marjamäki
8304290f06
astyle formatting
...
[ci skip]
2018-04-27 10:29:27 +02:00
Daniel Marjamäki
d15b945c9e
SymbolDatabase::isFunction: Fix wrong detection function
2018-04-27 10:24:02 +02:00
Simon Martin
9fade65dbb
Ticket #8281 , #8417 : Properly detect the end of "switch" statements to accept all legitimate uses of "case". ( #1112 )
2018-04-26 22:26:26 +02:00
Daniel Marjamäki
5384802e16
SymbolDatabase: Look for types in anonymous scopes
2018-04-26 17:55:04 +02:00
amai2012
55983e2a0b
#8509 Uniform initialization ignored for iterator
2018-04-26 08:57:25 +02:00
Sebastian
038064436d
std.cfg: Fix minsize configuration for vsprintf ( #1188 )
...
minsize with argvalue for arg 2 which is a char pointer makes no sense.
Changing it to minsize with strlen for arg 2 results in false positives
(and i think false negatives too).
In std.c a test with a valid vsprintf usage is added that would result
in a FP when minsize with strlen for arg 2 would be used.
2018-04-25 02:52:19 +02:00
IOBYTE
fac851192a
SymbolDatabase: fix problem where definition coudn't find forward declaration in class ( #1190 )
2018-04-24 22:43:47 +02:00
Daniel Marjamäki
deaafd59d7
CheckClass: Undo the rule of 3 checker to avoid some warnings
2018-04-24 22:42:25 +02:00
Daniel Marjamäki
485d3e0229
CheckClass: Tweak rule of 3 checker
2018-04-24 21:45:30 +02:00
Daniel Marjamäki
6fb25dcaa4
CheckClass: Changed checker for 'copy constructor' and 'operator=' to a 'rule of 3' checker
2018-04-24 16:07:58 +02:00
Daniel Marjamäki
8310198cd5
SymbolDatabase: Refactoring and testing isImplicitlyVirtual
2018-04-24 13:53:58 +02:00
Daniel Marjamäki
bb227613bb
SymbolDatabase: Better type lookup in methods
2018-04-23 22:27:15 +02:00
Sebastian
a61f9abbb7
Visual Studio: testrunner: Add missing testastutils ( #1186 )
2018-04-23 20:03:06 +02:00
orbitcowboy
92fd0595b1
Merge branch 'master' of https://www.github.com/danmar/cppcheck
2018-04-23 12:55:10 +02:00
orbitcowboy
e76f1e70e8
Added tests for invalidFunctionArg.
2018-04-23 12:54:49 +02:00
Daniel Marjamäki
7c5058a42d
Refactoring. Rename methods
2018-04-23 12:39:47 +02:00
Daniel Marjamäki
f058d9ad08
CLI: Added more fields for --template and added a new --template-location. The gcc predefined template now matches latest gcc better.
2018-04-23 12:21:18 +02:00
Daniel Marjamäki
e1db4c0e2c
astyle formatting
...
[ci skip]
2018-04-21 13:28:31 +02:00
Simon Martin
a451a5b598
Ticket #8436 : Handle C++11 initializations within ternary operator. ( #1174 )
2018-04-21 11:30:07 +02:00
Paul Fultz II
d939c6015a
Report opposite expressions ( #1182 )
...
* Report opposite expressions
* Skip assignment operator
2018-04-21 11:28:21 +02:00
Paul Fultz II
bad66594d6
Fix double free regression with smart pointers ( #1184 )
2018-04-21 11:24:19 +02:00
Daniel Marjamäki
d5fb529d4f
Fixed #8492 (Improve message: parameter should be passed by reference)
2018-04-20 17:33:42 +02:00
Sebastian
b53c4b2032
std.cfg: Add std::vector function configurations and tests ( #1180 )
2018-04-19 16:41:25 +02:00
amai2012
e256ce8ea8
Add more tests for Path::isAbsolute
2018-04-19 14:35:26 +02:00
Daniel Marjamäki
7ee636b934
Refactoring: Reuse isLikelyStreamRead in isVariableChanged
2018-04-18 17:46:10 +02:00
Daniel Marjamäki
26e36a1d6b
Fix FP uninitvar when stream bool operator is used
2018-04-18 16:13:24 +02:00
Sebastian
3b68c913cb
testrunner: Add testplatform to verify platform loading ( #1176 )
2018-04-18 16:12:35 +02:00
Daniel Marjamäki
1b4f4d7130
Fixed #8495 (False positive: boolean result used in bitwise operation when & is overloaded)
2018-04-17 22:14:17 +02:00
Daniel Marjamäki
c84628c28a
Fixed #8494 (False positive: serialization class overloads operator)
2018-04-17 14:23:04 +02:00
Daniel Marjamäki
a4f8c44432
astyle formatting
...
[ci skip]
2018-04-16 12:55:37 +02:00
Paul Fultz II
2a657cfd08
Check for double frees when using smart pointers ( #1172 )
...
* Check for double frees when using smart pointers
* Some updates from feedback
* Add test for mismatch allocation
* Constants
* Check smart pointer deleter
* Switch order
* Use next
* Add owned state
* Fix handling of leaks
* Use ast for checking addressof operator
* Remove stray character
* Add a test for mismatch allocator
* Add another test for deallocating with custom function
2018-04-16 11:11:13 +02:00
Sebastian
c39a3e3f1c
windows string macros: Handle _T, _TEXT and TEXT internally, add tests ( #1163 )
...
Remove TEXT() macro from windows.cfg and handle it internally where it
can be correctly simplified (Ansi vs. Unicode).
Also add handling of _TEXT() macro which is just a synonym for _T().
Add tests to verify correct function and macro simplification.
2018-04-12 08:52:31 +02:00
Sebastian
a36dad918a
std.cfg: Add std::make_pair() ( #1165 )
2018-04-11 19:16:55 +02:00
orbitcowboy
ef62207ada
std.cfg: Added more tests for some std::vector functions.
2018-04-11 17:21:26 +02:00
PKEuS
b596b0d549
Refactorization: pass std::string directly to std::*fstream
2018-04-11 09:50:42 +02:00
PKEuS
d2146844dd
Refactorizations:
...
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki
a0c9de0048
Suppressions: Validate inline suppressions
2018-04-11 08:18:00 +02:00
Sebastian
3fc53eb122
std.cfg: Add std::[w]string::compare() with tests ( #1162 )
2018-04-10 21:07:39 +02:00
Daniel Marjamäki
c5923fbdd3
astyle formatting
2018-04-09 22:21:17 +02:00
Daniel Marjamäki
8f84a493f4
remove foreach emulator
2018-04-09 22:09:10 +02:00
Daniel Marjamäki
e6114a2321
glob patterns: wildcards also match path separators (like before)
2018-04-09 18:59:18 +02:00
IOBYTE
8734e4dd38
Fix SymbolDatabase bailout to also support struct ( #1160 )
2018-04-09 18:53:55 +02:00
Paul Fultz II
d8b3fa5c70
Fix #8482 : Regression with valueflow ( #1159 )
...
* Fix regression with valueflow
* Simplify test case
2018-04-09 16:13:17 +02:00
Daniel Marjamäki
f677322c69
Suppressions: Allow symbol-based inline suppressions
2018-04-09 11:50:59 +02:00
PKEuS
17b4721bd2
C++17: Support "if constexpr" (by simplifying it to plain if() statement)
...
This might lead to complaints about constant expressions as if() statement, but should fix syntax errors.
2018-04-09 11:42:59 +02:00
PKEuS
bbfcccf078
Refactorization: Replace several push_back-sequences by initializer lists
2018-04-09 09:41:24 +02:00
Daniel Marjamäki
a0906140a6
Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName.
2018-04-09 06:43:48 +02:00
PKEuS
e2002db78d
Replaced make_container by C++11 initializer lists
2018-04-08 23:03:44 +02:00
Paul Fultz II
95fc84a26b
Find duplicate expressions assigned to the same variable ( #1129 )
...
* Check for duplicate assignments
* Improve checking of expression
* Add more tests
* Use simple match
* Improve robustness of check
* check for null
* Reduce side effects by checking for side effects
* Improve verbose message
* Reword the error message
2018-04-08 14:43:19 +02:00
Daniel Marjamäki
795b9f5e0f
astyle formatting
2018-04-08 09:25:59 +02:00
Paul Fultz II
aed84abfd5
Extend valueflow comparison ops ( #1153 )
...
* Handle else clause when doing a compare
* Break early
* Fix bug in checking no return else
* Escape quotes
* Add equal sign
* Simplify the logic
2018-04-08 09:24:01 +02:00
Paul Fultz II
b85dda77da
Add a check for identical inner conditions ( #1156 )
2018-04-08 08:13:44 +02:00
IOBYTE
90983303f0
Fix #8477 (False positive caused by anonymous enum in method body) ( #1154 )
2018-04-08 08:00:12 +02:00
IOBYTE
4f9073159a
Fix another SymbolDatabase bailout ( #1157 )
2018-04-08 07:29:19 +02:00
orbitcowboy
270635eb1f
wxwidgets.cfg: Improved support for wxString to number conversion functions.
2018-04-07 20:27:02 +02:00
IOBYTE
20f0784c06
Fix #8470 ((error) SymbolDatabase bailout; unhandled code) ( #1155 )
2018-04-07 16:41:39 +02:00
Daniel Marjamäki
0daa3bba30
ValueType: Improved type handling of containers when [] operator is used
2018-04-06 22:26:35 +02:00
IOBYTE
7e15e39f39
Fix some new SymbolDatabase bailout; unhandled code syntax errors. ( #1152 )
2018-04-06 21:32:32 +02:00
Daniel Marjamäki
05acf9b352
Fixed #8470 ((error) SymbolDatabase bailout; unhandled code)
2018-04-06 16:03:58 +02:00
IOBYTE
9f386d305a
Fixed #8280 (False positive uninitMemberVar - initialized from nested overloaded function) ( #1151 )
2018-04-06 07:53:05 +02:00
Paul Fultz II
b871c85b67
Improve valeflow analysis with comparison operators ( #1131 )
...
* Improve valeflow analysis with comparison operators
* Use simple match
* Dont add 0 on comparisons
* Check reverse comparisons
* Use nullptr
* Remove duplicate code tests
2018-04-05 06:51:31 +02:00
Paul Fultz II
54de7b48c9
Fix false positive when constructing with curly brace ( #1148 )
2018-04-05 06:47:59 +02:00
Paul Fultz II
0c6f184423
Fix false positive for opposite conditions when using different containers ( #1143 )
...
* Fix false positive for opposite conditions when using different containers
* Add additional test
2018-04-05 06:43:13 +02:00
orbitcowboy
6e21d5ab84
wxwidgets.cfg: Added support for wxAtoi, wxAtol and wxAtof.
2018-04-04 21:29:55 +02:00
amai2012
41a46364c8
Fix sorting order for test fixtures to get consistent behaviour across different platforms ( #1145 )
2018-04-04 20:51:47 +02:00
IOBYTE
a62c932a8f
Improve findFunction for function calls with function calls as arguments. ( #1147 )
...
Duplicate the existing logic for variable to variable type comparisons
for function return type to variable type comparisons.
2018-04-04 20:44:01 +02:00
amai
b133d50ebe
#6426 Regression now has platform dependent results
2018-04-04 16:07:07 +02:00
amai
7581231d9d
#6426 FP duplicateExpressionTernary - (expr) ? ~0u : ~0ul. Add regression test
2018-04-04 14:31:48 +02:00
Daniel Marjamäki
0d434efc15
virtualCallInConstructor: Clarify warning message
2018-04-04 13:04:40 +02:00
Daniel Marjamäki
b3b364b42f
virtualCallInConstructor: Updated warning message
2018-04-04 12:52:58 +02:00
Daniel Marjamäki
7efc4dd26e
astyle formatting
...
[ci skip]
2018-04-04 10:04:40 +02:00
IOBYTE
fa968d75bd
Partial fix for #8291 : (False positive uninitMemberVar when calling delegated constructor) ( #1142 )
2018-04-04 08:29:12 +02:00
Paul Fultz II
bce5fe5cef
Improve duplicate expressions in the ternary op by checking for equal values as well ( #1134 )
...
* Improve duplicate expressions in the ternary op by checking for equal values as well
* Use value instead of expression
2018-04-03 21:43:55 +02:00
Paul
d240a36a60
Extend nullPointerArithmetic to check for addition as well
2018-04-03 21:32:37 +02:00
Daniel Marjamäki
ee22a325c7
virtual function call in constructor: don't warn about explicit scoped call
2018-04-03 14:02:59 +02:00
IOBYTE
2a418fa0f5
Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) ( #1141 )
2018-04-02 18:32:45 +02:00
Daniel Marjamäki
1046ca2120
Improve check: Warn about virtual function calls in constructor/destructor
2018-04-02 15:31:47 +02:00
Daniel Marjamäki
e492932f19
Improve check: Variable is not initialized in private constructor (C++11 or later)
2018-04-02 15:26:15 +02:00
Daniel Marjamäki
9f92685b92
SymbolDatabase: Throw InternalError if parsing fails
2018-04-02 13:14:48 +02:00
Daniel Marjamäki
af88d7c4a9
Makefile: updated for release
2018-04-02 09:02:50 +02:00
Daniel Marjamäki
c0272fc2ef
Fixed #8259 (Don't combine &= for anonymous reference parameters)
2018-04-01 10:27:16 +02:00
Daniel Marjamäki
7e4dba6a7e
Updated copyright year
2018-03-31 20:59:09 +02:00
Daniel Marjamäki
4af2e517b9
Fixed #8465 (SymbolDatabase: bailout if there is 'struct A::B ab[5];')
2018-03-31 17:54:47 +02:00
orbitcowboy
e3977f7e51
Formatted test/cfg files and updated 'runastyle' script. The generated test files are exclued, since they are not style-compliant.
2018-03-31 13:49:47 +02:00
orbitcowboy
d7072136dc
wxwidgets.cfg: Added support for wxMenuBar::Append().
2018-03-31 13:34:40 +02:00
orbitcowboy
43aac4696e
wxwidgets.cfg: Added support for more functions.
2018-03-31 13:23:12 +02:00
Sebastian
3c5777fbc6
windows library: Add config for some Local* functions ( #1139 )
...
Add configuration and tests for LocalAlloc, LocalFree and some other
Local* functions.
LocalReAlloc is currently not configured as an alloc/dealloc function
(like realloc is not configured in std.cfg), i am not sure how to
correctly configure it.
2018-03-29 20:47:22 +02:00
Daniel Marjamäki
1bc8f7f29a
astyle formatting
2018-03-29 17:25:20 +02:00
Paul Fultz II
70da3acb70
Add foreach emulation for older compilers ( #1138 )
2018-03-29 04:51:22 +02:00
Daniel Marjamäki
210b921062
Fixed #8462 (AST: no ast created for 'e = { std::move(address),httpPort, (httpsPort) };')
2018-03-27 13:44:28 +02:00
Dmitry-Me
c76b593467
Resolve C4800 warning
2018-03-27 00:58:53 +03:00
Sebastian
d3284d5d54
std.cfg: Add strncpy_s and strncat_s ( #1136 )
2018-03-26 18:38:26 +02:00
Paul
43be20a824
Check more opposite conditions
2018-03-24 07:58:37 +01:00
amai
dbb7e98711
#8346 Add regression test
2018-03-24 07:28:02 +01:00
IOBYTE
5bc039b7da
Fix #6367 and #8439 (improve sizeof value flow support) ( #1132 )
2018-03-23 08:28:12 +01:00
Daniel Marjamäki
5a444f764b
Fixed one more syntax error FP related to #8390
2018-03-22 15:20:37 +01:00
Daniel Marjamäki
3d4b773fd1
Fixed #8390 (Syntax error from an MSVC internal header)
2018-03-22 09:07:58 +01:00
Sebastian
e38ec41ded
windows.cfg: Add some commonly used macros ( #1127 )
2018-03-22 08:31:50 +01:00
Daniel Marjamäki
dfd8ef5d52
generate_cfg_tests: fix argument count
2018-03-19 20:46:55 +01:00
Daniel Marjamäki
7202787435
posix: remove function 'remove' that is also configured in std.cfg
2018-03-19 20:04:58 +01:00
Daniel Marjamäki
3af7aef3f0
update generated cfg tests ( aca16e3
)
2018-03-19 16:25:44 +01:00
Daniel Marjamäki
6b00ca33bd
posix.cfg: Removed rename function as this is configured in std.cfg
2018-03-19 15:29:47 +01:00
Daniel Marjamäki
4e1ad40c87
update generated cfg tests ( 113f1ef
)
2018-03-19 13:51:51 +01:00
Daniel Marjamäki
6e66150feb
posix.cfg: update configuration for rename
2018-03-19 11:51:19 +01:00
Daniel Marjamäki
f94a02a61e
update generated qt.cfg tests
2018-03-19 11:51:03 +01:00
Daniel Marjamäki
b10dd5d21e
2 TODOs are fixed
2018-03-19 11:02:58 +01:00
Daniel Marjamäki
0d3ddd85b1
updated generated cfg tests
2018-03-19 09:46:16 +01:00
Daniel Marjamäki
7699f6432b
Fixed #8288 (valueFlowGlobalVar: compound assignments)
2018-03-18 19:53:33 +01:00
Daniel Marjamäki
e932c44ae6
generate cfg tests: updated NULL pointer testing
2018-03-18 19:04:17 +01:00
Daniel Marjamäki
0741c389c0
generated cfg tests: updates, most unmatched suppressions are removed now
2018-03-18 14:06:26 +01:00
Daniel Marjamäki
c800ac5118
generate_cfg_tests: updating testing for not-null
2018-03-18 13:53:46 +01:00
Daniel Marjamäki
914eea7ed1
generated cfg tests: updated test files
2018-03-18 13:22:33 +01:00
Daniel Marjamäki
cf180dcc6b
add script to generate cfg tests
2018-03-18 13:03:19 +01:00
Paul Fultz II
73ac27cc79
Fix loading library when running tests from build directory ( #1123 )
2018-03-18 06:50:33 +01:00
Daniel Marjamäki
ec6133aea2
Fixed #8182 (False positive uninitvar - variable initialized in function in ternary expression)
2018-03-16 19:13:48 +01:00
Sebastian
65c85cbb53
Windows library: Add intrinsics __noop and __nop ( #1119 )
2018-03-15 12:31:20 +01:00
Paul Fultz II
166e4cafcd
Check for functions calls in sizeof calculations ( #1111 )
...
* Check for functions calls in sizeof calculations
* Use seperate message and id for sizeofFunction
* Check for overloads
* Using decltype with a function should not be an error
* Fix warning
* Fix false positives when running pass the close paren
* Fix test error
* Try to fix more false positives
* Traverse using astOperand2
* Only check first argument
* Update fixes from feedback from PR
2018-03-15 10:24:17 +01:00
Sebastian
ed3cd2929e
Windows library: Enhance functions, add tests ( #1117 )
...
Enhance *Equal/*Compare/*Copy/*Move/*Zero/*Fill memory functions to
catch buffer access out of bounds errors and ignored return values.
Replaced some function configuration by according defines as it is done
in windows to avoid redundant (and error prone) configurations.
2018-03-14 15:01:37 +01:00
Daniel Marjamäki
cb6ed0555c
Fix testrunner
2018-03-14 11:11:35 +01:00
Hinterwaeldlers
a9b1f4c640
Taking care of operation overloading functions ( #1108 )
2018-03-12 10:25:30 +01:00
Daniel Marjamäki
380ecc408f
Fixed #8418 (AST: wrong ast for throw expression)
2018-03-10 22:30:21 +01:00
Sebastian
7ba9ab7e4c
Gtk library: Add configuration to avoid syntax error, add test file ( #1109 )
...
Add configuration for G_UNLIKELY and G_LIKELY to avoid syntax errors
when these macros are used as condition without enclosing brackets.
Add test file to verify Gtk library configuration. Syntax check for the
test file is only done when Gtk+2.0 or Gtk+3.0 is found and working.
Tested on Cygwin and on Ubuntu 16.04.
2018-03-10 11:22:10 +01:00
Alexander Mai
70664e5857
Ensure wxWidgets installation is at least 2.9.5
2018-02-26 20:46:56 +01:00
Daniel Marjamäki
7701e4594a
ValueFlowBeforeCondition: Fix wrong value in do-while condition when there is a break in the loop body
2018-02-24 22:07:34 +01:00
Sebastian
346704b2e2
windows library: Mainly add socket functions, some other stuff and tests. ( #1095 )
...
Add Windows Socket 2 type/function configuration. There are still many
(microsoft specific) socket functions that are not yet configured.
Add configuration for GetUserName(), GetWindowText() and _fileno().
On Windows __wchar_t is a synonym for wchar_t, so an according define is
added.
2018-02-23 12:51:37 +01:00
amai2012
1c38b3aae7
Fix warning in test on Cygwin
2018-02-22 12:27:46 +01:00
Sebastian
1d14919649
wxwidgets: Fix syntax checking errors and warning ( #1093 )
...
wxDebugContext is only defined if wxUSE_DEBUG_CONTEXT is 1, so otherwise
just skip it for syntax checking because it will fail.
Change wxT to wxT_2 and add wxT_2 to the config to remove a warning
during syntax check and be more compatible with newer/older wxwidgets
versions.
Be more precise when replacing function like macros, fix redundant macro
definition for "_".
2018-02-21 12:20:56 +01:00
orbitcowboy
2ce8a3fc95
wxwidgets.cfg: Improved support for some deprecated functions.
2018-02-20 23:34:01 +01:00
orbitcowboy
a4ab30cbe3
Replace uint8_t with short to fix CI.
2018-02-20 00:22:14 +01:00
orbitcowboy
46b4a502df
Added missing include.
2018-02-20 00:18:20 +01:00
orbitcowboy
b7b376d901
checkTypes: Take into account type promotion to integer.
2018-02-19 23:55:38 +01:00
orbitcowboy
b1b3164259
checktype: Added handling of 'short'-type and added test cases.
2018-02-18 21:09:19 +01:00
orbitcowboy
50844aa7fc
checkType: Take into account the size of char.
2018-02-18 14:28:48 +01:00
orbitcowboy
782ebdc8e8
testlibrary: Minor improvements, take into account the return values from readLibrary in unit-tests.
2018-02-17 23:33:24 +01:00
IOBYTE
fcde1d80e9
Fix #8382 (Syntax error when scanning code with template and attribute) ( #1089 )
...
* Fix #8382 (Syntax error when scanning code with template and attribute)
This commit only addresses #8382 . There are issues concerning which
versions of C++ should be supported and also generic C++ 14 attribute
support which can be revisited later.
* Remove all C++ style attributes.
Remove all C++ style attributes when C++ version is 11 or greater.
Rename simplify function to simplifyCPPAttributes.
Handle more cases of roreturn function attribute.
2018-02-16 22:25:51 +01:00
orbitcowboy
2defdb7d4c
wxwidgets.cfg: Added more deprecated functions.
2018-02-14 09:53:40 +01:00
Sebastian
bbe9fad81d
std library: Resolve two TODOs ( #1074 )
...
First resolved TODO in std.c is obsolete since the "res" variable is used later
and there is therefore no warning issued.
Second resolved TODO in std.c: A warning for uninit variables is issued by
cppcheck, so this check can be enabled. Since assert() has no noreturn configuration
(currently a useful configuration is not really possible, see ticket 8329) the
check-library message is suppressed.
2018-02-12 16:42:23 +01:00
Daniel Marjamäki
e62b9bdc77
Fixed #8348 (ValueFlow: wrong Uninit value with abort() in else-branch)
2018-02-11 22:14:44 +01:00
orbitcowboy
8ef56972da
wxwidgets.cfg: Added more deprecated-functions.
2018-02-11 16:58:39 +01:00
IOBYTE
d68f07e50c
Add purgedConfiguration to list of error ids. ( #1087 )
...
purgedConfiguration was not showing up in the GUI supression list.
2018-02-10 22:30:49 +01:00
Simon Martin
66d16b51f0
Ticket #8352 : Properly detect AST cycles. ( #1060 )
2018-02-10 14:39:57 +01:00
Sebastian
9eb6d38c06
std library: Add tests for wide character string functions, fix config ( #1085 )
...
Add equivalent tests for the wide character string functions like they
are already done for the normal string functions.
Fixed some issues with the configuration of the wide character string
functions that arised through the tests and were already fixed for the
normal string functions.
2018-02-09 21:17:01 +01:00
Sebastian
170d60712f
wxwidgets library tests: Add syntax checking, fix test file. ( #1084 )
...
For the syntax check g++ needs to know the wxWidgets include paths which
are retrieved via wx-config. If includes are missing or not working the
syntax check is skipped.
wxwidgets.cpp: Fixed syntax, includes and added code so the syntax check
does not fail if some special features are not present.
2018-02-09 20:34:15 +01:00
Lauri Nurmi
e0e664f996
Fix permissions of certain non-executable files ( #1083 )
...
mode 0755 => 0644
2018-02-09 19:46:38 +01:00
orbitcowboy
dccf96cb7b
wxwidgets.cfg: Added more deprecated functions.
2018-02-07 13:33:15 +01:00
orbitcowboy
dea662891a
wxwidgets.cfg: Added some functions from the deprecated wxWidets-list ( http://docs.wxwidgets.org/trunk/deprecated.html ).
2018-02-07 11:40:42 +01:00
Sebastian
14e45f9dcb
wxwidgets library: Fix/Enhance cfg, add test file ( #1082 )
...
Add test file for wxwidgets configuration, fix found issues and enhance
the cfg a bit:
Fix declarations in comments for wxLog* functions.
Merge the two wxTextFile::Create overloaded function configurations into
one that works for both now.
Removed use-retval attribute from wxBoxSizer::AddSpacer and
wxButton::SetDefault configuration since the functions have side effects
and there is no need to use the return value.
Add some function configurations, the macro _(str) and POD wxLogLevel.
2018-02-06 15:33:45 +01:00
Daniel Marjamäki
58066b1f0c
Remove whole program analysis from 'uninitialized variables' and 'null pointer dereference' checkers. I think this logic can more or less be added in ValueFlow instead and then all ValueFlow checkers should get whole program analysis.
2018-02-06 14:56:17 +01:00
Daniel Marjamäki
71511f3131
Refactor f487182
2018-02-06 08:59:36 +01:00
Ivan Maidanski
f487182075
Suppressed unused functions should not lead to nonzero exit code ( #1026 ) ( #1078 )
...
This is a fix of commit 97ffec8
.
2018-02-06 07:44:53 +01:00
Daniel Marjamäki
dbc6771a0b
Uninitialized variables: Fix FP for unknown macro like 'list_for_each'
2018-02-04 22:30:08 +01:00
Matthias Krüger
f009cfc845
fix some typos found by codespell.
2018-02-04 20:53:43 +01:00
Daniel Marjamäki
4998248501
Null pointers: Fixed false positives when running whole program analysis. Copied the fix from the CheckUninitVar::isUnsafeFunction.
2018-02-04 15:29:57 +01:00
Jørgen Kvalsvik
a61f21d1b6
Accept nested templates in tokenizer-simplify ( #1070 )
...
The following snippet triggerd the error:
template<typename DerivedT>
template<typename T>
auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
return Parser() | static_cast<DerivedT const &>( *this ) | other;
}
Whenever simplifyFunctionParameters was called on a templated class'
templated member function (and probably any nested template), the
tokenizer would recognise it as a syntax error, assuming that return
type *must* come after a template<> token.
2018-02-04 09:48:37 +01:00
Daniel Marjamäki
d47b7726fa
Uninitialized variables: Fix potential false positives in subfunction if there is early return or conditional writes
2018-02-04 09:40:57 +01:00
IOBYTE
d721c6aca5
Fixed #8386 (syntax error not found (segmentation fault)) ( #1081 )
2018-02-03 15:50:05 +01:00
Sebastian
2e5d7a8391
Fix #8381 : false positives for swprintf_ and stprintf_s ( #1080 )
...
This fixes false positives because of wrong configuration in
windows.cfg.
Add tests in testio.cpp and test/cfg/windows.cpp to avoid regression.
2018-02-03 05:10:52 +01:00
Sebastian
c235930539
windows library: Add function configurations with tests ( #1079 )
...
Add function configurations with tests for:
GetLocalTime, GetSystemTime, GetLastError, SetLastError,
AllocateAndInitializeSid, FreeSid, HeapAlloc, HeapReAlloc, HeapFree,
HeapSize, HeapValidate and GetProcessHeap.
test/cfg/runtests.sh: Enable --inconclusive for the windows tests to
avoid some issues in the future.
2018-02-02 11:28:54 +01:00
Sebastian
1ad22ae231
windows library: Add strlwr/strupr configuration, fixing tests ( #1076 )
...
Add configuration for the deprecated strlwr/strupr functions with
according warning.
test/cfg/windows.cpp: Added tests for strlwr and strupr. Moved function
call that does not return (FreeLibraryAndExitThread) to the end of the
function to fix analysis that was silently aborted at that point
(reported as issue #8378 ).
2018-01-31 17:43:19 +01:00
Sebastian
7b02b45a76
posix library: Add strtok tests ( #1069 )
...
* posix library: Add strtok tests
In the posix library there is the same configuration for strtok but a
warning is added.
* posix.cfg: Remove redundant configuration for strtok, add comment.
2018-01-31 10:58:30 +01:00
Sebastian
c62abee07a
windows library: Add _malloca/_freea and _alloca configuration with tests ( #1071 )
2018-01-30 16:40:38 +01:00
orbitcowboy
f5e6ef9fd2
checkio: Fixed potential usage of invalid iterator. ( #1066 )
...
* checkio: Fixed potential usage of invalid iterator.
* formatted the code.
A ticket about FN (invalidIterator1) is created at https://trac.cppcheck.net/ticket/8373
2018-01-30 08:43:15 +01:00
Sebastian
4b5e4f989a
std config: Remove misspelled function "strbprk" ( #1065 )
...
Remove misspelled function configuration "strbprk" (also from the
tests). The correct function "strpbrk" is already configured and tested.
2018-01-29 17:28:44 +01:00
Sebastian
30b9391461
windows library: Enhance Event function configuration, add tests ( #1064 )
2018-01-29 14:08:56 +01:00
Sebastian
e8a262a1f2
posix.cfg: Enable/Add fdopen tests ( #1063 )
...
* posix.cfg: Enable/Add fdopen tests
* posix.cfg: Add missing empty line
2018-01-29 11:19:31 +01:00
David Hallas
4d18d3948f
Fixes issue with case inside switch that is not a compound statement ( #1031 )
...
* Fixes issue with case inside switch that is not a compound statement was treated as garbage
This fixes an issue with the check for case keywords outside of switch
detection that would treat a case statement inside a switch that is not
a compound statement as garbage, but this is perfectly valid C++. This
construct is used in several libraries, i.e. Google Test.
* Tweak check and handle missing semicolon
Tweaks the check with feedback from danmar.
Handle the case where there is no semicolon and document it with a unit
test.
2018-01-27 22:21:26 +01:00
Daniel Marjamäki
bc40f5041d
Fixed #6356 (Improve checking: pointer arithmetic "ab.a + 100" overrun)
2018-01-27 15:39:39 +01:00
Daniel Marjamäki
c110770481
Fixed #8325 (False negative: address of auto variable being returned when assigned to another variable first)
2018-01-27 14:48:45 +01:00
Simon Martin
71ba513bdb
Ticket #8361 : Fix false positive in Tokenizer::findGarbageCode. ( #1061 )
2018-01-26 22:06:07 +01:00
Daniel Marjamäki
a5f202360a
Fixed crash for garbage code, found by fuzzing
2018-01-26 09:34:27 +01:00
Daniel Marjamäki
cb297a00fc
Auto variables: Assign address of local variable to global pointer ( #6825 )
2018-01-25 22:50:41 +01:00
Daniel Marjamäki
9109956c8c
UninitVar: Improve whole program analysis, used isVariableUsage()
2018-01-25 21:49:21 +01:00
Daniel Marjamäki
f73da16e94
Revert "UninitVar: Better checking in whole program analysis"
...
This reverts commit b2bdc2687b
.
2018-01-25 17:05:57 +01:00
Daniel Marjamäki
b2bdc2687b
UninitVar: Better checking in whole program analysis
2018-01-25 15:56:46 +01:00
Daniel Marjamäki
c04557eb73
Fix crashes detected with fuzzing
2018-01-25 15:53:58 +01:00
Daniel Marjamäki
ce60b326f4
Whole program analysis: Improved handling of nested calls
2018-01-24 22:53:14 +01:00
Daniel Marjamäki
599e038282
AutoVariables: Warn when address of local array is assigned to global pointer and pointer is not reassigned
2018-01-24 21:33:58 +01:00
Sebastian
eabe5787ba
Add windows configuration tests ( #1053 )
...
Implemented tests for the following windows configurations (more will
follow):
-Semaphore usage
-lstrcat function configuration
-_countof macro configuration
-Mutex usage
-Library usage (LoadLibrary, GetProcAddress, ...)
2018-01-24 20:05:16 +01:00
Daniel Marjamäki
96e387a486
Fixed #8351 (segmentation fault on objective C code)
2018-01-24 18:06:11 +01:00
IOBYTE
558e0757c2
Fix simplifyTypedef crash on lambda. ( #1054 )
2018-01-24 15:04:33 +01:00
Daniel Marjamäki
0f561d0ed6
Fix crashes for garbage code, found by fuzzing
2018-01-24 13:53:03 +01:00
IOBYTE
4710d80a40
Fix #5766 (FP: typedef array throws off parser) ( #1052 )
...
* Fix #5766 (FP: typedef array throws off parser)
* Fix travis build.
2018-01-24 09:51:22 +01:00
Daniel Marjamäki
ce44a5805c
astyle formatting
...
[ci skip]
2018-01-23 18:15:37 +01:00
Sebastian
b78d714037
posix.cfg: access(): Removed redundant configuration, added tests ( #1048 )
...
I intentionally removed the second access() configuraion because it was
missing the use-retval attribute. But calling access() without using the
return value is absolutely senseless.
I added tests to posix.c to verify the correct configuration of
access().
2018-01-22 14:54:14 +01:00
IOBYTE
e6d285d3ca
Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) ( #1046 )
2018-01-22 08:06:56 +01:00
IOBYTE
3159d151d3
Fix symbol database crash on template type aliases by ignoring them. ( #1045 )
2018-01-21 21:22:26 +01:00
Alexey Eryomenko
913fdf44b6
member access operators are allowed inside the embedded SQL block when ( #1043 )
...
passing arguments for a query
2018-01-21 15:58:12 +01:00
IOBYTE
5673348215
Fixed #8350 (False positive: enum class static_cast to int is treated as non-primitive when type inference is used) ( #1042 )
2018-01-21 07:26:37 +01:00
Simon Martin
b4f32206af
Ticket #8337 : Fix false positive in copy constructor detection. ( #1040 )
2018-01-20 14:46:09 +01:00
Daniel Marjamäki
0a70b8794c
astyle formatting
...
[ci skip]
2018-01-19 23:26:28 +01:00
Sebastian
de7aa8f513
Fix #7504 : posix: open() was twice in configuration file ( #1032 )
...
* Fix #7504 : posix: open() was twice in configuration file
This fixes ticket #7504 : Problems with the open function were not always
detected because the open function was twice in posix.cfg and only the
second configuration was used by cppcheck. Like suggested now only
one configuration is used and the third parameter has a default value
and is thereby optional.
use-retval has been removed to avoid duplicate warnings because the
alloc/dealloc configuration already warns about unused retval.
According tests to verify that open is configured
correctly now have been added to test/cfg/posix.c.
* posix.cfg: open(): Add TODO for use-retval configuration
2018-01-18 13:56:36 +01:00
Simon Martin
8878e6dd0d
Ticket #8333 : Properly report a syntax error for functions with invalid parameter types. ( #1030 )
2018-01-18 08:51:35 +01:00
Daniel Marjamäki
100887429d
Uninitialized variables: Whole program analysis for function calls
2018-01-15 15:54:09 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
Ivan Maidanski
97ffec85c0
Fixed #7502 (Correct exit code if never used function is found) ( #1026 )
2018-01-12 08:24:01 +01:00
IOBYTE
03603c85cf
Fixed #8331 (stack overflow: daca: firefox-58.0b14) ( #1027 )
2018-01-12 08:19:21 +01:00
Daniel Marjamäki
1b13490ac1
Move code
2018-01-11 14:27:41 +01:00
Daniel Marjamäki
6fd157e93b
ValueFlow: Template arguments have 'possible' values
2018-01-11 14:22:27 +01:00
Daniel Marjamäki
bbeff99cc3
Fixed #6930 (Token: need function that says if the token comes from instantiated template argument)
2018-01-11 09:41:22 +01:00
Daniel Marjamäki
323e9ab509
astyle formatting
...
[ci skip]
2018-01-11 09:31:16 +01:00
IOBYTE
cefb2131c7
Add support for simple c++ 11 type ailases like: using INT = int; ( #1024 )
...
* Add support for simple c++ 11 type ailases like: using INT = int;
Only types supported by ValueType are supported. Complex types like
function pointers are not supported. Template type aliases are not
supported.
* Fix crash when type in using type alias is simplified away.
This fixes a crash when size_t is replaced with unsigned long in: using
size_t = unsigned long; by the tokenizer.
This does not fix the problem where Tokenizer::simplifyPlatformTypes()
simplifies away size_t in other cases. This is only a problem when the
new type is different from the platform type.
2018-01-10 22:16:18 +01:00
Daniel Marjamäki
58034dee86
Fixed #8076 (unmatched suppression when calling ./runtests.sh (test/cfg))
2018-01-10 15:52:06 +01:00
amai2012
b17807c568
#6572 False positive eraseDereference - in iterator class - flag error inconclusive if iterator is not STL type
2018-01-10 09:37:21 +01:00
PKEuS
b684e1f202
Updated AStyle to version 3.0.1
2018-01-08 20:20:33 +01:00
Iván Matellanes
cfeea3d35c
Fixed #7331 : Detect copy and move constructors with default parameters ( #1018 )
2018-01-07 14:20:19 +01:00
PKEuS
c8010fdf42
Fixed crash on garbage code ( #8307 )
2018-01-07 13:11:56 +01:00
PKEuS
817f66d74d
Fixed crash on garbage code ( #8317 )
2018-01-07 12:52:28 +01:00
Matthias Krüger
eb58df236e
CheckOther::accessMovedError() / accessMoved, accessForwarded warnings: put variable name into single quotes.
2018-01-07 10:57:19 +01:00
Daniel Marjamäki
83b87b54b4
Fixed #8191 (False positive iterators regression)
2018-01-06 22:25:13 +01:00
Daniel Marjamäki
61767d4932
Fixed #8125 (incorrect error iterators)
2018-01-06 16:08:12 +01:00
Daniel Marjamäki
98b45ffbc0
Fixed #8314 (TemplateSimplifer crash)
2018-01-06 15:16:03 +01:00
Daniel Marjamäki
943693acfb
TemplateSimplifier: Improved code for template aliases
2018-01-06 08:40:06 +01:00
Martin Ettl
53fbfc9fdb
test: Various micro optimizations: Replaced std::string() with std::string(). Use std::string::clear() instead of s = and prefer std::string::empty() instead of (s == ) for checking a string is empty.
2018-01-05 22:03:49 +01:00
Daniel Marjamäki
04c57381ea
Fixed #8315 (heap use after free: templatesimplifier)
2018-01-05 16:10:13 +01:00
Daniel Marjamäki
a95108ebe3
TemplateSimplifier: Fix incorrect recursion when template is reused inside itself
2018-01-03 23:05:57 +01:00
Daniel Marjamäki
255b788d4d
Fixed #4903 (Improve check: allocated but not initialized (condition))
2018-01-02 23:20:46 +01:00
Daniel Marjamäki
1af69bd0d4
Tokenizer::createLinks2: fix link for >>
2018-01-01 15:20:21 +01:00
Matthias Krüger
f2b2be2166
CheckInternal::checkRedundantTokCheck(): also catch patterns of the form if(!tok || !Token::Match(tok, "foo")).
2018-01-01 05:02:41 +01:00
Daniel Marjamäki
fa42a08a71
Make code less strict that looks for garbage template code. Before a template there might be unknown macros.
2017-12-31 16:25:41 +01:00
Daniel Marjamäki
7d2450e445
Fixed #1478 (false negative: buffer access out of bounds not detected after free and malloc)
2017-12-31 14:58:26 +01:00
Daniel Marjamäki
f6fcf01cc6
Fixed #7868 (TemplateSimplifier: template specialization fails)
2017-12-30 22:14:48 +01:00
Daniel Marjamäki
a8f73055ad
Templates: Fixed scope problem
2017-12-30 09:00:19 +01:00
Daniel Marjamäki
fc1ac180e6
Fixed #6218 (Template type aliasing misdetection)
2017-12-29 22:47:07 +01:00
Daniel Marjamäki
469cb7e6df
TemplateSimplifier: Fix instantiations when template parameter is a template
2017-12-26 22:34:39 +01:00
baltth
6cbd69bf2d
Fix define parsing from compile_command.json ( #1013 )
...
* Define value parsing from compile_commands.json
* Handle escaping in defined values
* Added test for importCompileCommands
* Added used defines for imported projects
* Fixed unnecessary string literals
2017-12-26 13:04:27 +01:00
Daniel Marjamäki
2c69f2b226
TemplateSimplifier: Improved handling of scopes
2017-12-26 10:55:18 +01:00
Daniel Marjamäki
eaadfb3910
update debug token list output for templates.
2017-12-25 23:16:51 +01:00
Daniel Marjamäki
a80760cb6f
TemplateSimplifier: Fix in expandTemplate
2017-12-25 08:19:46 +01:00
Daniel Marjamäki
1eb2df34ad
Revert improved scope handling in TemplateSimplifier
2017-12-23 22:11:30 +01:00
Daniel Marjamäki
d237d36d46
TemplateSimplifier: Fix crash seen in Travis
2017-12-23 17:29:28 +01:00
Daniel Marjamäki
2d7fedbb49
Try to fix Travis
2017-12-23 15:41:32 +01:00
Daniel Marjamäki
91839c2534
Fixed #7987 (FP copyCtorAndEqOperator - class with a move constructor and move assignment operator)
2017-12-23 10:35:14 +01:00
Daniel Marjamäki
326765c632
TemplateSimplifier: Better handling of scopes
2017-12-23 08:20:24 +01:00
Daniel Marjamäki
9c17bddbd4
Tweak fix for ticket #8297
2017-12-17 22:27:05 +01:00
Daniel Marjamäki
1428759479
Fixed #8297 (Tokenizer:createLinks: 'X<sizeof(int)==1 || sizeof(int)==4>()')
2017-12-17 15:53:05 +01:00
Daniel Marjamäki
d292434e76
Try again to clarify warning message for new strcmp() checker
2017-12-13 15:28:50 +01:00
Daniel Marjamäki
3f36d4b5f4
try to clarify error message
2017-12-11 22:10:00 +01:00
versat
cc435c3e92
Add missing tests for strncpy
...
Add tests for verifying that the bufferoverrun tests are correct.
2017-12-11 10:25:59 +01:00
IOBYTE
026d8f6859
fix #8284 : False positive: "Label 'class' is not used." for anonymous… ( #1011 )
...
* fix #8284 : False positive: "Label 'class' is not used." for anonymous C++ class
Add support for annonymous derived structures and classes.
* Fix travis build (use findsimplematch).
* Fix bug in simplifyLabelsCaseDefault which was inserting ; in wrong place.
2017-12-05 16:50:04 +01:00
Simon Martin
1b14380007
Ticket #8175 : Fix bug in TemplateSimplifier::instantiateMatch with template parameters involving sizeof or namespace.
2017-12-02 19:18:36 +01:00
BNT
fd76abba16
also generate debug information when building for release. This makes ( #1003 )
...
debugging and profiling easier and has now drawback as long as the PDB
files are not distributed (which would blow up installers)
2017-11-29 08:31:30 +01:00
Daniel Marjamäki
43db6147d3
astyle formatting
...
[ci skip]
2017-11-27 23:32:20 +01:00
Daniel Marjamäki
f28d5e91ac
Fixed #8251 (Condition: bug when there are more than 2 strcmp() on same buffer (tricky))
2017-11-27 12:55:20 +01:00
Simon Martin
cbf0b13b3e
Ticket #8255 : Don't crash upon invalid code while checking conditions.
2017-11-25 08:22:39 +01:00
Dmitry-Me
4ac56a55be
Fix FN for signed short passed as %hx into printf
2017-11-21 22:17:02 +03:00
Dmitry-Me
c6bf881ee6
Fix FN for signed char passed as %hhx into printf
2017-11-21 22:14:48 +03:00
Dmitry-Me
5869f6d989
Fix FN for std::intmax_t passed as %ld, %lld into scanf
2017-11-20 23:07:37 +03:00
Dmitry-Me
7cf21f329a
Fix FN for size_t, uintmax_t passed as %lx and %llx into printf
2017-11-20 22:56:33 +03:00
Dmitry-Me
f0a7365f35
Fix FN for ptrdiff_t passed as %Ix into printf
2017-11-20 22:51:10 +03:00
Dmitry-Me
20eaf3fcca
Tests for intmax_t passed as %ld and %lld into scanf
2017-11-20 22:34:31 +03:00
Dmitry-Me
eb4bb893b3
Fix FP for std::intmax_t passed as %jd into scanf
2017-11-20 22:31:13 +03:00
Dmitry-Me
125daec71b
Tests for std::intmax_t passed as %ju and %jx into scanf
2017-11-20 22:14:00 +03:00
Dmitry-Me
c4b6db7e23
Fix FP for std::uintmax_t passed as %ju and %jx into scanf
2017-11-20 22:13:20 +03:00
Daniel Marjamäki
9191e6f112
Fixed #8246 (ValueFlow: known value, function pointer argument)
2017-11-17 23:04:54 +01:00
Dmitry-Me
cf05b722a9
Fix FN for intmax_t passed as %jx into printf
2017-11-18 00:00:02 +03:00
Dmitry-Me
73414ee56c
Fix FN for std::uintmax_t passed as %Lu and %Lx into scanf
2017-11-17 23:58:09 +03:00
Dmitry-Me
167258a6bf
Fix FNs when various types are passed as %tu into printf
2017-11-15 22:40:16 +03:00
Dmitry-Me
7f48283b98
Improve test coverage for %I64x used with scanf
2017-11-13 21:47:56 +03:00
Dmitry-Me
ee4831ca2b
Tests for %u, %x with various length specifiers used with printf
2017-11-13 21:46:26 +03:00
Daniel Marjamäki
b3c80947ed
Fixed #6508 (False positive unusedStructMember - brace initializer)
2017-11-12 22:33:17 +01:00
Daniel Marjamäki
526d8b76a6
Fixed #8271 (FP uninitMemberVar: Handle method call in middle of statement)
2017-11-11 21:28:24 +01:00
BNT
cc4c9032de
Support relative paths in Visual Studio projects properties ( #995 )
...
* transform relative paths with the help of the project dir to absolute
paths so the actual checker can resolve include paths defined in
property sheets
* fix coding style (one-line if)
* add existing importproject testfile to visual studio project to appear
when loading solution
* also explicitly export struct from within class to enable linking in
testrunner
2017-11-11 11:13:18 +01:00
Dmitry-Me
24aa6a858a
Tests for %u, %x with various length specifiers used with printf
2017-11-10 23:53:53 +03:00
Daniel Marjamäki
6b1a2dcc5d
Fixed #7788 (Varid missing for member variable in ctor of template class)
2017-11-10 21:03:15 +01:00
Daniel Marjamäki
799f953c00
Fixed #8269 (Tokenizer: wrong varid (using namespace A::B))
2017-11-09 23:15:16 +01:00
Daniel Marjamäki
2408f01cc0
Fixed #8270 (Tokenizer: wrong varid (using namespace std))
2017-11-09 22:08:58 +01:00
Dmitry-Me
432ea03f59
Expect warning for wrong argument sign
2017-11-09 19:07:41 +03:00
Daniel Marjamäki
b67cf0a475
Improved handling of varid in complex scopes
2017-11-09 15:58:08 +01:00
Daniel Marjamäki
ced3f4cde8
astyle formatting
...
[ci skip]
2017-11-09 15:57:03 +01:00
Dmitry-Me
94dd63f196
Fix FN for std::uintmax_t passed as %lx, %lu scanf read targets
2017-11-09 15:38:48 +03:00
Dmitry-Me
b301b44897
Fix FN for unsigned ptrdiff_t passed as %lu into scanf
2017-11-09 14:43:09 +03:00
Dmitry-Me
054444167d
Improve test coverage for %lx used with scanf
2017-11-09 14:15:02 +03:00
Dmitry-Me
78be821431
Fix FN for std::uintmax_t passed as %llx, %llu scanf read targets
2017-11-09 11:28:07 +03:00
Daniel Marjamäki
26b9e1528c
Fixed #7000 (Invalid varid - matching class with same name from other namespace)
2017-11-08 22:52:27 +01:00
Dmitry-Me
74c778c5f0
Fix FN when unsigned ptrdiff_t is passed as %llu into scanf
2017-11-09 00:26:07 +03:00
Dmitry-Me
703d86992d
Fix FN when size_t, uintmax_t are passed as %Lx into scanf
2017-11-08 23:52:49 +03:00
Dmitry-Me
c563917a5d
Improve test coverage for intmax_t, uintmax_t, intptr_t, uintptr_t used as scanf read targets
2017-11-08 18:13:45 +03:00
Dmitry-Me
89b83b2d16
Fix FN for unsigned ptrdiff_t passed as %Ix into scanf
2017-11-08 15:06:51 +03:00
Dmitry-Me
970aee9ce1
Fix FN for ptrdiff_t passed as %zd into scanf
2017-11-08 14:22:03 +03:00
Dmitry-Me
3d2f86cef7
Improve test coverage for %zd used with scanf
2017-11-08 13:43:10 +03:00
Dmitry-Me
4fcef2f0c7
Improve test coverage for %llu, %llx, %Lu, %lx used with scanf
2017-11-08 12:18:35 +03:00
Dmitry-Me
9d53b70a56
Improve test coverage for Iu, Ix used with scanf
2017-11-08 08:06:05 +03:00
Dmitry-Me
1985d75442
Improve test coverage for %llx, %Lx, %I64x used with scanf
2017-11-08 00:05:21 +03:00
Dmitry-Me
d31107451b
Improve test coverage for void* passed as scanf read target
2017-11-07 23:43:30 +03:00
Dmitry-Me
d4a1c0d8bd
Improve test coverage for %lu and %llu used with printf
2017-11-07 21:44:46 +03:00
Dmitry-Me
043a565f5d
Improve test coverage for %jx, %tx, %zx used with scanf
2017-11-07 00:27:47 +03:00
Dmitry-Me
95b37f665d
Improve test coverage for %lx, %hx, %hhx used with scanf
2017-11-06 23:13:48 +03:00
Dmitry-Me
4681c7e4cf
Improve test coverage for unsigned ptrdiff_t used as scanf read target
2017-11-06 22:04:59 +03:00
Dmitry-Me
41cffe40cf
Improve test coverage for ptrdiff_t used as scanf read target with %Id
2017-11-06 21:01:34 +03:00
Daniel Marjamäki
4a9984d73b
Fixed #8233 (FP uninitvar found in bash:lib/readline/display.c)
2017-11-06 10:28:07 +01:00
Daniel Marjamäki
8b384f8ee5
Fixed #4988 (Tokenizer::setVarId: Wrong varid for inline function parameter)
2017-11-05 22:25:46 +01:00
Daniel Marjamäki
324257ef52
Fixed #7823 (No varid for member variable of type std::bitset< static_cast<int>(2) >)
2017-11-05 17:59:34 +01:00
Daniel Marjamäki
511d14a051
astyle
...
[ci skip]
2017-11-05 17:56:24 +01:00
Daniel Marjamäki
4d8f069907
Renamed pro c sql to embedded sql
2017-11-03 21:04:12 +01:00
Daniel Marjamäki
4f6f1e20dd
Hide Pro*C SQL simplification. Use pro_c_sql.cfg library file if this is wanted.
2017-11-03 13:02:29 +01:00
Alexey Eryomenko
02461753f3
Fix for embedded PL/SQL blocks (Oracle Pro*C) ( #985 )
...
* fix for correct parsing of embedded PL/SQL blocks (Oracle Pro*C)
* enforce SQL block end at the end of nearest outer C block, when
appropriate terminator is not found
* added check for ; at the end of END-EXEC and made SQL block detection
more readable
2017-11-03 11:31:33 +01:00
orbitcowboy
5ba5ea3aaf
testsuite: Improved const correctness of arguments.
2017-10-30 10:57:03 +01:00
Dmitry-Me
3089352edb
Improve test coverage for %lld used with printf
2017-10-27 22:25:34 +03:00
Dmitry-Me
f653b36b87
Fix actual type reported for unsigned ptrdiff_t passed into scanf
2017-10-26 23:47:11 +03:00
Dmitry-Me
02e00a970b
Restore test coverage for "x" conversion used with scanf
2017-10-26 23:36:55 +03:00
Björge Dijkstra
94031ef11d
Fix for conditional memory allocation inside if-condition ( #986 )
...
* Add test cases for allocation inside if-condition
* Fix missed memory leak and false positive double free for allocation inside if-condition
2017-10-26 19:11:00 +02:00
Dmitry-Me
a38854451f
Warn for signed values passed as scanf targets with "x" conversion
2017-10-25 21:22:17 +03:00
Dmitry-Me
2b717c6c31
Improve test coverage for %zd used with scanf
2017-10-24 23:47:04 +03:00
Dmitry-Me
eaa12db761
scanf with %zd expects ssize_t, not ptrdiff_t
2017-10-24 22:01:23 +03:00
Dmitry-Me
709ee6e278
Revert "Initial test coverage for %zd used with scanf"
...
This reverts commit a260b5157a
.
2017-10-24 00:20:04 +03:00
Dmitry-Me
a748ced9da
Improve test coverage for %zx, %zu used with printf
2017-10-23 23:44:22 +03:00
Dmitry-Me
a260b5157a
Initial test coverage for %zd used with scanf
2017-10-23 23:42:29 +03:00
Dmitry-Me
481ab0f930
Tests for passing non-pointers as scanf read targets
2017-10-23 23:35:32 +03:00
Daniel Marjamäki
28cfee2d4f
Fixed #8250 (New check: Pointer calculation result cant be NULL unless there is overflow)
2017-10-22 14:32:54 +02:00
Daniel Marjamäki
4cb3548e2b
unsafeClassDivZero: change severity to style
2017-10-21 21:51:58 +02:00
Daniel Marjamäki
5de3c43209
changed id for new checker to unsafeClassDivZero
2017-10-21 21:45:04 +02:00
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
Daniel Marjamäki
32fe0aba41
Fixed #8037 (ValueFlow: global variable might be modified by function call)
2017-07-09 12:50:17 +02:00
Daniel Marjamäki
ac85b78e2a
Fixed #5619 (false positive: unusedVariable - array accessed by pointer variable only)
2017-07-09 11:19:00 +02:00
Daniel Marjamäki
7161daefbd
Fixed #8040 (False positive resourceLeak - handle assigned to class instead of scalar)
2017-07-08 22:28:31 +02:00
Daniel Marjamäki
6417be4a71
Fixed #8054 (Tokenizer::simplifyKnownVariables(): Wrong simplification for global variables)
2017-07-08 22:12:01 +02:00
Daniel Marjamäki
6b48781fdc
Fixed #7105 (False positive resourceLeak - socket handle wiped after close)
2017-07-07 21:51:48 +02:00
Daniel Marjamäki
d6f066482e
Fixed #6542 (FP: Variable 'lcount' is not assigned a value - using address of integer array)
2017-07-01 11:31:51 +02:00
Daniel Marjamäki
db01ea1408
Fixed #6261 (false positive: Variable used in ternary expression within function argument list)
2017-07-01 11:03:49 +02:00
Daniel Marjamäki
f847631cdb
Fixed #5273 (FP memleak: Unknown if() condition should make error inconclusive)
2017-06-30 23:05:09 +02:00
Daniel Marjamäki
b97f5d909e
Fixed #6570 (False positive unusedFunction - function called from within template function)
2017-06-30 14:34:28 +02:00
Daniel Marjamäki
22919da9a8
Fixed #6246 (Defect: False positive due to ignoring struct initialisation when nested in a loop and assigned to a member)
2017-06-30 13:41:19 +02:00
Daniel Marjamäki
f4dba4ad3d
testrunner: Remove TestPath::simplify_path as these tests has been moved to simplecpp
2017-06-23 20:32:00 +02:00
Daniel Marjamäki
1e12ec241c
reuse simplecpp::simplifyPath
2017-06-21 14:27:46 +02:00
Daniel Marjamäki
453058c059
AST: Better handling of C++11 initializer lists
2017-06-09 22:35:46 +02:00
Alexander Mai
d3e79b71b5
#8051 Add regression test. Issue got fixed before.
2017-06-08 19:22:01 +02:00
Daniel Marjamäki
fd74d455ce
AST: Better handling of case
2017-06-08 15:32:35 +02:00
Daniel Marjamäki
c1ea873e1c
TemplateSimplifier::simplifyCalculations: Add some more tests and make sure they pass
2017-06-08 08:15:05 +02:00
Daniel Marjamäki
cb48e63f92
TemplateSimplifier: Fixed bug in simplifyCalculations. Now template58 test case does not throw InternalError
2017-06-08 00:49:46 +02:00
Daniel Marjamäki
18abe4a142
Fixed #6021 (TemplateSimplifier::simplifyCalculations causes heap corruption on invalid code)
2017-06-07 19:32:56 +02:00
Daniel Marjamäki
0967700f4b
Refactoring tests
2017-06-06 08:59:18 +02:00
Stas Cymbalov
ff38cc5c13
Set struct size cutoff in passedByValue check to 2*sizeof_pointer
...
Struct arguments are either pushed to the stack or passed in the
registers. Since both methods operate on machine words it is logical to
tie the maximum size of a struct argument that doesn't trigger
passedByValue diagnostic to the size of the machine word.
Also guessed size of STL classes is set to 3*sizeof_pointer, this better
represents reality and ensures that structs containing them will still
trigger passedByValue.
2017-06-06 08:48:11 +02:00
Ayaz Salikhov
3dc4188292
Improve Python code
2017-06-05 13:23:00 +02:00
Ayaz Salikhov
2dd6168258
Improve Python code
2017-06-04 22:51:48 +02:00
Daniel Marjamäki
26bd863d0a
Fixed #7724 (hang: long expression => wrong AST)
2017-06-04 12:16:49 +02:00
Daniel Marjamäki
b8ee500d45
Fixed #7092 (Invalid style error: Variable not assigned a value)
2017-06-03 15:31:29 +02:00
Daniel Marjamäki
bbde3cc23a
Merge pull request #910 from mathbunnyru/asalikhov/improve_readability
...
improve readability
2017-06-03 14:33:21 +02:00
Daniel Marjamäki
b68c8d91ab
Fixed #8039 (Tokenizer: wrong simplification of string)
2017-06-01 22:21:02 +02:00
Daniel Marjamäki
bce0776417
Fixed #7795 (ValueFlow: Value is not known after conditional increment )
2017-06-01 15:16:07 +02:00
Ayaz Salikhov
3cd2f2d092
Don't cast bool to bool
2017-06-01 01:49:40 +03:00
Ville Skyttä
5ab158fec2
Spelling fixes
2017-05-30 08:03:15 +03:00
Steve Browne
b58562fc7d
Added test cases for catching when assignment comes after an operator, compound assignment, or comparison for ticket #7429 and fixed the tests.
2017-05-28 16:00:06 +02:00
Daniel Marjamäki
18adb97873
astyle formatting
...
[ci skip]
2017-05-28 15:56:26 +02:00
Daniel Marjamäki
be6e0cbf85
Tokenizer: I dont think its safe to calculate floating point equality comparisons, changing TODO assertion to normal assertion.
2017-05-28 12:34:29 +02:00
Frank Zingsheim
aa937e426d
Fixed #7849 (Tokenizer: Wrong simplification of floating point equality comparison)
2017-05-28 10:53:50 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
uburuntu
3817384223
FIX: test: parameter 'settings' is always rewritten
2017-05-27 04:17:18 +02:00
amai
45ba1ff1e3
#8079 SymbolDatabase::createSymbolDatabaseEnums() crashes on invalid enum declaration
2017-05-25 09:50:14 +02:00
Daniel Marjamäki
dda5556ded
Fixed #8034 (AST: better handling for c++ type initialization)
2017-05-24 20:24:56 +02:00
Daniel Marjamäki
5444875f89
Fixed #8034 (AST: better handling for c++ type initialization)
2017-05-24 20:18:31 +02:00
Daniel Marjamäki
099b4435c3
Fixed #8074 (Preprocessor::getConfigs: wrong configuration extracted 'A;B;;')
2017-05-24 11:16:41 +02:00
Daniel Marjamäki
93e0516291
Fixed #8009 (Tokenizer: fix handling of template rvalue references)
2017-05-23 18:55:17 +02:00
orbitcowboy
ffe6582e6b
Added platform support for Atmel AVR 8 bit microcontrollers.
2017-05-22 14:46:19 +02:00
Daniel Marjamäki
8ef9ab26b1
Clarify floatConversionOverflow
2017-05-22 11:04:24 +02:00
Daniel Marjamäki
0cb1c4f221
Clarify integerOverflow messages
2017-05-22 10:10:56 +02:00
Daniel Marjamäki
82a372a380
Try to clarify ErrorPath texts
2017-05-20 08:47:35 +02:00
Daniel Marjamäki
f92b16706c
ValueFlow: Add ErrorPath info after for loop
2017-05-19 16:32:58 +02:00
Daniel Marjamäki
2bb54fef69
ValueFlow: Test ErrorPath handling
2017-05-19 14:34:59 +02:00
Daniel Marjamäki
899615c1e4
update simplecpp includes
...
[ci skip]
2017-05-18 22:26:07 +02:00
Matthias Krüger
aa3f1db33c
Add internal check that checks for redundant non-nullness checks in Token::(simple)Match checks.
...
In code like
if (tok && Token::simpleMatch(tok, "bla")) {}
or
if (tok->previous() && Token::Match(tok->previous(), "foo")) {},
the first check is redundant because Token::(simple)Match already checks if the argument token is null.
2017-05-18 22:12:33 +02:00
Daniel Marjamäki
040d2f0012
Use simplecpp lexer in test cases
2017-05-18 21:52:31 +02:00
Daniel Marjamäki
d89baee1f6
teststring: remove invalid newlines from string literals
2017-05-18 21:50:45 +02:00
Daniel Marjamäki
469390504b
Remove wrong newlines in TestGarbage
2017-05-18 17:26:00 +02:00
Daniel Marjamäki
2980654671
Remove wrong newlines in TestIO
2017-05-18 17:23:26 +02:00
Daniel Marjamäki
1f4b84379d
Fix for #pragma asm
2017-05-17 21:58:46 +02:00
Daniel Marjamäki
67e3187653
Preprocessor: Refactor handling of #pragma asm
2017-05-17 10:25:37 +02:00
Daniel Marjamäki
8d75d1b920
Partial fix for #8028 (ValueFlow: Origin/callstack of value)
2017-05-15 20:05:11 +02:00
PKEuS
fb94ad21fa
Updated Visual Studio solution to VS2017.
2017-05-14 10:04:25 +02:00
Daniel Marjamäki
55cd69e290
alwaysTrueFalse: Dont warn when checking sizeof for some type. such condition might be platform dependent.
2017-05-13 19:07:24 +02:00
PKEuS
68d77b73da
SymbolDatabase: Fixed parsing of unnamed arguments, properly detect pointers ( #8052 )
2017-05-07 09:03:58 +02:00
PKEuS
28b8bc57a8
CheckVaarg::va_list_usage(): Bailout on "goto" ( #8043 )
2017-05-07 08:32:48 +02:00
PKEuS
b345c430fe
CheckStl::readingEmptyStlContainer(): Skip over lambdas ( #8055 )
2017-05-07 08:15:58 +02:00
Alexander Mai
c1cdcc158f
Run astyle. Fix some Doxygen issues
2017-05-06 11:57:02 +02:00
amai2012
3e11eb9dca
#8050 cppcheckError: 0xFFFFFFul -> 16777215ULU. Don't add a suffix 'U' if there is already a suffix present.
2017-05-05 14:47:58 +02:00
Daniel Marjamäki
a8a54bbfa8
Fixed #6028 (Improvement: False positive caused by C keywords in assembly comments)
2017-05-05 08:57:24 +02:00
Daniel Marjamäki
65297ce285
Fixed #7191 (false positive memleak on in-place new)
2017-05-04 19:39:57 +02:00
Alexander Mai
f54a6f085b
#7883 hang: CheckOther::checkFuncArgNamesDifferent() template code in .h. Activate language check for header files + Small refactoring
2017-05-03 20:36:26 +02:00
Alexander Mai
6db9c78fb6
Address some warnings on test code
2017-05-03 14:39:21 +02:00
U-SAMS\Alexander
a8e12a6f29
Fix&cheat to make config test pass on cygwin
2017-05-03 11:41:37 +02:00
Robert Reif
e2bfe1c0ec
Fixed #8044 : Crash below SymbolDatabase::setValueType
2017-05-01 14:12:50 -04:00
Matthias Krüger
cee0f724ff
Fixed #8018 : Tokenize::findGarbageCode: detect heads of for-loops with 1 or more than 2 semicolons as garbage code.
2017-05-01 18:28:26 +02:00
Daniel Marjamäki
8a08cc0796
Fixed #8029 (Tokenizer::simplifyCAlternativeTokens: dont simplify 'eb.and + 1')
2017-04-30 14:40:41 +02:00
Daniel Marjamäki
48f1d02355
astyle formatting
...
[ci skip]
2017-04-30 14:22:40 +02:00
Daniel Marjamäki
7fd04cd8d0
Updated Token::expressionString(), write '->' instead of '.'
2017-04-30 14:22:18 +02:00
Simon Martin
28960a8bba
Remove bailout and fix varid for template class member initialized in out-of-line constructor ( #8031 )
2017-04-30 08:59:47 +02:00
IOBYTE
8a668aa860
Add missing else that could cause an extra try scope to be added to the scope list ( #8025 )
...
Add an optional extended description…
2017-04-30 08:58:41 +02:00
Alexander Mai
14be611a7e
Correct configuration to allow NULL as 2nd argument to read/write. Whether it's a legal value depends on the 3rd argument
2017-04-29 17:57:16 +02:00
Daniel Marjamäki
980ca39fe2
valueFlowForward: better handling of sizeof() in rhs in assignments
2017-04-29 08:25:55 +02:00
Daniel Marjamäki
06102cb3d7
UninitVar: Don't warn for inconclusive values
2017-04-28 21:09:56 +02:00
Daniel Marjamäki
d9f72d5f8c
AST: Handle 'x = { [ID] = 1, .. }' when ID is unexpanded macro
2017-04-26 22:35:04 +02:00
Daniel Marjamäki
bdf16b1157
Tokenizer::simplifyComma: dont simplify comma in '=(struct s){...}'
2017-04-26 20:48:08 +02:00
Daniel Marjamäki
4175902e36
astyle formatting
...
[ci skip]
2017-04-26 18:42:34 +02:00
orbitcowboy
0b6c726439
posix.cfg: Do not allow the second parameter of read and write to be a NULL pointer.
2017-04-26 14:25:14 +02:00
Daniel Marjamäki
89532cf8b9
Fixed #7968 (valueFlowBeforeCondition: better handling of compound assignments)
2017-04-25 20:45:02 +02:00
Daniel Marjamäki
140e086206
Fixed #7738 (False positive deallocret - delete and return NULL pointer)
2017-04-24 22:05:16 +02:00
Daniel Marjamäki
37fd60e879
Fixed #7293 (Use of uninitialized pointer not detected (worked in 1.71))
2017-04-24 18:27:16 +02:00
Daniel Marjamäki
8a738eefab
fixed #7998 (uninitialized variable is not found when used with switch/case)
2017-04-23 18:05:14 +02:00
Daniel Marjamäki
101dc28afa
Refactoring: Moved checkMemset.. from CheckOther to CheckFunctions
2017-04-23 07:53:41 +02:00
Daniel Marjamäki
e72ec4282d
Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well)
2017-04-22 12:44:57 +02:00
Daniel Marjamäki
1039c710e4
Fixed #8017 (AST: wrong ast for extra comma 's={1,}')
2017-04-22 11:23:11 +02:00
Daniel Marjamäki
7140bae226
Merge pull request #894 from simartin/ticket_7964
...
Ticket #7964 : Don't crash on valid code using function pointers named strcpy or strcat in main()
2017-04-22 01:24:03 +02:00
Simon Martin
b526fd7c49
Ticket #7964 : Don't crash on valid code using function pointers named strcpy or strcat in main().
2017-04-21 23:36:10 +02:00
Daniel Marjamäki
43454936e7
Fixed #8014 (FP: Uninitialized variable 'f(1,{..});')
2017-04-21 22:33:27 +02:00
Robert Reif
78ad9825af
Add support for auto variables in regular for loop.
2017-04-21 15:25:02 -04:00
Daniel Marjamäki
e827119856
Fix testrunner InternalError
2017-04-21 21:02:46 +02:00
Daniel Marjamäki
902eb87a8a
Fixed #8016 (AST: wrong ast for 'x=(s){...};')
2017-04-21 17:44:11 +02:00
Daniel Marjamäki
eec8c77774
Merge pull request #892 from IOBYTE/master
...
Add support for auto variable initialized from function return type.
2017-04-20 22:17:23 +02:00
Daniel Marjamäki
f8e9071de1
CheckFunction: In the <valid> check handle possible/conditional/inconclusive values better
2017-04-20 22:14:54 +02:00
Robert Reif
0ff8e49b69
Add support for auto variable initialized from function return type.
2017-04-20 15:22:57 -04:00
Daniel Marjamäki
95dd16892b
Merge pull request #891 from IOBYTE/master
...
Fix #7963 : crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTra…
2017-04-20 20:51:40 +02:00
Daniel Marjamäki
1422487769
astyle formatting
...
[ci skip]
2017-04-20 17:43:28 +02:00
Robert Reif
69d18d9c29
Fix #7963 : crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTransformFeedback.cpp
2017-04-20 10:03:29 -04:00
Daniel Marjamäki
7a26e046a8
Fixed #8001 (AST: Wrong AST for lambda function with 'std::string const&' result type)
2017-04-18 21:21:30 +02:00
Daniel Marjamäki
efcf71a5dc
qt.cfg: attempt to fix cfg test
2017-04-18 19:26:54 +02:00
Daniel Marjamäki
296f250caa
qt.cfg: configure some QString methods
2017-04-18 19:21:34 +02:00
Daniel Marjamäki
01c5c2fc5b
qt.cfg: Add reademptycontainer test
2017-04-18 18:47:35 +02:00
Daniel Marjamäki
c229754a70
qt.cfg: Add configuration for QString
2017-04-18 18:04:27 +02:00
Daniel Marjamäki
1a95dc9bd6
Fixed #7979 (Tokenizer: Detect and reject c++ code in .c file)
2017-04-17 22:15:29 +02:00
Daniel Marjamäki
bb015c6a2b
Fixed #8006 (AST: Wrong tree with complex for loops and casts)
2017-04-17 21:11:53 +02:00
Simon Martin
5fd686c878
Ticket #4544 : Also handle Foo<struct Bar> constructs.
2017-04-17 11:24:28 +02:00
PKEuS
b97779591e
Fixed unit test in testbufferoverrun.cpp
2017-04-11 23:00:33 +02:00
Daniel Marjamäki
41a64f6d1f
Fix crash
2017-04-11 20:16:33 +02:00
PKEuS
b1f4bd7504
Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set ( #7995 )
2017-04-11 11:49:26 +02:00
Daniel Marjamäki
632a6b664c
AST: Harden handling of C++11
2017-04-10 23:29:15 +02:00
Daniel Marjamäki
2c43075ece
AST: weird clang syntax
2017-04-10 23:05:41 +02:00
Daniel Marjamäki
df90ff9f5e
Merge pull request #888 from simartin/ticket_7942
...
Don't generate invalid syntax for out of line template class constructors during instantiation
2017-04-10 22:18:20 +02:00
Daniel Marjamäki
5e1b6aee8c
AST: Fix hang for weird VLA code
2017-04-10 22:17:34 +02:00
Daniel Marjamäki
ffeadbdde4
AST: improved handling for struct initialization 's = { [0] = 123 }'
2017-04-10 07:25:18 +02:00
Daniel Marjamäki
d92c529aa6
AST: Fix wrong handling of struct initialization, caused hang
2017-04-09 22:06:13 +02:00
Daniel Marjamäki
e6005dfa3c
AST: Fix AST for lambda '[&]{..}'
2017-04-09 17:49:55 +02:00
Matthias Krüger
494f64cb88
tests: fix some self-check findings about functions that can be static.
...
Was:
[test/testtype.cpp:223]: (performance, inconclusive) Technically the member function 'TestType::removeFloat' can be static.
[test/testsymboldatabase.cpp:61]: (performance, inconclusive) Technically the member function 'TestSymbolDatabase::getSymbolDB_inner' can be static.
[test/teststl.cpp:1437]: (performance, inconclusive) Technically the member function 'TestStl::getArraylength' can be static.
2017-04-09 17:28:00 +02:00
Simon Martin
ee05fe7d77
Ticket #7942 : Don't generate invalid syntax for out of line template class constructors during instantiation.
2017-04-09 16:12:59 +02:00
Daniel Marjamäki
8ffed6862d
Tokenizer: Add --check-config warning for macro with semicolon in argument
2017-04-07 19:19:10 +02:00
Daniel Marjamäki
7d8af7bdca
Fixed #7979 (crash (nr 2): CheckFunctions::checkIgnoredReturnValue())
2017-04-07 13:18:53 +02:00
Daniel Marjamäki
392a06a44b
AST: better handling of '(struct X){...}'
2017-04-06 21:28:13 +02:00
Daniel Marjamäki
50da7d4919
Tokenizer: Write syntax error if there is C++ code in C file.
2017-04-06 08:50:35 +02:00
Daniel Marjamäki
fd2651909c
Fixed #7978 (ValueType: container type not set properly)
2017-04-06 07:07:20 +02:00
Daniel Marjamäki
fee86b9684
ValueType: Better handling of 'new Container'
2017-04-05 22:05:29 +02:00
Daniel Marjamäki
e6ed08c4d8
Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression))
2017-04-05 11:00:02 +02:00
Daniel Marjamäki
9c5a136f04
Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>)
2017-04-03 21:48:22 +02:00
Daniel Marjamäki
abb43b6a81
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-04-02 19:44:33 +02:00
Daniel Marjamäki
92fe210217
tweaked TestSymbolDatabase test case for unknown type.
2017-04-02 15:38:06 +02:00
Daniel Marjamäki
d403a6a883
Preprocessor::getConfigs: Remove bad configurations when #error is seen
2017-04-02 12:15:53 +02:00
Daniel Marjamäki
7eb95aac2a
Preprocessor::getConfigs: Handle #error in '#if !A' better
2017-04-02 10:06:39 +02:00
Daniel Marjamäki
edd1c32e5b
Preprocessor::getConfigs: Better handling of ! in #if
2017-04-02 09:03:43 +02:00
Daniel Marjamäki
b7dcdc00d0
Fixed #7970 (ValueType: no types set below 'new std::string')
2017-04-01 22:22:37 +02:00
PKEuS
ea215c3b7b
Fixed false positives in CheckClass::checkConst() due to unmatched function overloads
...
Fixed function matching if constness mismatches
2017-04-01 10:19:32 +02:00
Daniel Marjamäki
164df2aa7b
Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..})
2017-03-31 09:41:38 +02:00
Daniel Marjamäki
8fe7ee1012
Fixed #7886 (ValueFlow: endless forloop 'for (i = 0, j = 0; i < sz && j < 9; i++)')
2017-03-30 22:02:36 +02:00
Daniel Marjamäki
2da3123db2
Fix ValueType. The '[' in variable declaration is not a dereference.
2017-03-30 11:01:29 +02:00
IOBYTE
7cae057615
Add missing varid or variable for member variables.
...
Add an optional extended description…
2017-03-30 10:07:58 +02:00
PKEuS
3c8f5b85ae
Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10%
2017-03-27 18:48:34 +02:00
PKEuS
2938278f00
Refactorization: Store minsizes in vector instead of list which has less overhead
2017-03-27 17:53:43 +02:00
PKEuS
680828788b
Fixed false negative in CheckBufferOverrun::checkInsecureCmdLineArgs(), removed redundant tests
2017-03-27 11:30:07 +02:00
PKEuS
171e1b8244
Fixed false negatives in CheckBufferOverrun::arrayIndexThenCheck()
2017-03-27 11:07:49 +02:00
Robert Reif
3dba1b1739
Tests for git pull request #882 .
2017-03-25 15:46:25 -04:00
Robert Reif
c96e8daebc
Don't change varid of member variables.
2017-03-25 10:59:35 -04:00
PKEuS
f4c0ab5dd5
SymbolDatabase: Match function overloads by using ValueType information by running a second pass of the function pointer assignment routine.
2017-03-24 12:19:29 +01:00
Alexander Alekseev
abba762d42
New check: checking for copy ctor and eq operator co-existence
2017-03-24 12:00:20 +01:00
Robert Reif
bc87e874e9
Add variable and type information for auto and auto variables in range based for loops of containers.
2017-03-23 20:14:49 -04:00
Robert Reif
7adfb6e0e4
Add variable and type information to tokens for C array range based for loops.
2017-03-23 19:48:20 -04:00
Robert Reif
f8dd6ee014
Fix test code so it compiles.
2017-03-23 19:16:15 -04:00
PKEuS
97fa9e9d1b
ValueFlow: Stop on inline assembly
2017-03-23 20:01:16 +01:00
PKEuS
9225bff31d
Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() ( #7794 )
2017-03-23 18:57:48 +01:00
PKEuS
996501a449
Fixed false positive #7953 : Support type conversion operators returning pointers
2017-03-23 18:12:46 +01:00
Daniel Marjamäki
c280bcedb4
Merge pull request #880 from IOBYTE/master
...
Update symbol database with new auto type and variable information for assignment to auto.
2017-03-23 08:51:06 +01:00
Robert Reif
662bc6f846
Add variable or type information to auto and auto variable tokens. Changing the auto variable type requires rerunning the variable pointer pass to correct the symbol database for the new type.
2017-03-22 22:09:40 -04:00
Daniel Marjamäki
865588950a
Preprocessor: quick fix for #7939
2017-03-22 10:53:21 +01:00
orbitcowboy
a7f1188151
Astyle run.
2017-03-21 14:22:28 +01:00
Simon Martin
fb2b29dc7d
Update TemplateSimplifier::getTemplateNamePosition to handle out-of-line template methods.
...
Add an optional extended description…
2017-03-19 20:44:20 +01:00
Daniel Marjamäki
c18fe8262b
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-03-19 07:26:11 +01:00
PKEuS
8a3fb4dd6c
SymbolDatabase: Fixed return type token detection for template member functions ( #7945 )
2017-03-16 20:47:24 +01:00
PKEuS
ca3e3b3cdb
Fixed false positive multiCondition when & is used in both conditions ( #7827 )
2017-03-15 19:37:14 +01:00
PKEuS
816106560a
More conservative check for non-commutative operator+ in isSameExpression() ( #7938 )
2017-03-15 19:17:40 +01:00
PKEuS
bcba27fbb9
SymbolDatabase: Removed unnecessary bailout in function matching for pointers in function overload matching
2017-03-15 18:45:33 +01:00
PKEuS
b27ba72fdd
SymbolDatabase: Support function overload matching for member variables ( #7932 )
2017-03-15 18:37:22 +01:00
PKEuS
92414b923a
Library: Support variadic functions which are not a formatstr-function
2017-03-14 17:41:34 +01:00
Daniel Marjamäki
263c3596d5
known conditions: dont warn about 0 or 1 conditions as those look intentional
2017-03-08 18:39:19 +01:00
PKEuS
0073a633b0
Refactorized test suite
2017-03-08 15:16:19 +01:00
PKEuS
a447d2c6a8
Refactorized testio.cpp
2017-03-08 14:24:14 +01:00
Daniel Marjamäki
8c707876ed
Tokenizer: Don't simplify '({..})' wrongly
2017-03-08 11:41:18 +01:00
PKEuS
00904ba32a
Fixed false negatives in CheckOther::checkPassByReference() when assignment operator is used.
2017-03-07 21:49:28 +01:00
Matthias Krüger
65846efb6b
test/cfg/std.cpp fix 'make checkcfg', std::vector needs to have <vector> #included
2017-03-06 16:59:17 +01:00
orbitcowboy
e3d879e43d
std.cfg: Improved support for some std::wstring functions.
2017-03-06 16:40:49 +01:00
Daniel Marjamäki
302bf925df
Remove test/cfg/std.cpp test that fails
2017-03-06 12:39:08 +01:00
Daniel Marjamäki
d535f17489
testing std::string and std::vector configuration a little
2017-03-05 22:23:45 +01:00
Daniel Marjamäki
5ea9519586
UseRetVal: Fix FN for methods
2017-03-05 22:23:16 +01:00
Simon Martin
43e4364675
Ticket #7912 : Properly preprocess files with decreasing line numbers, due to #line directives.
2017-03-05 16:46:43 +01:00
Daniel Marjamäki
f3c0461001
ValueType: handling scoped types in 'new ...'
2017-03-05 10:24:51 +01:00
Daniel Marjamäki
e0dd0a82ed
ValueType: refactor and improve handling of 'new ...'
2017-03-05 10:02:47 +01:00
Robert Reif
e02b2c4483
ValueType: handle new nothrow
2017-03-05 02:13:00 +01:00
Daniel Marjamäki
920398615d
ValueType: handle scoped types in parsedecl
2017-03-05 01:21:02 +01:00
Daniel Marjamäki
12fe4a8b3e
Fixed #7885 (ValueType: Wrong type for large hexvalue (platform=win32A))
2017-03-04 14:19:14 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Daniel Marjamäki
a8424bcb54
Test get/getline/read/readsome configuration in std.cfg
2017-03-04 08:56:37 +01:00
Daniel Marjamäki
f0c353abcb
TokenList: append 'U' if needed on hexvalues
2017-03-04 08:47:53 +01:00
Daniel Marjamäki
1c6c209353
Fixed #7890 (1.77 false positive from knownConditionTrueFalse with function-like macros)
2017-03-03 19:53:16 +01:00
Daniel Marjamäki
59c1c76a97
Fixed #7466 (Reference variable does not count side-effects (FP variableScope))
2017-03-03 19:07:00 +01:00
Daniel Marjamäki
b5f2fd3c55
Fixed #7738 (False positive deallocret - delete and return NULL pointer)
2017-03-03 18:36:06 +01:00
Daniel Marjamäki
d1c66edb03
ValueFlow: Known values in conditional code
2017-03-03 01:29:34 +01:00
Daniel Marjamäki
45c5860ca4
Fixed #7926 (Memory Leak with auto not detected)
2017-03-02 22:24:26 +01:00
Daniel Marjamäki
9dc219f1ba
CheckIO: Use ValueType more
2017-03-01 22:33:31 +01:00
Daniel Marjamäki
51b5f1c286
Fixed #7931 (crash: SymbolDatabase: Variable::setFlag)
2017-03-01 17:13:22 +01:00
Daniel Marjamäki
279425499e
Fixed #7930 (Improve check: Missing stlcstr warning for reference variable)
2017-03-01 02:03:08 +01:00
PKEuS
85768f1829
SymbolDatabase: Overload matching with boolean literals as argument and with arbitrary null-pointers
2017-02-28 22:43:47 +01:00
PKEuS
942644fde6
SymbolDatabase: Overload matching with character literals as argument
2017-02-28 22:08:41 +01:00
Daniel Marjamäki
841e0c2921
Fixed #7546 (Assignment to array element not detected if pointer addition is used)
2017-02-28 22:04:05 +01:00
Daniel Marjamäki
16c06e5714
Fixed #7588 (Opposite conditions in nested 'if' blocks lead to a dead code block.)
2017-02-28 18:46:28 +01:00
Daniel Marjamäki
beaf29c158
SymbolDatabase: Update some properties for auto variables
2017-02-27 23:04:25 +01:00
Daniel Marjamäki
994f6b684d
ValueType: initial handling of new
2017-02-27 20:57:28 +01:00
Daniel Marjamäki
7ecd5db8fb
ValueType: Handle auto in range for loop
2017-02-27 02:09:33 +01:00
Daniel Marjamäki
2da360eec5
ValueType: Handle 'auto *p = ..'
2017-02-26 22:43:10 +01:00
Matthias Krüger
1e5e32c4a2
testrunner: remove non-gcc-style output format
2017-02-26 21:39:06 +01:00
Daniel Marjamäki
dad455c0dd
ValueType: Handle 'auto'. First fix for #4345
2017-02-26 20:02:57 +01:00
Daniel Marjamäki
d840005f06
Fixed #7656 (stlcstr - false positive)
2017-02-26 17:25:32 +01:00
Daniel Marjamäki
f68fa72095
Fixed #7583 (Defect: False positive '(error) Reference to temporary returned')
2017-02-26 13:41:49 +01:00
PKEuS
c1d8fd7f13
SymbolDatabase: Better handling of pointers in findFunction(), supporting const pointers and std::string overloads
2017-02-26 11:36:04 +01:00
PKEuS
4a27376694
SymbolDatabase: Implement two-stage fallback mechanism for matching function overloads, increasing matching accuracy
2017-02-25 23:12:00 +01:00
Daniel Marjamäki
adc659f58b
Fixed #7897 (MathLib::toDoubleValue: Does not handle character literal)
2017-02-25 21:58:09 +01:00
Daniel Marjamäki
26fc7abfac
Fixed #7837 (Field dereference triggers format string type warning)
2017-02-25 18:22:14 +01:00
Daniel Marjamäki
55d7ab65b9
Fixed #7918 (::exit() not recognized as noreturn)
2017-02-25 12:12:39 +01:00
Daniel Marjamäki
99544069d1
CheckLeakAutoVar: better handling of noreturn functions. Partial fix for #7918 .
2017-02-25 11:36:48 +01:00
PKEuS
3f1e2b4270
More conservative fallback for function overload matching
2017-02-24 20:56:47 +01:00
PKEuS
4e28d40bf0
Fixed matching long long overload to function call f(0)
2017-02-24 20:33:52 +01:00
PKEuS
de86d40c97
Fixed handling of NULL and nullptr in CheckNullPointer
2017-02-24 19:44:28 +01:00
PKEuS
b08f99a082
Fixed false negative: nullpointer passed as std::string argument ( #7927 )
...
Refactorization: Removed dead code from CheckNullPointer::parseFunctionCall()
2017-02-24 19:10:34 +01:00
Daniel Marjamäki
a53f14da25
Fixed #7925 (False Positive identical condition)
2017-02-22 21:13:36 +01:00
Robert Reif
8e0f1ec788
Fixed #7909 (Crash in CheckMemoryLeakInClass)
2017-02-20 23:09:35 +01:00
Simon Martin
487f76cdd1
Ticket #7916 : Don't incorrectly simplify return statements involving template instantiations.
2017-02-18 21:14:50 +01:00
Daniel Marjamäki
774a8979a3
Fixed #7095 (False positive: (warning) Return value of function to_string() is not used.)
2017-02-12 16:50:45 +01:00
Daniel Marjamäki
7c800d6ed7
Fixed #7447 (FP: ignoredReturnValue on C++11 uniform initialization)
2017-02-12 16:33:28 +01:00
Simon Martin
0c0fe4605a
Ticket #7465 : Added test case highlighting the issue has been fixed since it's been reported.
2017-02-11 17:55:51 +01:00
Simon Martin
326d152aa2
Ticket #7914 : Properly recognize template parameters that contains operators. ( #870 )
2017-02-11 10:13:41 +01:00
Simon Martin
0943b2145b
Ticket #7891 : Do not remove spaces in the internal representation for template instantiations.
2017-02-05 17:35:29 +01:00
orbitcowboy
beb72c2583
Revert changes from 9cb0941df2
.
2017-02-02 15:53:52 +01:00
orbitcowboy
9cb0941df2
std.cfg: Take the return value from fread() into account.
2017-02-02 13:33:06 +01:00
Matthias Krüger
f80e888b7e
run astyle
...
[ci-skip]
2017-01-31 16:22:31 +01:00
Simon Martin
5262ed018e
Ticket #7440 : Function calls should not abort pointer alias analysis for local variables.
2017-01-27 22:56:28 +01:00
umanamente
a012e5b5fb
( Fixed #7846 ) Syntax error when using C++11 braced-initializer in function last argument
...
Add an optional extended description…
2017-01-23 12:50:36 +01:00
umanamente
0c1ba8e8b4
( Fixed #7895 ) C++11 brace initialization. Added test. ( #862 )
...
Add an optional extended description…
2017-01-22 10:16:40 +01:00
PKEuS
3022d74801
Do not suggest pass by reference for std::initializer_list
2017-01-19 11:14:55 +01:00
amai2012
722fac391d
Merge pull request #858 from simartin/ticket_7820
...
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-18 09:31:49 +01:00
Simon Martin
9e76b21d7f
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-17 23:02:39 +01:00
Simon Martin
ae939b1385
Teach CheckMemoryLeak about "alloc ; loop alloc ;" kinds of patterns. ( #861 )
...
Add an optional extended description…
2017-01-15 22:16:23 +01:00
Simon Martin
c82d8a0d06
Ticket #7745 : Simplify "alloc ; dealloc ;" blocks that we don't have any value for CheckMemoryLeak's analysis. ( #860 )
...
Add an optional extended description…
2017-01-15 22:14:37 +01:00
Daniel Marjamäki
47d39d0a14
Revert "Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))"
...
This reverts commit a762511067
.
2017-01-10 13:22:48 +01:00
Daniel Marjamäki
a762511067
Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))
2017-01-09 22:28:55 +01:00
Daniel Marjamäki
b1f7e46491
Fixed #7323 (valueflow: global variables)
2017-01-09 15:53:08 +01:00
Simon Martin
417c7e36c0
Ticket #7548 : Properly detect the end of template parameter default values during instantiation.
2017-01-08 09:38:29 +01:00
Matthias Krüger
d4dcef4a30
add testcase for #6011 (crash in libreoffice, failure to create AST for comparison) which I still had in some branch.
2017-01-08 02:36:21 +01:00
Matthias Krüger
064a4aa4cc
improve constness of functions as per cppchecks suggestions.
2017-01-07 14:31:03 +01:00
Simon Martin
bd92ddd386
Ticket #7850 : Properly handle C functions called "class".
2017-01-06 21:16:28 +01:00
Robert Reif
4123b457d7
Fixed #7441 (SymbolDatabase: No scope when function return type not specified)
2017-01-06 11:53:17 +01:00
Robert Reif
139071d88b
Fixed #7875 (New check: function declaration and definition argument names don't match)
2017-01-05 08:52:11 +01:00
Robert Reif
4c25e798b1
Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template)
2016-12-31 22:05:29 +01:00
Simon Martin
f43431408b
Ticket #7685 : Properly handle function calls as argument to a dealloc function. ( #853 )
...
Add an optional extended description…
2016-12-29 13:17:46 +01:00
Daniel Marjamäki
85ae3adeb2
Fixed #5144 (FP old memleak - tree structure)
2016-12-27 08:12:37 +01:00
Daniel Marjamäki
1b21767954
Fixed #5666 (False positive when modifiying std::string by pointer)
2016-12-26 17:13:35 +01:00
Daniel Marjamäki
770abcf453
Fixed #5398 (False positive: Scope of variable can be reduced does not account for other variables not reduceable)
2016-12-26 14:14:40 +01:00
Daniel Marjamäki
c8a450c9be
uninitvar: Fixed a FP seen in daca2
2016-12-25 22:43:29 +01:00
Matthias Krüger
ecc91ba914
fix a couple of issues in shell scripts found by codacy.
2016-12-25 00:43:47 +01:00
PKEuS
ea53bd22b7
Fixed false positive returnTempReference with operator++ ( #7874 )
2016-12-22 11:49:59 +01:00
Daniel Marjamäki
df6ae9f3b4
Fixed #7847 (Can't detect shift negative values when some op is executed)
2016-12-22 09:40:19 +01:00
Daniel Marjamäki
d79688c40b
Fixed #7822 (False positive for uninitialized variable if array type is used)
2016-12-21 23:11:11 +01:00
Daniel Marjamäki
28af5c0379
Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice.
2016-12-21 18:19:59 +01:00
Daniel Marjamäki
426d1b4196
Merge pull request #846 from simartin/ticket_7805
...
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Daniel Marjamäki
f40bdddbab
ValueFlow: Better handling when casting calculation result
2016-12-20 23:09:50 +01:00
Daniel Marjamäki
f0d91fb74b
Fixed #7869 (False positive: Array index out of bounds)
2016-12-20 22:01:19 +01:00
Daniel Marjamäki
44ccbdedec
ValueFlow: Improved value for cast
2016-12-20 21:37:25 +01:00
Daniel Marjamäki
606bb78297
ValueFlow: Better handling of casts
2016-12-20 19:32:21 +01:00
Daniel Marjamäki
e14e86c103
ValueFlow: only set values in conditional code in subfunctions when sure
2016-12-20 11:06:20 +01:00
Daniel Marjamäki
807b653739
ValueFlow: Fix FP in for loops when 2nd expression is 0
2016-12-20 07:54:38 +01:00
Daniel Marjamäki
f1ad7368f6
ValueFlow: bool values
2016-12-19 21:21:18 +01:00
Daniel Marjamäki
aaf19c1e4f
Fixed #7839 (Prefix increment triggers parameter modification warning)
2016-12-19 15:25:36 +01:00
Daniel Marjamäki
f5ad7482a8
CheckBufferOverrun: Skip warnings about array index out of bounds in unions. Theoretically, the array is at least as large as the biggest union member.
2016-12-18 22:10:30 +01:00
Daniel Marjamäki
4558701c08
varid: don't generate varid and symboldatabase variable for function call parameter
2016-12-18 20:16:38 +01:00
Daniel Marjamäki
17aaecbd6b
ValueFlow: Improved handling of sizeof
2016-12-18 14:03:48 +01:00
Daniel Marjamäki
461e5cc5c9
CheckBufferOverrun: Moved check from simplified to normal. This fixes a FP in asterisk.
2016-12-18 11:14:05 +01:00
Daniel Marjamäki
72e4bc9d88
ValueFlow: skip values that cause false assertion condition
2016-12-17 21:23:14 +01:00
Frank Zingsheim
cb5a5e6a25
Improve Fix #6180 (Access of moved variable still allowed until function is called)
2016-12-17 16:42:46 +01:00
Frank Zingsheim
9a871d33f7
Improve Fix #6180 ("reset" and "clear" clears the move status)
2016-12-17 16:39:30 +01:00
Frank Zingsheim
f4ab45f13b
Improve Fix #6180 (Do not warn about move if it is part of a reassignment of the variable)
2016-12-17 16:39:30 +01:00
Simon Martin
5119ae84b8
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-17 14:05:26 +01:00
Daniel Marjamäki
8cba02dc66
Readd test case I removed in b098d5fbd6
2016-12-11 21:24:12 +01:00
Daniel Marjamäki
31337dda27
ValueFlow: Better handling of && and || in for loop to avoid FP
2016-12-11 21:19:24 +01:00
Daniel Marjamäki
d4f2512421
Tokenizer::simplifyKnownVariables: Added bailout when pointer alias is simplified and loop is encountered
2016-12-11 19:12:23 +01:00
Frank Zingsheim
e0d4720e19
Fix #7829 (false-positive: knownConditionTrueFalse linked to virtual method)
...
Return values of virtual functions in valueflow are only possible values
since function might be overloaded.
2016-12-11 10:44:05 +01:00
Daniel Marjamäki
87abe1174f
floatConversionOverflow: Avoid warnings when 255.5 is converted to unsigned char etc.
2016-12-10 23:14:40 +01:00
Daniel Marjamäki
b098d5fbd6
ValueFlow: We need better handling of casts
2016-12-10 22:09:01 +01:00
PKEuS
120fe2e4d6
Fixed false positive: The function 'operatorstd::string' is never used. ( #7853 )
2016-12-08 13:54:54 +01:00
PKEuS
cfac3b457d
Several small refactorizations
2016-12-06 22:12:02 +01:00
Daniel Marjamäki
7fc9fbc746
synthetic: reduce controlflow testcases
2016-12-06 21:45:51 +01:00
PKEuS
40401534d7
Refactorized Library
2016-12-06 14:50:27 +01:00
PKEuS
2f6350a0d0
Refactorized Library
2016-12-06 14:09:28 +01:00
PKEuS
d665641a76
Refactorizations:
...
- use std::string::pop_back() and std::string::back()
- pass argument as const std::string&
- Moved iterator into for loop head
2016-12-05 14:50:01 +01:00
Daniel Marjamäki
5df8e7f50c
Fixed #7596 (ValueFlow: better handling for 'x*(1-x-1)')
2016-12-04 22:39:59 +01:00
Daniel Marjamäki
c12cb69cc2
ValueType: Handle function pointers
2016-12-04 16:02:50 +01:00
Daniel Marjamäki
9c69546d72
Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well)
2016-12-03 11:59:48 +01:00
orbitcowboy
8a45c3192b
There is not need to clear a string directly after its creation.
2016-11-30 10:39:14 +01:00
PKEuS
36d12d7866
SymbolDatabase: Function::retDef should not point at "static" or "extern"
2016-11-28 17:23:39 +01:00
Stefan Weil
57b57428c2
Fix some typos in comments (found by codespell)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki
b6cba4a55c
Fixed #7784 (Token: can't be both type and variable)
2016-11-26 22:39:47 +01:00
orbitcowboy
55ae961ac2
std.cfg and windows.cfg: Improved support for <use-retval/> for functions like ftell(), [f]get[w]c().
2016-11-26 21:31:15 +01:00
orbitcowboy
8a0f856e95
Fixed regression in test/cfg/std.c introduced by b0d09926fb
.
2016-11-26 21:14:31 +01:00
Matthias Krüger
213589ee68
ValueFlow: don't perform UB when a function returns shifts of/by negative values. Fixes #7814 .
2016-11-24 23:23:47 +01:00
Daniel Marjamäki
a61f4e9c94
Fixed #7831 (false-positive: terminateStrncpy)
2016-11-24 07:04:58 +01:00
Matthias Krüger
cf24ea5221
fix #7783 : false positive knownConditionTrueFalse on assert(0 && "message").
2016-11-23 21:54:38 +01:00
Daniel Marjamäki
e1a3c0955a
synthetic tests: Added run-clang.sh
2016-11-23 14:49:46 +01:00
Matthias Krüger
01e5f14bf8
CheckClass::virtualDestructorError and a variation of CheckNullPointer::nullPointerError would print inconclusive,warning messages altough no --enable=warning was given. Fix.
2016-11-23 00:13:09 +01:00
Daniel Marjamäki
0b3751520b
Add a check for float conversion overflows
2016-11-22 22:37:13 +01:00
Daniel Marjamäki
8870195794
Synthetic: Add run-lint.bat script
2016-11-22 19:25:05 +01:00
PKEuS
02d8f691f8
Fixed false positive: Do not show useInitializationList message for enums
2016-11-22 12:09:30 +01:00
Daniel Marjamäki
aff84daff3
synthetic tests: renamed functions
2016-11-22 11:37:15 +01:00
Daniel Marjamäki
d40f4e4a55
Fixed #7778 (valueFlowAfterAssign: alias)
2016-11-21 17:26:36 +01:00
Daniel Marjamäki
21364b4401
Refactoring fix for #7816
2016-11-21 13:54:59 +01:00
amai2012
933815ee54
#7816 Segmentation fault at Tokenizer::simplifyAttribute() for stand-alone void. Throw syntax error on incomplete code
2016-11-21 12:19:47 +01:00
Daniel Marjamäki
74fa69fe5e
Fixed #7821 (syntax error, first token is &)
2016-11-20 17:59:50 +01:00
Frank Zingsheim
c8ff96fe8f
Fixed #6180 (Usage of variable after std::move or std::forward)
2016-11-20 15:14:49 +01:00
PKEuS
e23dc5c1e2
Fixed wrong message shown if unused label appears directly after a switch() scope
2016-11-20 14:43:54 +01:00
Matthias Krüger
d3919b23fa
testrunner: testgarbage: test-function was not called, fix.
2016-11-20 14:36:36 +01:00
Daniel Marjamäki
5b377ea2e4
Fixed #7821 (segmentation fault, invalid last token)
2016-11-20 14:15:51 +01:00
Daniel Marjamäki
79fc332511
Fixed #7810 (SymbolDatabase: method with redundant scope info)
2016-11-17 22:45:50 +01:00
Daniel Marjamäki
e1e9eacccc
ValueFlow: Added float type
2016-11-13 22:59:56 +01:00
Daniel Marjamäki
7ebfb10edd
Fixed #7806 (ValueFlow: better handling of subfunction with early return)
2016-11-13 18:19:51 +01:00
Daniel Marjamäki
621c1e59c6
--project: handle SolutionDir and ProjectDir. This is a partial fix for #7791 . custom build macros are still not handled.
2016-11-11 16:22:14 +01:00
Daniel Marjamäki
b04f6fb359
bump simplecpp to rev d1c995c03515d289c7aa7246a74d666fd012c4eb
2016-11-10 20:04:05 +01:00
Daniel Marjamäki
4de5dc75aa
Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.)
2016-11-07 22:29:40 +01:00
Daniel Marjamäki
684e78f54e
synthetic test: fix compiler errors
2016-11-07 09:30:17 +01:00
Daniel Marjamäki
ea087e6188
synthetic test: renamed tests. tweak report.
2016-11-07 08:48:38 +01:00
Daniel Marjamäki
ac7b351d1e
ValueFlow: Don't calculate x<<64 and x>>64
2016-11-06 20:40:58 +01:00
Daniel Marjamäki
dd69d5eabe
ValueFlow: Don't calculate result when there is UB
2016-11-06 17:42:01 +01:00
Alexander Mai
ee11f0974a
#7769 segmentation fault at setTokenValue() on invalid code.
2016-11-06 14:20:58 +01:00
Daniel Marjamäki
0ddd82d1d5
test/synthetic: added pointer alias test case. renamed functions.
2016-11-05 16:56:30 +01:00
Daniel Marjamäki
f280061ff8
signed int overflow: warn about intmax+1
2016-11-05 09:29:52 +01:00
Daniel Marjamäki
2885a75ea6
ValueFlow: handle ~ in setTokenValue
2016-11-05 09:29:22 +01:00
Daniel Marjamäki
40bf269ea0
Add report.py that generates report for synthetic tests
2016-11-04 22:16:46 +01:00
Daniel Marjamäki
f5046959b3
minor updates in synthetic tests
2016-11-04 22:15:41 +01:00
Daniel Marjamäki
8e8194ee0f
try to make synthetic tests more explicit
2016-11-04 19:32:42 +01:00
orbitcowboy
919f8ac323
Fixed typos. There are no real changes.
2016-11-04 15:01:05 +01:00
orbitcowboy
ed453d24da
std.cfg: Added returnValue support for iswdigit().
2016-11-04 14:20:59 +01:00
orbitcowboy
75124317e9
std.cfg: Added returnValue support for iswblank().
2016-11-04 14:03:48 +01:00
Daniel Marjamäki
469ca6af1b
Add synthetic ub tests
2016-11-03 21:45:33 +01:00
Daniel Marjamäki
6e9346323c
tweak synthetic tests
2016-11-03 20:16:49 +01:00
Daniel Marjamäki
506d1ed68d
synthetic tests: add ub.c
2016-11-03 14:51:18 +01:00
Daniel Marjamäki
0836b999cf
update synthetic tests. removed uninit.c because there was not enough diversity. my goal is to have few tests with much diversity.
2016-11-03 09:40:22 +01:00
Matthias Krüger
c6c17c89c9
synthetic tests: add "make clean", make CC settable via env flags.
2016-11-02 19:02:10 +01:00
Daniel Marjamäki
ad6c82b2ca
Added Makefile to compile synthetic tests
2016-11-02 13:57:29 +01:00
Daniel Marjamäki
50d6a23f93
test/synthetic/uninit.c : add more tests
2016-11-02 12:35:08 +01:00
Daniel Marjamäki
ca19861aaa
Add some synthetic tests
2016-11-02 11:07:04 +01:00
Daniel Marjamäki
18f466a880
Test std::for_each
2016-11-02 10:01:56 +01:00
Daniel Marjamäki
fd67bbf2d3
Test std::count and std::count_if
2016-11-02 09:57:35 +01:00
Daniel Marjamäki
12319d705e
Try to fix 'make checkcfg'
2016-11-02 09:50:37 +01:00
Daniel Marjamäki
b90a17f64f
Test std::all_of, std::any_of, std::none_of
2016-11-02 09:29:15 +01:00
Daniel Marjamäki
6e762659c0
Test std::find_if and std::find_if_not
2016-11-02 09:13:54 +01:00
Daniel Marjamäki
223ce04986
Merge pull request #841 from zingsheim/FunctionParameter
...
Function parameter
2016-11-01 21:58:52 +01:00
Daniel Marjamäki
0e9810b7f6
CheckStl: validation of iterators returned from functions
2016-11-01 14:08:42 +01:00
Frank Zingsheim
d4f01583b6
Fixed TODO (check if function parameter is non-const reference etc..) by common function
2016-11-01 14:06:30 +01:00
Daniel Marjamäki
476789c1a7
Remove unused variable in test
2016-11-01 12:44:31 +01:00
Daniel Marjamäki
7f71ad8360
Test std::find()
2016-11-01 12:25:23 +01:00
Daniel Marjamäki
ea545e63c8
astyle formatting
...
[ci skip]
2016-10-27 17:11:32 +02:00
Daniel Marjamäki
f6a5f6bb61
CheckStl::mismatchingContainers: Refactoring, use Library instead of hardcoding
2016-10-27 10:25:45 +02:00
Harald Scheidl
0de47f709e
Fixed #7755 (false positive: member variable is not initialized in the constructor)
2016-10-26 10:39:53 +02:00
Robert Reif
4216b26b8c
Fixed #7775 (crash at valueFlowSetConstantValue)
2016-10-26 10:36:02 +02:00
Frank Zingsheim
0162f76c63
TestIO: Refactoring. Use functions instead of macros.
2016-10-24 21:43:58 +02:00
Robert Reif
f25d205999
Fixed #7767 (SymbolDatabase: function not analysed when unknown macros are in front of function definition)
2016-10-22 22:29:18 +02:00
Daniel Marjamäki
8a0f3009ff
ValueFlow: inner and outer function return values
2016-10-22 17:22:57 +02:00
Daniel Marjamäki
77cd6c194f
ValueFlow: Set 'known' property for function return values
2016-10-22 12:24:15 +02:00
Daniel Marjamäki
213f9c1fc8
Fix testrunner
2016-10-21 02:20:51 +02:00
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
7242e661ef
checkcfg: add missing inline suppression for ignoredReturnValue of abs()
2016-10-18 22:35:54 +02:00
Matthias Krüger
0b6db67de2
checkcfg: add missing inline suppression for ignoredReturnValue of abs()
2016-10-18 22:20:06 +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
orbitcowboy
d5a145f288
std.cfg: Added <returnValue> information to isblank().
2016-10-18 11:00:12 +02:00
Daniel Marjamäki
4587dfffd8
Fix -Wshadow warnings
2016-10-17 15:45:16 +02:00
Daniel Marjamäki
57c5e0be3a
test that abs,isdigit,strlen are calculated properly
2016-10-17 14:16:08 +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
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
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
54959d1932
CheckLeakAutoVar: Distinguish between new and new[] ( #888 )
2016-10-09 10:28:19 +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
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
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
91d97c556d
Path: Add methods Path::isAbsolute() and Path::getCurrentPath()
2016-10-02 12:06:55 +02:00
Simon Martin
d3c6fb4ccf
Ticket #7557 : Test case added since the fix for #7541 also fixed this.
2016-10-01 21:21:07 +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
Simon Martin
dc61b6342d
Ticket #7068 : Treat "memset(&this->member, ..." as member initialization.
2016-10-01 13:46:58 +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
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
Daniel Marjamäki
9417425829
Fix testrunner
2016-08-29 04:26:27 +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
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
Matthias Krüger
56525cba60
testinternal: add testcase for TP warning for "previous()->next()"
2016-08-25 16:09:06 +02:00
Robert Reif
6043a27065
Fixed #7710 (%h and %hh printf type size specifiers not supported)
2016-08-24 12:47:11 +02:00
Robert Reif
28e14f0b94
Fixed #7711 (QString::asprintf format string checking.)
2016-08-24 12:44:57 +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
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
PKEuS
e0838ff194
Fixed crash on garbage code ( #7699 )
2016-08-21 11:06:48 +02:00
Daniel Marjamäki
d982dc5ffe
TestPreprocessor: Refactoring
2016-08-21 08:06:20 +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
Robert Reif
4d157af61f
Fixed #7704 (QString::sprintf format string checking)
2016-08-20 08:47:52 +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
497b3c38e2
astyle formatting
...
[ci skip]
2016-08-19 17:34:30 +02:00
Daniel Marjamäki
e7c1e8b82e
TestLibrary: Added tests for method calls
2016-08-19 10:47:44 +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
1f98af654a
ValueFlow: better handling of ? when condition result is known
2016-08-15 14:19:35 +02:00
Daniel Marjamäki
62362cd06d
ValueFlow: improve handling of unary minus
2016-08-14 22:19:06 +02: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
606e31602c
Fixed #7177 (Support compile_commands.json)
2016-08-13 10:50:03 +02:00
Daniel Marjamäki
5cc4e1118c
Added TODO testcases for Path::simplifyPath()
2016-08-09 22:59:36 +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
Bartlomiej Grzeskowiak
09a83f2cc8
Fixed #7567 ("(a | 7) > 6U" is always true)
2016-08-07 16:58:39 +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
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
cbfeae0ff7
bump simplecpp
2016-08-04 22:53:10 +02: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
Daniel Marjamäki
9711064b74
Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop)
2016-08-04 14:39:54 +02:00
Daniel Marjamäki
fe3abd678f
Revert "Fix potential null pointer dereference"
...
This reverts commit 6ca76ff965
.
2016-08-04 10:40:07 +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
6ca76ff965
Fix potential null pointer dereference
...
This was CID 1360399
2016-08-03 18:44:15 +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
5e78dae143
Use TODO_ASSERT_EQUALS instead of TODO comments
2016-08-02 19:38:36 +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
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
864cef2fd2
astyle formatting
...
[ci skip]
2016-08-02 09:03:03 +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
Daniel Marjamäki
09b6568ea2
Fixed #7646 (podtypes do not get proper valuetype)
2016-07-31 19:47:34 +02:00
Daniel Marjamäki
d89a646ed9
TestPreprocessor refactorings
2016-07-30 20:22:07 +02: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
PKEuS
92e3e802fb
Attempt to fix travis build and testrunner failure
2016-07-28 20:59:09 +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
PKEuS
3f4fe8f578
Refactorized CheckBufferOverrun:
...
- Removed redundant code
- Apply non-simplified checking in test suite
2016-07-27 17:28:43 +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
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
PKEuS
5c92c231b8
windows.cfg: SendMessage must not be <leak-ignore/>
2016-07-26 11:57:46 +02:00
Daniel Marjamäki
9082c097c8
Fixed testing of #7615 . The code is not garbage so move it from TestGarbage to TestSymbolDatabase
2016-07-26 09:10:10 +02:00
Daniel Marjamäki
fd19ab4ed1
fix garbage code handling
2016-07-26 08:50:00 +02:00
Matthias Krüger
6fd8edd6e5
Symboldatabase::sizeOfType: fix crash; fixes #7615
2016-07-26 01:18:47 +02: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
e9fef003ac
Preprocessor: refactoring directives, they are now only set once for each file
2016-07-24 14:02:21 +02:00
PKEuS
2e2800f5bd
Fixed several MSVC warnings
2016-07-24 12:36:36 +02:00
Daniel Marjamäki
ed4a47de45
Tokenizer: Improve syntax checking of switch,if,while
2016-07-22 16:54:24 +02: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
Dmitry-Me
0aac71efd1
Unify and simplify addresses computation
2016-07-21 15:48:48 +03:00
Daniel Marjamäki
f50f024873
Revert "Resolve CID 1357639"
...
This reverts commit e3b0c3a974
.
It's not a proper fix. I want that Cppcheck detects this bug also. I want to keep the CID open until Cppcheck can detect it.
2016-07-21 09:52:51 +02:00
Dmitry-Me
e3b0c3a974
Resolve CID 1357639
2016-07-21 10:34:07 +03: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
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
Daniel Marjamäki
4cc4ebd5cd
Travis: run slow unit test on travis that is too slow to run on development machines
2016-07-19 17:10:49 +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
ca929f0f1b
Try to fix #7608 (Assertion failed in test/testvarid.cpp at line 1988)
2016-07-19 11:59:37 +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
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
72ead10d93
cleanup tests
2016-07-18 10:52:38 +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
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
Daniel Marjamäki
6e3d5dc0d1
Fixed #7580 (False positive when using logical operator keywords 'and', 'or')
2016-07-16 20:21:31 +02: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
PKEuS
f869f7ebde
Fixed false positive reademptycontainer when end() is called ( #7560 )
2016-07-10 10:48:21 +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
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
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
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
3916cd628e
windows.cfg: Fixed configuration of _tfopen_s/_wfopen_s (
2016-06-02 09:41:01 +02:00
PKEuS
9a61559eca
Fixed false positive va_list_usedBeforeStarted ( #7527 )
2016-06-02 09:32:45 +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
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
be755af762
Removed todo testcase for #5783
2016-05-26 18:47:36 +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
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
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
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
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
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
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
Alexander Mai
d492500f34
#5844 False positive: returnReference fp for inner lambda function
2016-05-20 23:46:56 +02:00
orbitcowboy
b1b0c920e3
Removed sprintf_s from windows.cfg.
2016-05-19 08:22:40 +02:00
orbitcowboy
46adf180d7
cfg: Added support for fopen_s and sprintf_s functions. Fixed a wrong tests.
2016-05-18 09:31:26 +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
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
Alexander Mai
4816394511
#5970 false positive in Uninitialized variable: d - casting struct var to char*. It got fixed since 1.72, add regression test
2016-05-14 22:36:54 +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
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
Kamil Dudka
efe98883ab
checkleakautovar: do not miss 'throw' followed by ::
2016-05-13 21:37:49 +02:00
Daniel Marjamäki
df6a66deed
SymbolDatabase: Add test that makes sure enum constant values are calculated properly. Related with ticket #7493 .
2016-05-12 12:07:40 +02:00
Daniel Marjamäki
613311cc57
Fixed #7493 (enumMismatch on Enum declaration)
2016-05-12 11:46:08 +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
a167a2d242
TestSymbolDatabase: Add some tests for the new enum handling
2016-05-09 18:34:24 +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
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
b26dd1ccab
ValueFlow: Handle enums
2016-05-07 20:18:07 +02:00
Daniel Marjamäki
be90080976
Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum)
2016-05-07 19:51:37 +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
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
amai2012
a54ec615f3
Run astyle
2016-04-25 11:12:35 +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
PKEuS
949f1379c2
Reverted accidential changes to testrunner.vcxproj
2016-04-22 16:52:32 +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
dc2a92263a
Fixed #7426 (RFC: time to replace simplifyEnum?)
2016-04-22 06:02:54 +02:00
Bartlomiej Grzeskowiak
7e020e1d92
- fix for #7428 false negative: Statement is always false
2016-04-14 14:50:08 +02:00
Matthias Krüger
b42feb7b88
fix testrunner (sample was not updated in f5e8a72dc2
).
2016-04-08 12:09:16 +02:00
amai2012
9f4d4bdde7
#6167 Refactoring: rename test functions. Rename TestTokenizer::removeCast*. TestTokenizer::varid* doesn't exist (anymore?).
2016-03-27 17:36:07 +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
amai2012
9700dfead0
Testcase succeeds on Win32-VC-32bit, only 64bit needs to be fixed.
2016-03-01 22:32:27 +01: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
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
1c5eaf8cf9
TestSimplifyTemplate: fix syntax /classname/class/
2016-02-14 13:32:58 +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
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
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
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
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
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
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
PKEuS
cc8c498ebb
Moved a few tests to testgarbage.cpp
2016-02-04 09:10:20 +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
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
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
Alexander Mai
468a130447
Fix compiler warnings introduced by refactoring
2016-02-02 09:18:58 +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
988918c9bc
ValueType: Use signed as default sign for short/int/long/longlong
2016-01-31 14:34:26 +01:00
Daniel Marjamäki
e660c55d39
TestIO: Refactoring macros
2016-01-31 13:49:17 +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
Dmitry-Me
cdf68353ae
Merge pull request #769 from Dmitry-Me/testNoWarningWhenCharIndexInRange
...
Test for signed char index in positive values range
2016-01-31 13:43:18 +03: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
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
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
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
Matthias Krüger
112b35a49e
testrunner: add testcode for #6781 (TemplateSimplifier::simplifyTemplateInstantiations causes heap corruption on invalid code)
2016-01-30 18:20:45 +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
Dmitry-Me
c74282c258
Test for signed char index in positive values range
2016-01-29 11:09:25 +03: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
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
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
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
79aec559d5
Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause)
2016-01-18 16:10:51 +01:00
Daniel Marjamäki
b9a4a950a2
Fixed #7144 (Tokenizer::isScopeNoReturn: handling '{ { throw new string(..); } }')
2016-01-18 15:39:20 +01:00
Daniel Marjamäki
d656e3a056
Fixed #7103 (isReturnScope: handling 'return (bstr){0};')
2016-01-17 12:38:49 +01:00
Daniel Marjamäki
d54f4f9c65
Fix TestAstUtils
2016-01-16 19:08:51 +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
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
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
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
Alexander Mai
161412dc31
Correct posix.cfg to avoid false positives. Fix runtests.sh
2016-01-15 00:11:48 +01:00
Daniel Marjamäki
5214406771
Try to readd refactorings in testio.
2016-01-14 09:00:03 +01:00
Daniel Marjamäki
8e2f7812fd
CheckString: Fix FP when macros are used.
2016-01-13 20:32:40 +01:00
Daniel Marjamäki
9c8ff5b89c
TestIO: Use std::strcmp() to compare strings instead of std::string()
2016-01-13 19:04:30 +01:00
Daniel Marjamäki
dd3dd397b5
try to fix travis and appveyor by reverting my changes
2016-01-13 18:31:57 +01:00
Daniel Marjamäki
a6ac22f735
Attempt to fix travis and appveyor
2016-01-13 16:39:09 +01:00
Daniel Marjamäki
075c479bff
TestIO: Refactoring, split up test cases
2016-01-13 11:34:37 +01:00
Daniel Marjamäki
647f3fc619
Refactoring TestIO
2016-01-13 10:13:24 +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
610326e37f
Refactoring TestIO macros
2016-01-12 20:03:42 +01:00
Daniel Marjamäki
4f958bd2ca
Refactor TestIO, split test case
2016-01-12 19:23:37 +01:00
Daniel Marjamäki
14670f743e
Refactor TestIO, split test cases
2016-01-12 16:43:27 +01:00
Daniel Marjamäki
89b23bb698
Refactor TestIO, split test case
2016-01-12 15:06:42 +01:00
Daniel Marjamäki
5079b6d95e
TestIO refactoring, split test case
2016-01-12 15:01:32 +01:00
Daniel Marjamäki
dbf620aa8c
TestIO refactoring, split test case
2016-01-12 14:41:03 +01:00
Daniel Marjamäki
0226ee5ef3
TestIO: Splitting up test case
2016-01-12 13:06:42 +01:00
Daniel Marjamäki
8e79e5c1d3
Fixed #7147 (TemplateSimplifier: specialized template class with inheritance)
2016-01-11 18:45:12 +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
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
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
0b9d8ae0f1
astyle formatting
...
[ci skip]
2016-01-08 15:24:05 +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
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
58e28cb00e
ValueType: Better handling of unsigned unknown types
2016-01-05 19:47:11 +01:00
Daniel Marjamäki
a0971355b7
Tweaked Tokenizer::simplifyAsm2()
2016-01-04 19:18:10 +01:00
Daniel Marjamäki
f1d3d5b47d
TestTokenizer::simplifyAsm2: replace invalid example code with valid code
2016-01-04 10:50:52 +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
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
Alexander Mai
1d3e39df7e
Adjust message text for signConversion for constant negative epxressions
2016-01-02 22:56:15 +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
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
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
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
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
Matthias Krüger
7c1a4da6a4
testrunner: add testcase for #7246 .
2015-12-31 14:17:52 +01:00
Daniel Marjamäki
9f6890512c
Refactoring CheckType checkers. Use ValueType.
2015-12-31 12:05:23 +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
5216f904e7
Refactoring Check64BitPortability. Use ValueType.
2015-12-30 19:59:23 +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
25a5ac1846
Split up TestOther::testEvaluationOrder()
2015-12-28 14:04:14 +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
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
293bd2eead
Fixed #6990 (false negative: Invalid abs() argument nr 1. A non-boolean value is required.)
2015-12-26 01:38:41 +01:00
Daniel Marjamäki
64494ca226
astyle formatting
...
[ci skip]
2015-12-26 01:37:21 +01:00
Alexander Mai
87767fb666
#7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead
2015-12-26 00:21:56 +01:00
Daniel Marjamäki
ab6809f3fa
Fixed testrunner
2015-12-25 19:01:32 +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
07b929e13f
Added TODO test case for unknown evaluation order
2015-12-25 17:48:15 +01:00
Daniel Marjamäki
90a54b1fae
Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );)
2015-12-25 16:45:11 +01:00
Daniel Marjamäki
81f0597316
Fixed #3206 and #7226 (New check: Undefined execution order)
2015-12-24 09:13:20 +01:00
PKEuS
8f641aaa76
Added gets_s() to std.cfg (C11), added <use-retval/> to min/max().
2015-12-18 18:09:07 +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
Matthias Krüger
158238ad4b
add testcase for #7179 (see bebf8cc
)
2015-12-17 14:08:24 +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
orbitcowboy
ad17a0d721
testsymboldatabase: Improved constness of local variable.
2015-12-15 13:29:58 +01:00
orbitcowboy
d93f2994d4
testsymboldatabase: Removed useless call of GetSymbolDatabase.
2015-12-15 13:11:20 +01:00
Daniel Marjamäki
0baad496f2
Fixed #6383 (FP shiftNegative - value converted to unsigned in function argument)
2015-12-14 10:55:23 +01:00
Pavel Bibergal
e4dc97c81c
faster recursive file collection on huge codebases (posix systems), was 47sec to collect all files, now its only 3
2015-12-13 15:21:01 +02: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
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
Daniel Marjamäki
392cda8bce
Remove qmake pro files. qmake is just for cppcheck-gui nowadays.
2015-12-11 15:20:57 +01:00
Akhilesh Nema
932f6ea81b
Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode)
2015-12-09 14:00:40 +01: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
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
Matthias Krüger
246147c6e6
TestClass::memsetOnClass(): remove duplicate ASSERT_EQUALS() call.
2015-12-05 18:31:33 +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
Dmitry-Me
8f8a0097fe
Detect more non-interlocked accesses
2015-12-02 10:58:57 +03:00
Daniel Marjamäki
508b06abaa
Fixed #6973 (ValueFlow: dont set possible tokvalues in unreachable code)
2015-12-01 07:49:19 +01:00
Matthias Krüger
9a42f52915
testpath: add another explicit test for './././././test.cpp' being the same as 'test.cpp'
2015-11-30 22:04:24 +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
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
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
Alexander Mai
f4aaa76639
Fix compile error with clang
2015-11-28 16:50:12 +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
Alexander Mai
174317429f
Reduce number of threads TestThreadExecutor::many_threads a bit. Especially runs with dynamic analysis tools (asan/ubsan/etc.) cause very high system load.
2015-11-28 12:04:03 +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
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
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
1d7fac3ca9
Added testrunner test to cmake. #7098
2015-11-26 21:01:07 +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
Daniel Marjamäki
2737f63f71
Wrong calculation of constants (simplifying: +,<<,% operations)
2015-11-25 16:46:39 +01:00
orbitcowboy
f84af529af
Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects.
2015-11-25 11:02:32 +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
e8182395f7
Fix 'make checkcfg' by adding inline suppressions when obsolete functions are used.
2015-11-22 17:52:47 +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
8db72994fb
make checkcfg / runtests.sh: be verbose (set -x)
2015-11-22 11:03:10 +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
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
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
Daniel Marjamäki
0022ce8075
Refactor handling of char constants
2015-11-20 10:10:38 +01:00
PKEuS
c5b21d12cf
Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg
2015-11-19 18:51:32 +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
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
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
04ecbba361
Fixed #7135 (ValueFlow: Wrong pointer alias set for 'p = &p[x];')
2015-11-15 23:38:23 +01:00
Alexander Mai
435a980ce2
Convert wrong test result for #7133 to TODO_ASSERT_EQUALS and add more test cases
2015-11-15 20:14:20 +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
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
Daniel Marjamäki
c10a10c26f
CheckAutoVariables: use ValueFlow to detect more errors when pointer aliases are used
2015-11-15 12:10:35 +01:00
Alexander Mai
835c234e18
#7131 crash: Tokenizer::setVarId()
2015-11-14 21:22:53 +01:00
Alexander Mai
af2ada9258
#6692 False positive: Hidden member variable - parent class with same name in different namespace. Add regression test for FP which got fixed in 1.70 already
2015-11-14 14:44:27 +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
Alexander Mai
869334acf5
#6554 False positive eraseDereference - erase in while() loop. Add regression test for bug fixed in 1.70
2015-11-10 19:03:35 +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
Daniel Marjamäki
459a4e0cbe
Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference)
2015-11-10 10:18:24 +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
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
ef5be435c7
Fixed #7113 (False positive arrayIndexOutOfBounds - using pointer alias with cast)
2015-11-08 17:21:32 +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
Alexander Mai
ab296fa93f
7111 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses
2015-11-08 13:45:55 +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
PKEuS
fdb596fa05
Do not set "pure" flag if function is declared as "= default" ( #7101 )
2015-11-07 22:21:50 +01:00
Matthias Krüger
dc823c65fa
testrunner: add testcase for crash which was fixed in previous 2 commits.
2015-11-07 20:48:52 +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
f7a7a8a95c
Fixed #6934 (False positive returnLocalVariable - assigning local array to function argument)
2015-11-07 15:07:26 +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
Alexander Mai
2554674f4b
Add regression test for previously fixed #6064 , and TODO test for #6081
2015-11-07 11:17:44 +01:00
PKEuS
49f6231756
Fixed two issues in CheckSizeof::checkSizeofForPointerSize()
2015-11-07 09:35:30 +01:00
PKEuS
b20a7e3192
Refactorization: Moved two tests to testgarbage.cpp
...
Fixed wrong comment in testcppcheck.cpp (forgotten in previous commit)
2015-11-06 21:58:49 +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
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
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
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
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
Alexander Mai
7d8b62e615
Add regression test for #6669 Return value of malloc is reported not stored, while it is.
2015-10-26 18:24:49 +01:00
PKEuS
636bf75799
Fixed crash on garbage code ( #7074 )
2015-10-26 13:29:47 +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
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
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
7060c7c87d
Refactorization: Reduced code duplication in testlibrary.cpp
2015-10-19 09:01:20 +02:00
Philipp Kloke
a837cc48e0
Refactorization: Simplified code in tokenlist.cpp, token.cpp and testthreadexecutor.cpp
2015-10-19 09:01:20 +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
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
Alexander Mai
8f07b2e440
#6922 valueFlowForward does not terminate: xorg/driver/xf86-video-neomagic : src/neo_driver.c (invalid code). Add regression test for previously fixed bug.
2015-10-18 11:52:25 +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
c88297c971
Fixed #7054 (AST: handle C++ initialization with {} better)
2015-10-17 17:03:24 +02:00
Alexander Mai
8e3e981323
#7050 segmentation fault (invalid code) in isVariableChanged
2015-10-15 21:27:55 +02:00
Daniel Marjamäki
6cf25825de
Fixed #7030 (Tokenizer::simplifyTypedef: Label)
2015-10-15 16:56:22 +02: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
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
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
0849ad4707
ValueType: Better handling of const
2015-10-10 08:32:45 +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
PKEuS
70dce7701a
Refactorization: Reduced code duplication in testpreprocessor.cpp
2015-10-09 12:27:39 +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
856e4c414d
Refactorization: Reduced code duplication in testsymboldatabase.cpp
2015-10-08 12:53:56 +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
PKEuS
0a34b206e8
Refactorization: Reduced code duplication in test suite
2015-10-08 11:35:51 +02:00
Philipp Kloke
4ac6623875
Moved a few tests out of testtokenize.cpp; refactorized them
2015-10-07 22:45:38 +02:00
Daniel Marjamäki
2fd27ff729
ValueType: Test promotions
2015-10-07 19:50:33 +02:00
PKEuS
0fa3b8806c
Refactorization: Use '\x..' syntax to avoid cast and "#pragma warning".
2015-10-07 19:41:54 +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
PKEuS
3a5cef8a7e
Refactorization: Improved usage of Settings instances in test suite
2015-10-07 18:40:03 +02:00
Daniel Marjamäki
db31e22316
ValueType: Improved signedness
2015-10-07 18:10:48 +02:00
PKEuS
f1bbcfe32d
Refactorization: Avoid loading std.cfg multiple times in testautovariables.cpp
2015-10-07 14:40:09 +02:00
PKEuS
93dbfb72d1
Improved REGISTER_TEST() macro to support several occurrences within a single file
2015-10-07 14:30:01 +02:00
PKEuS
07b661ef62
Refactorization: Improved handling of preprocessor in test suite
...
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
PKEuS
50ed47c725
Fixed crash on garbage code ( #7022 )
2015-10-07 13:52:06 +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