Commit Graph

127 Commits

Author SHA1 Message Date
chrchr-github a62c3ea90e
Fix Broken AST with auto**, FP constStatement () 2022-08-03 19:03:38 +02:00
chrchr-github 71f9a7269f
Add test for , , avoid duplicate warning ()
* Add test for , avoid duplicate warning

* Add test for 

* Fix test
2022-08-02 21:43:18 +02:00
chrchr-github 2223cd24b9
Fix FN: leakNoVarFunctionCall (switch condition) ()
* Fix  FN: leakNoVarFunctionCall

* Fix TODO

* Fix  FN: leakNoVarFunctionCall (if ( b && malloc ) )

*  FN: leakNoVarFunctionCall (ternary operator)

* Fix  FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall
2022-06-28 14:02:02 +02:00
chrchr-github 6f5a5fd947
Add some tests ()
* Add test for 

* Add test for 

* Fix test

* Add test for 

* Add test for 

* Add test for 

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild
2022-06-14 09:54:45 +02:00
chrchr-github 52453947c8
Don't warn for 'x | 0' in macro ()
* Fix  FN badBitmaskCheck for binary or with 0

* Add test for 

* Don't warn for 'x | 0' in macro

* Add test for 
2022-06-06 11:17:36 +02:00
chrchr-github 52f507d1fb
Fix unintentional semicolon in expression '.. ; +dostuff();' ()
* Fix  unintentional semicolon in expression '.. ; +dostuff();'

* Improve error message

* Don't remove single unary + in front of variables
2022-05-13 06:54:02 +02:00
chrchr-github ceb86afc22
Fix FP constStatement with cast in return () 2022-04-07 14:11:14 +02:00
chrchr-github b73aeeda0e
Fix FP constStatement with comma operator ()
* Fix FP constStatement with comma operator

* Format
2022-04-06 16:58:17 +02:00
chrchr-github 4bf8718dcb
Fix FP constStatement with pointers in lambda () 2022-04-01 19:50:40 +02:00
chrchr-github 183969cd4b
Fix FP constStatement with extern declaration () 2022-03-31 21:08:04 +02:00
chrchr-github c85e7e7d2f
Fix FP constStatement with more complex expression () 2022-03-30 22:00:57 +02:00
chrchr-github 343a23135d
Fix FP constStatement with reference and direct initialization () 2022-03-30 19:22:01 +02:00
chrchr-github 86ff360946
Fix FP constStatement with immediately evaluated lambda () 2022-03-29 06:10:57 +02:00
chrchr-github 49147f95fe
Fix FP constStatement with dynamic_cast () 2022-03-28 22:15:40 +02:00
chrchr-github 8d49fc252c
Fix FP constStatement ',' with Eigen, OpenCV etc. () 2022-03-28 22:06:44 +02:00
chrchr-github d57d536f01
Fix FP constStatement with negation and cast () 2022-03-28 21:52:08 +02:00
chrchr-github 63d96e49fc
Fix , FP constStatement ()
* Fix ,  FP constStatement

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github fe7d0eeffc
Fix FP: constStatement with template type () 2022-03-25 17:03:54 +01:00
chrchr-github e54ad24d2c
Fix FN constStatement with arrays () 2022-03-25 11:32:16 +01:00
chrchr-github 3630e9c49d
Fix FP constStatement with extra parentheses in declaration () 2022-03-24 22:07:21 +01:00
chrchr-github 0d2af9a5b7
Fix FP constStatement with init list in function call () 2022-03-23 18:10:33 +01:00
chrchr-github 40c2687ac4
Fix FP constStatement with delete () 2022-03-22 18:39:02 +01:00
chrchr-github 97ce569859
Fix FP constStatement with extra parentheses in function call ()
* Fix  FP constStatement with extra parentheses in function call

* Format
2022-03-17 12:47:27 +01:00
chrchr-github b8ba0ae00e
Fix FP constStatement with ternary and comma operator () 2022-03-16 15:28:59 +01:00
chrchr-github d3d40fd599
Fix #10868/#10869 FN: constStatement, handle unused character constants ()
* Fix  FN: constStatement, handle unused character constants

* simpleMatch

* Fix  FN: constStatement

* Format
2022-03-14 14:14:32 +01:00
chrchr-github 3df170c191
Fix FN: constStatementError, streamline error messages () 2022-03-12 14:52:18 +01:00
chrchr-github 705931266c
constStatementError: don't warn for casts with possible side effects,… ()
* constStatementError: don't warn for casts with possible side effects, handle bool constants

* Recursive call, add tests

* Restore test

* Don't warn for C++ casts to void

* Don't warn for cast to void*
2022-03-11 21:45:51 +01:00
chrchr-github 850ad0fed9
: Add error message for unused casts, log unhandled errors ()
* : Add error message for unused casts, log unhandled errors

* Fix TODO

* Fix TODO
2022-03-09 18:21:47 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly () 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github dad64bfcc8
Fix FP shadowFunction with default destructor implementation / Tests for , , , , () 2022-02-02 19:30:49 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use () 2022-01-27 19:03:20 +01:00
Paul Fultz II 7f358b2bed
Format with uncrustify () 2021-08-07 20:51:18 +02:00
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
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Daniel Marjamäki bf3833dad5 Avoid constStatement false positives for 'foo() || x=5'. Found in daca@home. 2020-09-29 13:35:39 +02:00
Daniel Marjamäki 31c800e19e Fixed false positive: suspicious operator ',' seen in daca@home 2020-09-29 11:32:48 +02:00
Daniel Marjamäki 37245a8179 Update copyright year 2020-06-13 16:37:12 +02:00
PKEuS c9d8f607df Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList. 2020-05-19 12:08:17 +02:00
Daniel Marjamäki 676a837af6 Fixed (FP constStatement "Found a statement that begins with string constant") 2019-11-28 17:49:33 +01:00
Daniel Marjamäki de4a33167d astyle formatting
[ci skip]
2019-05-21 10:43:33 +02:00
Paul Fultz II 9949ae1b4f Fix issue 8995: False Positive: Redundant code with initializer-list created object () 2019-05-21 10:40:36 +02:00
Paul Fultz II ae8a3aae8d Fix FP with unused variable () 2019-04-29 11:50:19 +02:00
Daniel Marjamäki 0efddc4010 astyle formatting
[ci skip]
2019-03-31 16:20:06 +02:00
Daniel Marjamäki 29a5404d1e Incomplete statement: Fix FP for 'ar & x' 2019-03-31 11:50:57 +02:00
Paul Fultz II 032020c40d Fix issue 9001: FP: Found suspicious operator ',' [constStatement] 2019-02-27 07:09:22 +01:00
Paul Fultz II dfaf75db54 Fix issue 8984: FP constStatement regression with qualified name () 2019-02-19 07:08:36 +01:00
Paul Fultz II cf1ad5087a Extend constStatement checker
This reworks constStatement to find more issues. It catches issue [8827](https://trac.cppcheck.net/ticket/8827):

```cpp
extern void foo(int,const char*,int);
void f(int value)
{
        foo(42,"test",42),(value&42);
}
```

It also catches from issue [8451](https://trac.cppcheck.net/ticket/8451):

```cpp
void f1(int x) {
    1;
    (1);
    (char)1;
    ((char)1);
    !x;
    (!x);
    ~x;
}
```

And also:

```cpp
void f(int x) {
    x;
}
```

The other examples are not caught due to incomplete AST.
2019-02-15 13:31:40 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00