diff options
author | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-15 12:16:13 +0000 |
---|---|---|
committer | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-15 12:16:13 +0000 |
commit | bdd07b44ffe70f2d6f3c76b1563e7cb4f2c42336 (patch) | |
tree | 7baa283db79257b474598846b79f119e071d5cc1 /gcc/c-parser.c | |
parent | 9a4a7de4de1472638826f908d37367dbfcd47cdf (diff) | |
download | gcc-bdd07b44ffe70f2d6f3c76b1563e7cb4f2c42336.tar.gz |
Require parentheses when parsing transaction expressions.
gcc/
* c-parser.c (c_parser_transaction_expression): Require parentheses
when parsing transaction expressions.
gcc/cp/
* parser.c (cp_parser_transaction_expression): Require parentheses
when parsing transaction expressions.
gcc/testsuite/
* c-c++-common/tm/trxn-expr-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181383 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index aed390f31e8..b88b11fc430 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -10699,7 +10699,7 @@ c_parser_transaction_expression (c_parser *parser, enum rid keyword) } parser->in_transaction = this_in; - if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)) + if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>")) { tree expr = c_parser_expression (parser).value; ret.original_type = TREE_TYPE (expr); @@ -10708,10 +10708,15 @@ c_parser_transaction_expression (c_parser *parser, enum rid keyword) TRANSACTION_EXPR_RELAXED (ret.value) = 1; SET_EXPR_LOCATION (ret.value, loc); ret.original_code = TRANSACTION_EXPR; + if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>")) + { + c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL); + goto error; + } } else { - c_parser_error (parser, "expected %<(%>"); + error: ret.value = error_mark_node; ret.original_code = ERROR_MARK; ret.original_type = NULL; |