Commit Graph

67 Commits

Author SHA1 Message Date
Simon Martin eaaff30e65 Ticket #8878: Properly simplify typedefs within template instantiations. (#1656) 2019-02-10 09:45:33 +01:00
IOBYTE 155e4ce912 Fixed #8971 ("(debug) Unknown type 'x'." using alias in class members) (#1653)
* Fixed #8971 ("(debug) Unknown type 'x'." using alias in class members)

* template simplifier: partial fix for #8972

Add support for multi-token default template parameters.

* template simplifier: fix for #8971

Remove typename outside of templates.
2019-02-09 08:34:59 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
IOBYTE 817c748e4d Fixed #5953 (debug: varid0: Function::addArguments) (#1567) 2019-01-05 19:42:04 +01:00
Paul Fultz II f16d9d7d90 Issue 6175: Check lifetime of a variables stored in containers and member variables
Cppcheck will now warn for all cases here:

```cpp
#include <vector>
class CCluster {};
class MyClass
{ public:
    std::vector<CCluster*> m_cluster;
    void createCluster()
    {
        CCluster cl;
        CCluster* pcl=&cl;
        m_cluster.push_back(pcl);
    }
    void createCluster2()
    {
        CCluster cl;
        m_cluster.push_back(&cl);
    }
    CCluster* Cluster()
    {
        CCluster cl;
        CCluster* pcl=&cl;
        return pcl;
    }
    CCluster* Cluster2()
    {
        CCluster cl;
        return &cl;
    }
};

```
2018-11-21 08:43:57 +01:00
Daniel Marjamäki e6a5e0f752 Warn when there is a unknown macro 2018-11-13 16:49:15 +01:00
Daniel Marjamäki f8b0584f6a replace 'constexpr' with 'const' 2018-11-03 19:22:51 +01:00
Daniel Marjamäki f9b132e831 Tokenizer::simplifyTypedef: Fix bug with arrays 2018-10-21 21:15:34 +02:00
tam do thanh f33c09f1a7 Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" (#1334)
* Allow syntax "typedef 'typename' unsigned 'typename' (functon_name)()" for some old libraries
https://trac.cppcheck.net/ticket/7792

* Unnecessary check of "tokOffset", match-function already checks if it is null

* add testcase ticket #7792: simplifyTypedef124
2018-08-16 14:30:28 +02:00
IOBYTE fc1d62fd45 Fixed #7406 (Tokenizer::simplifyTypedef: array typedef used as template parameter) (#1257) 2018-05-22 17:31:58 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
IOBYTE 184537884f Don't remove the volatile keyword so we can properly overload functions. (#1218)
* Don't remove the volatile keyword so we can properly overload functions.

I fixed all the checks that had tests that use volatile.  There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.

