Commit Graph

19493 Commits

Author SHA1 Message Date
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
Paul Fultz II 9b973e652c Issue 8830: New check: Function argument evaluates to constant value
Add a check for function arguments that can be constant:

```cpp
extern void bar(int);
void f(int x) {
   bar((x & 0x01) >> 7); // function 'bar' is always called with a '0'-argument
}
```
2018-12-17 06:04:24 +01:00
IOBYTE 2090866cd0 template simplifier: remove explicit instantiations after instantiation (#1523)
* template simplifier: remove explicit instantiations after instantiation

* Fix use after free crash in clang test suite.
2018-12-17 05:58:48 +01:00
Daniel Marjamäki 357e2fbfb3 Add testcase for #8807 (False negative: Redundant variable assignments (loop)) 2018-12-16 21:45:26 +01:00
Daniel Marjamäki c8d688607a Fixed #8901 (Unused value: const variable initialization) 2018-12-16 19:01:05 +01:00
Daniel Marjamäki 21eb1c5e22 FwdAnalysis: Fix false negatives for struct members 2018-12-16 18:32:34 +01:00
orbitcowboy 30220fa7fc wxwidgets.cfg: Added more constants from wx/gdicmn.h 2018-12-16 17:29:45 +01:00
Daniel Marjamäki 46a0172480 FwdAnalysis: fix FP in loop 2018-12-16 16:43:04 +01:00
orbitcowboy 152df1bf00 wxWidgets.cfg: Addd more definitions from multiple wxWidgets-classes. 2018-12-16 15:31:06 +01:00
orbitcowboy 60bfa3dfc0 wxwidgets.cfg: Added support for more macro defintions from various wxWidgets-classes. 2018-12-16 15:08:50 +01:00
orbitcowboy 44b545b1c5 wxwidgets.cfg: Added support for more macro defintions from various wxWidgets-classes. 2018-12-16 14:39:24 +01:00
Daniel Marjamäki 97d2075007 FwdAnalysis: better handling of loops 2018-12-16 11:42:11 +01:00
Daniel Marjamäki 3af0d73f82 Unused value: Fixed false negatives for loops 2018-12-16 11:18:37 +01:00
Paul Fultz II 3262a3bebe Add isSameExpression to valueflow analysis
Check for same expressions in valueflow analysis.
2018-12-16 07:35:27 +01:00
Paul Fultz II 45dcfad9f9 Fix issue 8899: False positive returnDanglingLifetime when returning by value
This fixes the FP from:

```cpp
#include <string>

class MyString
{
        public:
        MyString(char* source)
        {
                length = strlen( source );
                buffer = new char[length+1];
                if( buffer )
                {
                        strcpy( buffer, source );
                }
        }

        char* buffer;
        int length;
};

MyString Foo()
{
        char arr[20];
        sprintf(arr, "hello world");

        return arr;
}

void main()
{
        MyString str = Foo();

        printf(str.buffer);
}
```
2018-12-15 17:58:45 +01:00
Daniel Marjamäki 1bfe98447a FwdAnalysis: Tweak possiblyAliased 2018-12-15 11:54:00 +01:00
orbitcowboy 9dd00a8066 wxwidgets.cfg: Added more definitions from wx/defs.h 2018-12-15 10:48:36 +01:00
Daniel Marjamäki f26549e5ab Fixed #8896 (Tokenizer: Anonymous struct) 2018-12-15 08:42:35 +01:00
IOBYTE a1c275436f Fix #8902 (Crash in TemplateSimplifier) (#1521) 2018-12-15 07:52:47 +01:00
orbitcowboy fbcb0d55d4 wxwidgets.cfg: Improved support for more predefined values from wx/defs.h 2018-12-14 21:29:41 +01:00
orbitcowboy 9fdb1b1675 wxwidgets.cfg: Improved support for more predefined values from wx/defs.h 2018-12-14 20:54:54 +01:00
orbitcowboy f961aa9eca wxwidgets.cfg: Improved support for more predefined values from wx/defs.h 2018-12-14 20:48:03 +01:00
orbitcowboy 994366c284 wxwidgets.cfg: Improved support for some defines from wx/defs.h 2018-12-14 20:00:30 +01:00
orbitcowboy 179c652e49 wxwidgets.cfg: Improved support for some wxGauge functions. 2018-12-14 19:49:01 +01:00
orbitcowboy 4bc19d269c wxwidgets.cfg: improved support for some GDI constants. 2018-12-14 19:39:34 +01:00
Daniel Marjamäki 37416010ef Unused value: Fix false positive (ast, {}) 2018-12-14 18:56:09 +01:00
Paul Fultz II be6782d386 Fix FP 8891: Incorrect return scope when using uniform initialization
This fixes the FP in:

```cpp

std::string f(const std::string& data)
{
  if (data.empty())
    return {};

  data[0];
}
```
2018-12-14 18:31:10 +01:00
orbitcowboy 888490fe6c wxwidgets.cfg: Improved support for wxAboutDialogInfo functions. 2018-12-14 15:36:03 +01:00
Daniel Marjamäki 9742c1e2ae make checkcfg: Try to fix inline suppressions 2018-12-14 13:51:03 +01:00
Daniel Marjamäki 8464085535 UnusedVariables: Fix FP for unknown variable 2018-12-13 21:37:21 +01:00
Daniel Marjamäki 092d434f91 UnusedVar: Fix FP for array arguments 2018-12-13 21:08:18 +01:00
Daniel Marjamäki 1f27cd56c0 FwdAnalysis; Code cleanup, isNullOperand 2018-12-13 21:01:33 +01:00
Daniel Marjamäki 0b4e08cac9 Use FwdAnalysis in UnusedVar. This is still work-in-progress. Merging to master branch so it can be tested. 2018-12-13 18:52:56 +01:00
orbitcowboy 02e1637553 wxwidgets.cfg: Improved support for some wxBitmap functions. 2018-12-13 17:04:02 +01:00
Daniel Marjamäki b91ef62932 Add boost.cfg 2018-12-13 09:06:35 +01:00
IOBYTE 0f83aff3b8 Improve trailing return type support. (#1520)
* Improve trailing return type support.

* Partial fix for #8889 (varid on function when using trailing return type)

* Handle operators in templates.
2018-12-13 06:34:10 +01:00
Daniel Marjamäki e0b64ec7a9 Fixed #8884 (AST: handle xs... template argument) 2018-12-12 19:00:14 +01:00
orbitcowboy 1a6c3bb30e wxwidgets.cfg: Added support for wxVector. 2018-12-12 17:23:10 +01:00
orbitcowboy 619220778e wxwidgets.cfg: Added support for wxOVERRIDE. 2018-12-12 08:22:34 +01:00
Sebastian a4a3373838 donate-cpu-server.py: Fix wrong number of "+" diffs in latest results. (#1517)
This should fix the issue that the number after the "+" in the "Diff" column is always one too large.
2018-12-10 20:05:34 +01:00
amai2012 6924522475
Refactor methods for identification of numeric literals. (#1514) 2018-12-10 12:10:26 +01:00
fu7mu4 2abb3aa263 fix japanese translation typo and manual version (#1515) 2018-12-09 09:06:56 +01:00
orbitcowboy 4282c9375a zlib.cfg: Added support for more function, defines and types. 2018-12-08 20:17:42 +01:00
PKEuS 886aa07ffb Set version to 1.86.99/1.87 dev 2018-12-08 11:53:37 +01:00
Daniel Marjamäki 49e500d6bf donate-cpu: use 1.86 as base version 2018-12-08 11:39:44 +01:00
Daniel Marjamäki a16f694254 Revert "Fix issue 8884: Regression: False positive: Variable 'f' is reassigned a value before the old one has been used (#1513)"
This reverts commit 6953dddfa6.
2018-12-08 08:25:20 +01:00
Daniel Marjamäki 81e6d67d2c Debug Makefile 2018-12-08 08:23:50 +01:00
Daniel Marjamäki 5b897a7a4a 1.86: Release Makefile 2018-12-08 08:18:21 +01:00
Daniel Marjamäki 5e527bdd08 Update version 2018-12-08 08:17:05 +01:00
Daniel Marjamäki 8be0ab3360 Updated AUTHORS 2018-12-08 08:02:28 +01:00