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