aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2011-11-15 12:16:13 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2011-11-15 12:16:13 +0000
commit69b765189a3dd5f235c2711d0908bad331ce40b7 (patch)
tree7baa283db79257b474598846b79f119e071d5cc1 /gcc/c-parser.c
parent402356d1466804239212e0fec68d3753114d0cfe (diff)
downloadgcc-69b765189a3dd5f235c2711d0908bad331ce40b7.zip
gcc-69b765189a3dd5f235c2711d0908bad331ce40b7.tar.gz
gcc-69b765189a3dd5f235c2711d0908bad331ce40b7.tar.bz2
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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index aed390f..b88b11f 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;