Commit Graph

10996 Commits

Author SHA1 Message Date
Daniel Marjamäki 1a25d3f9ec astyle formatting
[ci skip]
2019-08-30 18:34:14 +02:00
Paul Fultz II 0b9e823fc8 Fix issue 9305: False positive uninitvar - struct initialized via function (#2123) 2019-08-30 18:32:45 +02:00
Paul Fultz II 2942be53f7 Add more tests for valueFlowUninit (#2124) 2019-08-30 08:41:17 +02:00
Paul Fultz II 03fe6795bf Fix issue 9302: FP uninitvar - struct accessed via pointer (#2121) 2019-08-29 08:38:50 +02:00
IOBYTE 28a95802a2 template simplifier: fix syntax error false positive (an expression can't be a template) (#2115)
https://stackoverflow.com/questions/57590411/cppcheck-syntax-error-with-using-typedef
2019-08-27 06:37:58 +02:00
Daniel Marjamäki a47633c4b9 Added TODO comment 2019-08-26 06:56:29 +02:00
Daniel Marjamäki 4bd9d76a4c Try to make Travis happy 2019-08-25 10:24:13 +02:00
Daniel Marjamäki 82eec11898 Created redundantInitialization id 2019-08-25 09:45:39 +02:00
Daniel Marjamäki 324e5e581b Redundant assignments: Fix false positive when reassignment expression contains assembler 2019-08-24 20:15:52 +02:00
Daniel Marjamäki 0dfda5eb4a Try to make Travis happy 2019-08-24 15:43:31 +02:00
Daniel Marjamäki 996daaee4e STL: Fixed outOfBounds false positive 2019-08-24 15:40:29 +02:00
Daniel Marjamäki 9d26be8380 Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 14:43:35 +02:00
Paul Fultz II 5c488b9519 Fix issue 9190: FP uninitvar for struct member (#2112)
* Fix issue 9190: FP uninitvar for struct member

* Add more test cases

* Fix false negative
2019-08-24 11:27:47 +02:00
Daniel Marjamäki 35fb55d76c Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 08:01:55 +02:00
Daniel Marjamäki 9cbdc262f6 Fix Cppcheck internal warning 2019-08-23 16:56:28 +02:00
Daniel Marjamäki d3f7fc92f2 Quick fix to make Travis happy 2019-08-23 15:23:49 +02:00
versat 50c6af5e5d astyle formatting
[ci skip]
2019-08-23 10:19:29 +02:00
Daniel Marjamäki 7061cc334b RedundantAssignment: Don't warn for initialization with {0} 2019-08-23 08:51:16 +02:00
Thomas Niederberger d122b1c722 Fix issue with __declspec and final (#2107)
* Add missing Qt macros

Add two Qt macros that were missing

* Fix issue with __declspec and final

This change is a bit naive but it fixes the issues I was having when combining __declspec(dllexport) and final classes. Without the fix I get errors along the line of "The code 'class x final :' is not handled. You can use -I or --include to add handling of this code. "
2019-08-23 06:43:02 +02:00
Rikard Falkeborn fd3cb24973 leakNoReturnVar: Don't break early (#2095)
There seems to be no reason for stopping checking the scope if a call to
free() is seen (or fclose() or realloc()), so just continue checking.
Also, if there are multiple arguments, check all, perhaps there are more
memory leaks to warn about.
2019-08-23 06:33:00 +02:00
Paul Fultz II c0a8d628b9 Fix issue 6010: Uninitialized inner struct (#2098)
* Fix issue 6010: Uninitialized inner struct

* Show to root variable that is unitialized

* Warn on pointer dereferences
2019-08-23 06:23:20 +02:00
Daniel Marjamäki 6815e38879 TokenList::insertTokens: copy column also 2019-08-20 20:53:44 +02:00
IOBYTE 4b231c53a4 Fixed #9287 and #9288 (Syntax error on valid C++ code) (#2104) 2019-08-20 20:25:18 +02:00
Daniel Marjamäki ef47d3d304 Fixed #9286 (FP: syntax error: { .abc.a = 1) 2019-08-20 13:56:38 +02:00
Daniel Marjamäki 474fed453e memleak: Fixed false negative for sample 2019-08-18 19:45:39 +02:00
Daniel Marjamäki a5ba82c2d3 Fixed #9260 (--template=gcc does not work correctly with -j) 2019-08-18 16:33:32 +02:00
Daniel Marjamäki d95f29b23a Fixed test/cli 2019-08-18 12:51:32 +02:00
Daniel Marjamäki 2d9a131817 Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column' 2019-08-18 12:19:05 +02:00
Daniel Marjamäki de9b928d98 ErrorLogger: add 'column' in serializer/deserializer 2019-08-18 09:06:40 +02:00
Daniel Marjamäki 04e3884ff6 xml: Add column attribute in <location> 2019-08-18 08:37:56 +02:00
Daniel Marjamäki c3a27eb8c1 Fix a few cppcheck internal warnings 2019-08-17 16:02:58 +02:00
Daniel Marjamäki a17f2a6f05 Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead. 2019-08-17 10:53:07 +02:00
IOBYTE 04bb6c0d1f template simplifier: fix new daca crashes (#2093) 2019-08-17 07:38:07 +02:00
Paul Fultz II ee7fe3aaa1 Fix FP: Unitialized variable when using a pointer
This fixes the FP in cases like this:

```cpp
void f() {
    bool b;
    bool * x = &b;
    if (x != nullptr)
        x = 1;
}
```

It tracks the indirection of the uninit value in valueflow.
2019-08-17 07:36:41 +02:00
Paul Fultz II 3e0d1141d3 Fix issue 9277: FP: Dont warn for knwon conditions in if constexpr (#2085) 2019-08-16 07:56:39 +02:00
Paul Fultz II 3aef0c9bd3 Fix issue 8715: regression uninitvar not detected (#2092) 2019-08-16 07:48:54 +02:00
Paul Fultz II ef714225bb Use library to track container lifetimes 2019-08-15 21:14:54 +02:00
Daniel Marjamäki 95ac8db584 TemplateSimplifier: Set column number for expanded tokens 2019-08-15 15:22:56 +02:00
Daniel Marjamäki f33a8a417f Put 'isExpandedMacro' info in the dump files 2019-08-15 14:24:56 +02:00
Daniel Marjamäki a57d22d2d9 astyle formatting
[ci skip]
2019-08-15 10:46:16 +02:00
Paul Fultz II af214e8212 Fix issue 8825: ValueFlow: uninitialized struct member (#2087)
* Pass uninit value across pointers

* Add more testing
2019-08-15 10:44:55 +02:00
Rikard Falkeborn fc1d5b187f leakNoVarFunctionCall: Use AST more (fix #9252) (#2086)
Use the AST a little bit more to improve the check. In order to do so,
rewrite the check to work from the outer function first and then check
the arguments, instead of the other way around.

It also fixes Trac ticket #9252, no warning is now given for

	void* malloc1() {
		return(malloc1(1));
	}

This FP seems to be common in daca results.

It also makes it possible to improve handling of casts, for example
cppcheck now warns about

	void f() {
		strcpy(a, (void*) strdup(p));
	}

But not for

	char* f() {
		char* ret = (char*)strcpy(malloc(10), "abc");
		return ret;
	}

These FP/FN were introduced when the check was switched to use the
simplified token list.
2019-08-14 22:01:40 +02:00
Rikard Falkeborn f139558d90 Dmake cleanups (#2077)
* dmake: Refactor object files to separate function

No functional change.

* dmake: Use range for loops

No functional change.

* Add all external cpp files instead of open coding

No functional change.

* Remove duplicate check.h in lib.pri HEADERS

* Add missing newline

No functional change, but the readability of the generated Makefile is
slightly improved.
2019-08-14 20:53:51 +02:00
Paul Fultz II 4f76588f98 Fix issue 9275: False positive: Non-local object uses local variable (#2084) 2019-08-14 20:09:33 +02:00
Paul Fultz II 0c1dff5c93 Fix issue 9268: false negative: (style) Condition '...' is always true (#2080)
* Fix issue 9268: false negative: (style) Condition '...' is always true

* Fix copy and paste mistake
2019-08-14 06:34:27 +02:00
Paul Fultz II 13df5b2413 Fix FP with negative index and negated condition (#2081) 2019-08-14 06:32:31 +02:00
Daniel Marjamäki d4549217d0 Renamed safeClassRefMember => unsafeClassRefMember 2019-08-13 20:58:31 +02:00
Daniel Marjamäki ed7edc6d2a Improve warning message 2019-08-13 20:42:25 +02:00
Daniel Marjamäki 41f8c1b281 Fixed #9271 (Safe classes: Class that store references) 2019-08-13 20:40:48 +02:00
Rikard Falkeborn ffcceb097e Memleak: Refactor check to separate function (#2079)
This makes all the checks in CheckMemoryLeakNoVar separate functions to
improve readability.
2019-08-13 13:00:59 +02:00