Commit Graph

273 Commits

Author SHA1 Message Date
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
Daniel Marjamäki 627a5e75cc Token::stringify; refactor in/out parameter to return value 2021-02-21 17:21:33 +01:00
Rikard Falkeborn be09361279
Refactor: Use enum class in checkio (#3112) 2021-02-05 08:17:57 +01:00
Oliver Stöneberg 491f4874c5
fixed/aligned some compiler warnings (#3065) 2021-01-21 18:13:32 +01:00
Oliver Stöneberg 9f9a652ae1
refs issue #9089: avoid usage of expensive std::stringstream (#2996) 2021-01-16 19:03:28 +01:00
Oliver Stöneberg 7aa85aa408
Use std::unordered_* containers for faster lookups (#3052) 2021-01-16 13:52:09 +01:00
Oliver Stöneberg 7189b303ae
fixed some modernize-loop-convert clang-tidy warnings (#2815) 2020-09-21 19:30:47 +02:00
Paul Fultz II 1c5f496350
Fix issue 8373: false negative: invalid iterator (#2761) 2020-08-31 08:46:56 +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
Rikard Falkeborn 8819e19dae Fix #8489 (Fix FN printf argument with parenthesis) (#2508) 2020-01-27 06:55:01 +01:00
Dmitry-Me b3ed9f8231 Make iterator checks useful 2019-11-21 18:15:26 +03:00
Dmitry-Me 28ef31c981 Fix "one past end" illegal iterator computation 2019-11-20 18:10:05 +03:00
Wolfgang Stöggl 1ea3fc8083 Allow SSIZE_T in addition to ssize_t (#2263)
The Windows Data Type SSIZE_T is declared in BaseTsd.h
However, it is written in capital letters

- Fixes e.g. the following false positive:
  (portability) %zd in format string (no. 1) requires 'ssize_t' but the
  argument type is 'SSIZE_T {aka signed long long}'.
  [invalidPrintfArgType_sint]
2019-10-24 21:51:20 +02:00
Paul Fultz II 166bd2bafc Fix issue 2153: valueFlowAfterCondition: struct member (#2228)
* Fix issue 2153: valueFlowAfterCondition: struct member

* Fix null pointer dereference

* Formatting

* Check for another null pointer

* Initialize variables

* Remove redundant condition

* Format

* Add missing initialization to copy constructor

* Format
2019-09-30 21:04:43 +02:00
Oliver Stöneberg de9f489b08 use range loops / constness (#2181)
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
versat 4e89b13adf checkio.cpp: Fix forgotten "nonneg" change which breaks build 2019-07-16 09:30:36 +02:00
Daniel Marjamäki a038ba7dce replace 'unsigned' with 'nonneg' in checkio 2019-07-16 08:37:26 +02:00
Rikard Falkeborn 1cc5f3abe7 Set wchar_t type (#1807)
This is necessary for valueflow to know the size, for example when
calculating sizeof(wchar_t).
2019-05-01 16:34:28 +02:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Sebastian a1a695dcda checkio: Add missing id "invalidScanfFormatWidth_smaller" to errorlist output (#1533) 2018-12-20 21:14:02 +01:00
Paul Fultz II 025881cf35 Fix issue 8829: Condition '...' is always true (int buf[42]; if(buf != NULL){})
This makes arrays non-null in valueflow, so it can catch comparisons against null that is always true:

```cpp
void f(void) {
   int buf[42];
   if( buf != 0) {;} // << always true
}
```
2018-12-17 06:07:34 +01:00
Daniel Marjamäki 7dda8e2a2d Refactoring: Use range for loops 2018-07-14 10:02:32 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
orbitcowboy 33777c5b72 Improved const correcntess of local variables. 2018-05-29 13:24:48 +02:00
rebnridgway 42a65c5160 Fix crash bug #8579 (#1238)
* Added declaration for deletePrevious function

* Added definition for deletePrevious function

* Fixed crash from deleteThis invalidating pointers

The crash was caused by deleteThis() invalidating the pointer to a constant variable usage.  This happened when a usage followed an assignment.  This fixes bug #8579.

* Added tokensFront to match tokensBack

This means deletePrevious can set the list's front if necessary.

* Initialised tokensFront in appropriate places

* Switched to using default Token constructor

* Switched to using Token default constructor

* Switched to using default constructor for Token

* Added missing argument to Token constructor

* Changed to use default constructor for Tokens

* Switched to using default constructor for Tokens

* Switched to using default constructor for Token

* Added new test for deleting front Token

Also made sure to use the correct constructor for Token in other tests.

* Syntax error

* Replaced tokensFront and tokensBack with a struct

This decreases the size of the Token class for performance purposes.

* Replaced tokensFront and tokensBack with a struct

* Added tokensFrontBack to destructor

* Reworked to use TokensBackFront struct

Also ran astyle.

* Reworked to use TokenList's TokensFrontBack member

* Reworked to use TokensFrontBack struct

* Reworked to use TokensFrontBack struct

* Reworked to work with TokensFrontBack struct

* Removed unnecessary scope operator

* Added missing parentheses

* Fixed syntax error

* Removed unnecessary constructor

* Default constructor now 0-initialises everything

This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.

* Fixed unsafe null check

* Added missing explicit keyword

* Fixing stylistic nits

Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.

* Fixing stylistic nits

Removed default constructor and replaced it with a single-argument constructor with a default value.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
Daniel Marjamäki ca8e19c96d SymbolDatabase: Refactor SymbolDatabase: variable list 2018-04-28 09:38:33 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
Daniel Marjamäki 541e255159 Remove inner identical condition 2018-04-08 08:12:56 +02:00
jrp2014 c367fc9f09 Refactor lib/checkio.cpp 2018-04-05 15:55:57 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02: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
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 43db6147d3 astyle formatting
[ci skip]
2017-11-27 23:32:20 +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 eb4bb893b3 Fix FP for std::intmax_t passed as %jd into scanf 2017-11-20 22:31:13 +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
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 4fc0a7998e Remove duplicate error reporting function 2017-11-14 21:46:17 +03:00
Dmitry-Me 916acfc133 Reuse duplicated code for "x" and "u" scanf specifiers 2017-11-09 16:35:09 +03:00