C++: Use MAX_EXPRESSION_DEPTH and increase to 1000

We do not want different depths for different ASTs.

Change-Id: Idc4aff226b20dbc5c14a77ef729b16044b55b837
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-07-06 08:50:16 +02:00
parent 29c7bcdf7e
commit 17a4e76c50

View File

@@ -40,9 +40,8 @@
#endif
#define CPLUSPLUS_NO_DEBUG_RULE
#define MAX_EXPRESSION_DEPTH 100
#define MAX_EXPRESSION_DEPTH 1000
#define MAX_STATEMENT_DEPTH 100
#define MAX_INITIALIZER_CLAUSE_DEPTH 2000
using namespace CPlusPlus;
@@ -2801,7 +2800,7 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
for (++_initializerClauseDepth.top();
LA() == T_COMMA
&& LA(2) != T_RBRACE
&& _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH;
&& _initializerClauseDepth.top() <= MAX_EXPRESSION_DEPTH;
++_initializerClauseDepth.top()) {
consumeToken(); // consume T_COMMA
@@ -2817,7 +2816,7 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
}
}
const bool result = _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH;
const bool result = _initializerClauseDepth.top() <= MAX_EXPRESSION_DEPTH;
_initializerClauseDepth.pop();
if (!result)
warning(cursor(), "Reached parse limit for initializer clause");