Commit Graph

274 Commits

Author SHA1 Message Date
Rikard Falkeborn f6a2034a4c Add regression tests for fixed crashes (#2379)
The invalid code in Trac tickets #8750, #8753, #8756, #8762, #8764
and #8765 previously crashed cppcheck. Now it throws a syntax error
instead. Add some tests for these tickets.
2019-11-19 21:50:53 +01:00
IOBYTE 3a617fa04a Fix #9472 (Syntax error on valid C++ code) (#2363)
There are probably a lot more valid code patterns that generates syntax
errors so I added "operator" to the error message to make it easier to
find them.
2019-11-15 07:03:57 +01:00
Daniel Marjamäki 7e0fc4fb00 Tokenizer: Detect more syntax errors when operator does not have operands 2019-11-14 21:18:31 +01:00
IOBYTE 0fed6f0091 fix clang testsuite crash (#2341) 2019-11-09 18:00:21 +01:00
Daniel Marjamäki 35d04cd2d3 AST: non-standard handling of ; in argument list for unknown macro 2019-11-01 09:05:45 +01:00
Daniel Marjamäki b96a347914 Tokenizer: Report unknown macro when argument list contains if/for/while/switch 2019-10-30 19:36:19 +01:00
Armin Müller a4ca6dfee7 testgarbage.cpp: Spelling in comment (#2172) 2019-09-12 20:52:39 +02:00
IOBYTE 28a95802a2 template simplifier: fix syntax error false positive (an expression can't be a template) (#2115)
https://stackoverflow.com/questions/57590411/cppcheck-syntax-error-with-using-typedef
2019-08-27 06:37:58 +02:00
versat 50c6af5e5d astyle formatting
[ci skip]
2019-08-23 10:19:29 +02:00
Thomas Niederberger d122b1c722 Fix issue with __declspec and final (#2107)
* Add missing Qt macros

Add two Qt macros that were missing

* Fix issue with __declspec and final

This change is a bit naive but it fixes the issues I was having when combining __declspec(dllexport) and final classes. Without the fix I get errors along the line of "The code 'class x final :' is not handled. You can use -I or --include to add handling of this code. "
2019-08-23 06:43:02 +02:00
IOBYTE 999d2f797c Fix #9225 (Crash on valid C++14 code) (#2031)
* Fix #9225 (Crash on valid C++14 code)

This only fixes the crash. Specialization of nested templates is still
broken.

* fix cppcheck warnings

* fixed another cppcheck warning
2019-07-24 19:20:19 +02:00
IOBYTE 7ac22677b8 regression test for daca codeblocks crash (#1974) 2019-07-10 07:16:16 +02:00
Paul Fultz II 8f4cb36e1e Check for more garbage code (#1949)
* Check for garbage commas

* Find garbage dot operator
2019-07-03 08:28:24 +02:00
Scott Furry a195477470 Correct Zero/Null as pointer constant (#1938)
Building with enhanced clang warnings indicated a large number of
instances with the warning:

`warning: zero as null pointer constant`

Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.

Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
IOBYTE 41cf865947 template simplifier: add links to expanded return type in function forward declaration (#1868)
This crash was seen in daca capnproto but I could only get creduce to
generate garbage code so the test is in checkgarbage.
2019-06-03 07:06:04 +02:00
Daniel Marjamäki 57c6628732 Revert 'Cleaning up unsimplified templates'. This fix caused problems. 2019-05-16 21:11:04 +02:00
Daniel Marjamäki d58d4273f9 Cleaning up unsimplified templates 2019-05-11 13:00:03 +02:00
amai2012 ebe7783493 Adjust some test results for invalid code. Comment out still crashing example for #8913 2019-04-19 17:42:21 +02:00
amai2012 28bc3cad92 #8913 SIGSEGV in CheckUnusedVar::checkFunctionVariableUsage - C++/CLI code 2019-04-19 13:55:25 +02:00
Daniel Marjamäki 73433c2961 Syntax error: Clarify a syntax error in audacity 2019-03-31 10:46:59 +02:00
Daniel Marjamäki b30d463baf Fix wrong syntax error 2019-03-31 09:34:19 +02:00
Daniel Marjamäki 0f6a90c595 Fixed #9069 (crash on invalid code: ' x= y{ } name5 ')
Credit to OSS-Fuzz for reporting this!
2019-03-27 18:17:11 +01:00
Daniel Marjamäki c77f31319d Fix crash when checking re2c textfile 2019-03-26 20:51:41 +01:00
Daniel Marjamäki c262aeffdd Fixed #9068 (crash on invalid code) 2019-03-26 19:57:32 +01:00
Daniel Marjamäki 15676612c0 Fixed #9034 (crash on reading invalid code: '> typedef') 2019-03-26 16:14:24 +01:00
Daniel Marjamäki 49e2f9d551 Fixed #9063 (Crash on invalid code: x='0' ++ '0' ( return)[ ];) 2019-03-25 15:29:23 +01:00
Daniel Marjamäki a9082c902a Fixed #9058 (crash on invalid code in FwdAnalysis::checkRecursive) 2019-03-23 18:27:41 +01:00
Daniel Marjamäki 3dc34f1515 Disable all simplified checks 2019-03-16 09:17:50 +01:00
IOBYTE 9490d0db8c token simplifier: fix crashes related to #8972 (#1659) 2019-02-11 07:45:03 +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
practicalswift 0a1b3a9d6f Fix typos (#1568) 2019-01-06 17:15:57 +01:00
Daniel Marjamäki 615903c6be Improve syntax errors for unmatched (){}[] 2019-01-05 11:56:21 +01:00
Daniel Marjamäki 19514331fb Fixed #8907 (unknown macro not detected) 2019-01-01 19:30:13 +01:00
Daniel Marjamäki 96929c53c0 Fixed #8873 (Add syntaxError when there is no RHS for +-) 2018-12-01 17:29:41 +01:00
Paul Fultz II 2b6cc33dc6 Fix issue 8757: Throw syntax error on invalid code (#1378)
* Fix issue 8757: Throw syntax error on invalid code

* Fix FP with lambda returns

* Remove double percent

* Check more keywords

* Skip preprocessor directives

* Check for valid PP directive

* Fix preprocessor check

* Dont check for preprocessor directives
2018-10-28 17:17:53 +01:00
Daniel Marjamäki dc38681a56 Remove FIXME in AST validation. Ticket #8749 2018-10-22 11:37:24 +02:00
Daniel Marjamäki c483bcb12b Fixed testrunner 2018-10-22 00:28:09 +02:00
Daniel Marjamäki 465db2dff7 Fixed #8786 (internalAstError on valid code with C style cast) 2018-10-18 20:17:23 +02:00
Daniel Marjamäki 140b0b5ae9 astyle formatting
[ci skip]
2018-10-13 18:42:09 +02:00
Paul Fultz II 9cf092657c Skip some ast errors to avoid regressions (#1422)
* Skip some ast errors to avoid regressions

* Use simpleMatch

* Skip operator functions

* Add a test for issue 8788
2018-10-13 18:38:44 +02:00
Paul Fultz II 4e7ed9ea6e More robust checking for crashes in followVar (#1375)
More robust checking for crashes in followVar
2018-09-13 09:19:15 +02:00
orbitcowboy 399a90c00e #8383: Segmentation fault on garbage code. Added regression test. 2018-09-10 16:28:32 +02:00
orbitcowboy 95da9f77c4 #8385: Segmentation fault on garbage code. Added regression test. 2018-09-10 16:24:09 +02:00
orbitcowboy bc84ce43ec #8265: Segmentation fault on garbage code. Added regression test. 2018-09-10 16:17:44 +02:00
amai2012 4b249877f1 #8709 Add stability regression test 2018-09-10 08:40:53 +02:00
Daniel Marjamäki b3f12fcc7e astyle formatting
[ci skip]
2018-09-09 07:10:37 +02:00
Paul Fultz II fa40b821e6 Fix issue 8740: Add a pass to check for valid operators (#1372) 2018-09-08 21:10:34 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 9f92685b92 SymbolDatabase: Throw InternalError if parsing fails 2018-04-02 13:14:48 +02:00