Commit Graph

1411 Commits

Author SHA1 Message Date
Daniel Marjamäki 1173186876 Fixed daca@home crash by stopping for unknown macro 'MACRO(a();b();)' 2020-03-12 13:28:09 +01:00
Daniel Marjamäki 900b99fbd8 Tokenizer; Report unknown macro used in function declaration 2020-03-10 20:22:46 +01:00
Daniel Marjamäki 5376ba1701 AST: Throw validation exception if ternary operator is missing operands 2020-03-07 21:46:38 +01:00
Daniel Marjamäki 5df6d5bc7c Tokenizer; Warn about unknown macro used in string concatenation 2020-02-28 21:52:01 +01:00
Daniel Marjamäki 38b570138f AST: Try to handle c++17 for properly 'for (auto [a,b]:c)' 2020-02-27 09:58:53 +01:00
Daniel Marjamäki e4937ed621 AST: Fixed wrong AST for cast '(std::vector<int>&&)s->second' 2020-02-25 21:05:49 +01:00
Daniel Marjamäki ef26b55737 AST: Fix wrong handling for '{scope} (expr)' 2020-02-23 15:01:06 +01:00
Daniel Marjamäki f07a71e3e1 Report unknown macros for pattern '%name% %num%' 2020-02-22 11:57:36 +01:00
Daniel Marjamäki cf10b1a220 fix ast for expression that starts with number 2020-02-21 21:11:32 +01:00
Daniel Marjamäki ec8c733afb Improved Qt simplification 2020-02-21 19:04:21 +01:00
Daniel Marjamäki 388b5118df Fixed bad ast (wrong result from iscast()) 2020-02-21 17:15:33 +01:00
Daniel Marjamäki 6f6f9dd5bc Tokenizer: Throw unknownMacro in non-executable scope 2020-02-19 21:12:58 +01:00
Rikard Falkeborn f6e7fb4bd9
Bugfix valuetype for some integer constants (#2545) 2020-02-19 07:51:39 +01:00
Daniel Marjamäki ae0a73a538 Fixed #9618 (isCast flag not set for c++ casts) 2020-02-16 16:46:40 +01:00
Daniel Marjamäki a350ed9bc2 Fixed #9023 (AST: wrong lhs for a = b + foo(A::Hash{}(""))) 2020-02-16 13:58:43 +01:00
Simon Martin 2840173a72 Ticket #9569: Do not substitute type aliases within enum definitions. (#2504) 2020-01-25 10:18:37 +01:00
Simon Martin 224a41361d Ticket #9572: Properly detect designated initializers. (#2496) 2020-01-25 10:14:16 +01:00
Paul Fultz II e07801a891 Fix issue 9563: new daca crash: findLambdaEndToken not finding end token (#2472) 2020-01-04 10:45:24 +01:00
Daniel Marjamäki c84ba10b37 Fixed #8774 (Wrong handling of function with name 'or') 2019-12-19 19:22:39 +01:00
Paul Fultz II ad352daa08 Fix issue 9535: Syntax Error: AST broken, 'if' doesn't have two operands. (#2450) 2019-12-16 12:17:01 +01:00
Daniel Marjamäki f614d32d6a Fixed #9519 (Syntax error on valid C++ 'enum {} (a)') 2019-12-15 08:40:04 +01:00
RobkeBaer 370196a14c Fix extern c typedef syntax error (#2438)
* Fix extern c typedef syntax error

* Fix extraWhiteSpaceError

* Move test from testgarbage to testtokenize
2019-12-12 13:51:14 +01:00
Paul Fultz II ad2f71338c Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda (#2433)
* Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda

* Fix incorrect matchers
2019-12-10 21:21:07 +01:00
Paul Fultz II ea2916a3e4 Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands. (#2429)
* Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands.

* Fix typo
2019-12-07 21:16:25 +01:00
Paul Fultz II 56e17fb228 Fix issue 9524: Syntax Error: AST broken, 'if' doesn't have two operands. (#2432) 2019-12-07 21:06:45 +01:00
IOBYTE f637d97080 Fix 9509 (Syntax error on empty attribute list) (#2423) 2019-12-06 05:17:19 +01:00
Paul Fultz II 2978c67e6f Fix issue 9511: Syntax Error: AST broken, 'if' doesn't have two operands. (#2428) 2019-12-06 04:19:46 +01:00
Paul Fultz II f77347d7b4 Fix crash 9492: Crash in FwdAnalysis::checkRecursive() (condTok is nullptr) (#2411)
* Fix crash 9492: Crash in FwdAnalysis::checkRecursive() (condTok is nullptr)

* Formatting
2019-12-01 14:53:03 +01:00
Daniel Marjamäki ab2274b8ad AST: lambdas and scopes in expressions 2019-11-23 21:36:36 +01:00
Daniel Marjamäki ebd32cfd73 Syntax error: if (retval==) 2019-11-23 18:50:46 +01:00
IOBYTE fb1d60bfb1 fix syntax error for num.operator std::string()[0] (#2389) 2019-11-23 17:42:24 +01:00
IOBYTE df952926f8 fix syntax error for a.operator++() ? a.operator--() : 0 (#2382) 2019-11-20 22:13:32 +01:00
Paul Fultz II 479fbb85a2 Fix issue 9443: Internal error: Token::astOperand2() cyclic dependency. (#2376)
* Improve nested init lists

* Fix issue 9443: Internal error: Token::astOperand2() cyclic dependency.
2019-11-19 11:38:03 +01:00
IOBYTE 7f6ebaa6b2 fix syntax error for VTK_LEGACY_BODY(vtkMatrix3x3::operator[], "VTK 7.0"); (#2372) 2019-11-18 06:38:53 +01:00
IOBYTE 754c1fff66 fix syntax error for conversion operator for type with global namespace (#2365)
* fix syntax error for conversion operator for type with global namespace

* fix syntax error when taking address of operator function

* fix syntax error for using ::operator "" _a;

* fix syntax error for template<> void operator "" _h<'a', 'b', 'c'>() {}

* fix syntax error for operator in parentheses
2019-11-16 08:03:13 +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
IOBYTE 2eb575d990 Fix #9468 (Syntax error on valid C++) (#2358) 2019-11-14 09:26:21 +01:00
Daniel Marjamäki 8c8952ae7c Fixed #9324 (FP compareBoolExpressionWithInt - when using C++ and/or operator synonyms) 2019-11-03 12:53:30 +01:00
Daniel Marjamäki 03ae0ccef3 AST: Do not hang for code 'foo({ for (a;b;c) {} });' 2019-11-03 11:02:59 +01:00
Daniel Marjamäki 791242ea78 Fixed #6975 and #9376 (Tokenizer: unknown macro without semicolon) 2019-11-02 19:34:19 +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
Daniel Marjamäki 8c591308cb astyle formatting
[ci skip]
2019-10-30 18:19:45 +01:00
Daniel Marjamäki 277c59e5f3 AST: Fixed AST for lambda that returns template type 2019-10-30 16:05:34 +01:00
Daniel Marjamäki 2c1905cc2b AST: Somewhat better handling of '{x}' function parameters 2019-10-27 12:00:08 +01:00
Daniel Marjamäki f03945a9e2 AST: better handling when returning list of lambdas 2019-10-26 19:19:20 +02:00
Daniel Marjamäki cf1dd2e6f6 AST: Fix AST when returning list of lambda functions 2019-10-22 18:39:59 +02:00
IOBYTE e4d2e9d2af Fix #9421 (syntaxError on incomplete code (from z3)) (#2274) 2019-10-16 20:56:53 +02:00
Rikard Falkeborn 297360920a Keep prefix in string and char literals (#2272)
Keeping the prefix in the token allows cppcheck to print the correct
string and char literals in debug and error messages.

To achieve this, move some of the helper functions from token.cpp to
utils.h so that checks that look at string and char literals can reuse
them. This is a large part of this commit.

Note that the only user visible change is that when string and char
literals are printed in error messages, the prefix is now included.

For example:

	int f() {
		return test.substr( 0 , 4 ) == U"Hello" ? 0 : 1 ;
	};

now prints U"Hello" instead of "Hello" in the error message.
2019-10-16 11:41:33 +02:00
Daniel Marjamäki b97436e8f8 Fixed #9382 (Hang: CheckLeakAutoVar pellepl/spiffs/src/spiffs_hydrogen.c) 2019-10-06 09:52:05 +02:00