Oliver Stöneberg
c9c1f83a69
use `emptyString` more consistently ( #4034 )
2022-07-10 10:57:29 +02:00
Oliver Stöneberg
6e57cc4323
small utils.h cleanup ( #3821 )
2022-02-11 19:44:08 +01:00
Oliver Stöneberg
f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly ( #3767 )
2022-02-10 23:02:24 +01:00
Daniel Marjamäki
3989408738
Update copyright year
2022-02-05 11:45:17 +01:00
Oliver Stöneberg
0ba9cb4e64
fixed some unusedFunction warnings ( #3618 )
2022-01-04 15:48:08 +01:00
Oliver Stöneberg
38de9214a8
small CheckStl optimization ( #3645 )
2021-12-20 07:29:45 +01:00
Daniel Marjamäki
f701a9361d
chmod; Use 644 for source files
2021-11-17 08:25:25 +01:00
Paul Fultz II
112363c9d1
Fix 10590: container access out of bounds not found ( #3560 )
...
* Refactor container bounds check
* Use symbolic values
* Add test case
* Format
2021-11-13 07:45:29 +01:00
Paul Fultz II
84f102283b
Warn when modifying container from another function in a loop ( #3510 )
2021-10-15 11:54:29 +02:00
Daniel Marjamäki
08f9de95e2
Update copyright year
2021-09-26 11:34:56 +02:00
Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Paul Fultz II
dea5a23c34
Improve check: check for known empty containers passed to algorithms ( #2768 )
2020-09-02 07:11:23 +02:00
Daniel Marjamäki
18c29544eb
astyle formatting
2020-08-28 19:29:33 +02:00
Paul Fultz II
6ab3c93fb1
Fix issue 9756: false negative: invalid iterator from std::find_if ( #2760 )
2020-08-28 19:29:09 +02:00
Daniel Marjamäki
2bb73840fc
astyle formatting
2020-08-23 17:17:33 +02:00
Paul Fultz II
ac846b96d1
New check: Iterating a known empty container ( #2740 )
2020-08-22 09:16:26 +02:00
Paul
7776fb82a2
Fix issue 737: new check: Dereference end iterator
2020-08-17 16:36:45 -05:00
Daniel Marjamäki
af6e76d623
Fixed #9787 (Better handling of user defined literals)
2020-06-25 22:06:34 +02:00
Paul
7c9144ea47
Add to classInfo
2020-06-15 19:43:33 -05:00
Paul
172537807b
Add check for incorrect usage of mutexes and lock guards
2020-06-15 19:40:54 -05:00
Daniel Marjamäki
43b30d974f
astyle formatting
...
[ci skip]
2020-06-08 00:50:45 +02:00
Paul Fultz II
86ed860d26
Fix issue 9548: False negative: Mismatching iterators when inserting into a vector ( #2595 )
2020-06-06 17:54:56 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ( #2600 )
...
* cleaned up includes based on include-what-you-use
* check.h: trying to work around Visual Studio 2012 bug
* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
orbitcowboy
048b08f5be
Running astyle. There are no functional changes [ci skip]
2020-04-04 14:49:08 +02:00
Paul Fultz II
efdc5f5c4e
Fix issue 9435: False negative: invalidContainer when using range for loop ( #2587 )
...
* Fix issue 9435: False negative: invalidContainer when using range for loop
* Use ast
* Make string const
2020-04-04 11:47:02 +02:00
Paul Fultz II
42d44f02a2
Use lifetime analysis for checking mismatching containers ( #2456 )
...
* Use lifetimes to check for mismatching containers
* Fix error messages
* Format
* Remove unused variables
* Fix configuration and track iterators through algorithms
* Fix iterator value types in qt config
* Fix library issue with QStringList
* Remove unused functions
* Fix cppcheck errors
2019-12-25 09:32:50 +01:00
Oliver Stöneberg
b5c598cca4
added missing OVERRIDE usage and removed redundant virtual ( #2190 )
2019-09-20 21:57:16 +02:00
Paul Fultz II
cb509f1a8b
Fix issue 4845: alias to vector element invalid after vector is changed ( #2113 )
...
* Try harder to track ref lifetimes
* Dont add lifetimes for references
* Use correct token
* Check for front and back as well
* Improve handling of addresses
* Formatting
* Fix FP
2019-09-02 06:58:09 +02:00
Paul Fultz II
a08a9c1349
Switch to use lifetime analysis for iterators and pointers to invalid containers
...
This will diagnose more issues such as:
```cpp
void f(std::vector<int> &v) {
auto v0 = v.begin();
v.push_back(123);
std::cout << *v0 << std::endl;
}
```
2019-07-18 10:56:44 +02:00
Daniel Marjamäki
5eff1b0f4a
Replace 'unsigned' with 'nonneg' in checkstl
2019-07-15 14:05:23 +02:00
Daniel Marjamäki
46cad95238
Fix Cppcheck warnings
2019-06-15 13:05:17 +02:00
Paul Fultz II
091f4bcf8d
Add check for unnecessary search before insertion
...
This will warn for cases where searching in an associative container happens before insertion, like this:
```cpp
void f1(std::set<unsigned>& s, unsigned x) {
if (s.find(x) == s.end()) {
s.insert(x);
}
}
void f2(std::map<unsigned, unsigned>& m, unsigned x) {
if (m.find(x) == m.end()) {
m.emplace(x, 1);
} else {
m[x] = 1;
}
}
```
In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.
I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
Daniel Marjamäki
3c30d274a0
Clarify STL out of bounds warning message
2019-03-29 11:13:25 +01:00
Daniel Marjamäki
3dc34f1515
Disable all simplified checks
2019-03-16 09:17:50 +01:00
Paul Fultz II
3615eac347
Move useStlAlgorithm to normal checking ( #1741 )
2019-03-15 06:15:56 +01:00
Daniel Marjamäki
f36ca56e7d
Moved CheckStl::redundantCondition to normal checking
2019-03-09 07:53:49 +01:00
Daniel Marjamäki
f9fe6cc96a
STL: Removed auto_ptr checking.
2019-03-09 07:48:01 +01:00
Daniel Marjamäki
d7a645dcc3
Moved CheckStl::uselessCalls to normal checking
2019-03-09 07:37:08 +01:00
Daniel Marjamäki
45a0c2ebf5
Revert "Moved CheckStl::checkAutoPointer to normal checking"
...
This reverts commit 6dc9727ffd
.
2019-03-08 20:53:37 +01:00
Daniel Marjamäki
6dc9727ffd
Moved CheckStl::checkAutoPointer to normal checking
2019-03-08 20:41:28 +01:00
Daniel Marjamäki
95a20c0233
Moved CheckStl::string_c_str to normal checking
2019-03-08 20:39:43 +01:00
Daniel Marjamäki
fdf1d6fdee
Moved CheckStl::erase to normal checking
2019-03-08 20:36:40 +01:00
Daniel Marjamäki
fdfe39299c
Moved CheckStl::pushback to normal checking
2019-03-08 20:33:16 +01:00
Daniel Marjamäki
5fe48f3cd2
Moved CheckStl::mismatchingContainers to normal checking
2019-03-08 20:31:00 +01:00
Daniel Marjamäki
b91bb2e523
Moved CheckStl::iterators to normal checking
2019-03-08 20:28:28 +01:00
Daniel Marjamäki
8f2d70e61d
Move CheckStl::if_find to normal checking
2019-03-08 20:23:37 +01:00