amai2012
9f5e648b9f
Enhance debug output for AST syntax error (inspired by #8747 )
2018-09-10 08:55:46 +02:00
Daniel Marjamäki
0dfedd977e
CppCheck: Minor tweak. Do no clear internalErrorFound, instead ensure that it's not written upon suppression
2018-09-10 06:02:01 +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
1bb1c4cc8e
Use early continue
2018-09-09 20:58:30 +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
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
Daniel Marjamäki
df9df70ba7
astyle formatting
...
[ci skip]
2018-09-08 09:07:59 +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
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
Paul Fultz II
ab55b9eccb
Check for same expression in condition check to avoid duplicate messages ( #1359 )
2018-09-02 08:43:17 +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
Daniel Marjamäki
0a9d417266
add comments
2018-09-01 16:45:14 +02:00
Daniel Marjamäki
3cad3c901f
Another patch to temporarily disable the followVariableExpression
2018-09-01 11:39:21 +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
12b7c9e597
Fix Cppcheck warning
2018-09-01 08:41:41 +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
c7e5176284
Fixed #8061 (Problems with handling of --project argument)
2018-08-31 16:06:52 +02:00
Armin Müller
b9cd7368f5
Typos found by running "codespell" ( #1355 )
...
* Update astutils.cpp
* Update checksizeof.cpp
2018-08-30 19:51:39 +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
Daniel Marjamäki
4378327c43
astyle formatting
...
[ci skip]
2018-08-27 13:48:46 +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
Daniel Marjamäki
ad0ebd8f1a
astyle formatting
...
[ci skip]
2018-08-25 21:32:52 +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
Daniel Marjamäki
4d0262fd0a
astyle formatting
...
[ci skip]
2018-08-23 06:06:58 +02:00
Kamil Dudka
0ca6ab1a71
ErrorLogger: add {cwe} ( #1341 )
2018-08-21 13:58:19 +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
a30941d885
Refactoring; Use range for loops
2018-08-19 17:27:41 +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
212af76367
astyle formatting
...
[ci skip]
2018-08-18 15:45:50 +02:00
Paul Fultz II
fd49112196
Avoid duplicates in the error path ( #1346 )
2018-08-18 07:32:30 +02:00
Daniel Marjamäki
43233e72b2
Fixed #8691 (False negative for uselessAssignmentArg)
2018-08-17 19:56:36 +02:00
Daniel Marjamäki
e442bc47b1
astyle formatting
...
[ci skip]
2018-08-17 19:55:21 +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
Paul Fultz II
bbf876256c
Add error path to more diagnostics that rely on isSameExpression ( #1342 )
2018-08-17 09:25:07 +02:00
Sylvain Joubert
13617375df
missingOverride: False positive with cv-ref mismatch ( #1340 )
2018-08-17 08:42:22 +02:00
Konrad Grochowski
0e70c8a916
Added '-' and '.' to allowed chars in error ids for suppressions. ( #1338 )
...
Those chars are used for example in misra.py
2018-08-17 08:20:39 +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
Matthias Krüger
a9ae897f8c
checkstl: fix inconsistent-missing-override warning reported by clang.
...
Warning was:
lib/checkstl.h:57:18: warning: 'runChecks' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
^
lib/check.h:67:18: note: overridden virtual function is here
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) {
^
2018-08-11 21:33:44 +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
f0c1d49abf
Fix Cppcheck warning
2018-08-11 14:45:12 +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
3805af18a2
valueFlowContainerSize: Fix crash when container pointer is null
2018-08-10 12:53:16 +02:00
Daniel Marjamäki
f37434cd1d
valueFlowContainerReverse: Fix FPs when there is assignment
2018-08-10 12:26:53 +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
8032f64c15
Refactoring; Use range for loops
2018-08-10 10:04:10 +02:00
Daniel Marjamäki
b707f6e476
Refactoring; use range for loops
2018-08-10 06:47:18 +02:00
Daniel Marjamäki
223a116f24
The checksum in analyzer info files will now depend on the suppressions
2018-08-09 09:27:26 +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
ddbe4b89b5
Renamed --debug to --debug-simplified
2018-08-05 11:19:20 +02:00
Daniel Marjamäki
bcdd58de0b
astyle formatting
...
[ci skip]
2018-08-05 10:48:28 +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