* Fix unused private function warning.
2018-05-10 07:40:01 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Daniel Marjamäki cb6ed0555c Fix testrunner 2018-03-14 11:11:35 +01:00
IOBYTE 558e0757c2 Fix simplifyTypedef crash on lambda. (#1054) 2018-01-24 15:04:33 +01:00
IOBYTE 4710d80a40 Fix #5766 (FP: typedef array throws off parser) (#1052)
* Fix #5766 (FP: typedef array throws off parser)

* Fix travis build.
2018-01-24 09:51:22 +01:00
IOBYTE e6d285d3ca Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) (#1046) 2018-01-22 08:06:56 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki fc1ac180e6 Fixed #6218 (Template type aliasing misdetection) 2017-12-29 22:47:07 +01:00
hexcoder 051a18b120 pull request for ticket 8180 (better diagnostic output for bailouts) (#964)
* sync build instructions from readme.txt

* refactored the patch from ticket 8180. Moved logic from macros to the bailoutInternal function

* adapt to new bailout message format

* adapt to new bailout message format

* adapt to new bailout message format

* compile fix for Microsoft platform

* remove directory part from file locations in bailout message (normalize)

* remove directory part from valueflow message filter

* adapt tests to file format without directory part

* adapt tests to file format without directory part

* new line number agnostic assert_equals methods

* new line number agnostic assert_equals methods

* adapt to new method assertEqualsWithoutLineNumbers()

* adapt to new method assertEqualsWithoutLineNumbers()

* Bugfix: do not replace line number with spaces, remove it

* review changes: const char * -> std::string, size_t -> int, std::to_string() -> MathLib::toString()

* set #line at the beginning to guard against insertions from match compiler

* Bugfix: counting lines can be difficult :-) #line 1 -> #line 2

* added method stripDirectoryPart()

* added method stripDirectoryPart()

* used new method Path::stripDirectoryPart()

* new dependency path.h in lib/valueFlow.cpp

* code cleanup, removing redundant temporary objects and casts
2017-10-05 23:03:13 +02:00
Daniel Marjamäki 82527422a8 Fixed #5614 (Incorrect syntax error with function pointer typedef and dependent template types) 2017-08-30 19:18:05 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 213f9c1fc8 Fix testrunner 2016-10-21 02:20:51 +02:00
Daniel Marjamäki efa3aba32a Remove Tokenizer::simplifyNull() 2016-10-18 21:44:02 +02:00
Simon Martin 3f415673e4 Ticket #7541: Properly keep track of namespace definition end markers when there are multiple of them. 2016-10-01 20:46:33 +02:00
Frank Zingsheim 7c9a69357e Fixed #7696 (cppcheck 1.75 runs very slowly with style and/or performance checks) 2016-08-21 16:07:05 +02:00
Daniel Marjamäki adf16fae8b Remove handling of ##, __FILE__, __LINE__ from tokenizer 2016-07-25 07:58:03 +02:00
Daniel Marjamäki 1caa79c45f Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code (#6900). This fixes #7485. 2016-05-08 21:32:34 +02:00
amai2012 a54ec615f3 Run astyle 2016-04-25 11:12:35 +02:00
prozak 6592638022 - fix for #5749 defect: internal error
typedef expansion in cast operator was not processed correctly
2016-04-22 21:39:03 +08:00
Daniel Marjamäki dc2a92263a Fixed #7426 (RFC: time to replace simplifyEnum?) 2016-04-22 06:02:54 +02:00
PKEuS f8bf2b5776 Removed rest of variableHidingTypedef and variableHidingEnum checking 2016-02-06 20:55:41 +01:00
amai2012 d25258359a #7251 Remove checks variableHidingTypedef and variableHidingEnum 2016-02-06 15:37:58 +01:00
Alexander Mai ce12e1cea6 Remove unnecessaryForwardDeclaration check. It had false positives (e.g. #3663), was implemented in the Tokenizer and of little value. 2016-01-02 19:14:03 +01:00
Daniel Marjamäki 95009a4630 Merge pull request #745 from lanurmi/2016_ad
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki f5715c1496 Rename Unspecified platform type to Native 2016-01-01 16:39:41 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 297f2c78bd Fixed false positives variableHidingTypedef (#5624, #6507) 2015-10-26 10:06:52 +01:00
Simon Martin 5d40a3ab66 Ticket #6998: Properly handle "typedef unsigned T;" constructs. 2015-10-24 12:27:26 +02:00
Daniel Marjamäki fe4fac7eb2 Fixed #7058 (Tokenizer::simplifyTypedef: wrong simplification of enum constant 'AB::A' if AB is a struct typedef) 2015-10-18 04:55:04 +02:00
Daniel Marjamäki 6cf25825de Fixed #7030 (Tokenizer::simplifyTypedef: Label) 2015-10-15 16:56:22 +02:00
Daniel Marjamäki 97326fce13 Fixed #6992 (argument name of function typedef conflicts with local variable name) 2015-10-12 10:15:02 +02:00
PKEuS 0a34b206e8 Refactorization: Reduced code duplication in test suite 2015-10-08 11:35:51 +02:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Daniel Marjamäki d88dc3ed3e Reverted 00c54df07c (don't remove enum declarations) because it caused unexpected false positives 2015-09-06 18:37:22 +02:00
Daniel Marjamäki 00c54df07c Tokenizer: Don't remove enum declarations 2015-09-06 17:44:49 +02:00
PKEuS 2ace3d3144 Rewritten handling of declaration specifiers:
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
Simon Martin 6fb19b02d0 Properly differentiate arrays of pointers and pointers to arrays. 2015-08-25 21:19:19 +02:00