diff options
author | Torvald Riegel <triegel@redhat.com> | 2011-11-15 12:16:13 +0000 |
---|---|---|
committer | Torvald Riegel <torvald@gcc.gnu.org> | 2011-11-15 12:16:13 +0000 |
commit | 69b765189a3dd5f235c2711d0908bad331ce40b7 (patch) | |
tree | 7baa283db79257b474598846b79f119e071d5cc1 /gcc/c-parser.c | |
parent | 402356d1466804239212e0fec68d3753114d0cfe (diff) | |
download | gcc-69b765189a3dd5f235c2711d0908bad331ce40b7.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.
From-SVN: r181383
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; |