8346 Commits

Author SHA1 Message Date
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 3044612fe9b13fa6e3c9c190dd964c5c8fe237f0.

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