diff options
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index c8afab2..6957297 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6411,7 +6411,9 @@ c_parser_for_statement (c_parser *parser, bool ivdep, unsigned short unroll, The form with asm-goto-operands is valid if and only if the asm-qualifier-list contains goto, and is the only allowed form in that case. - Duplicate asm-qualifiers are not allowed. */ + Duplicate asm-qualifiers are not allowed. + + The :: token is considered equivalent to two consecutive : tokens. */ static tree c_parser_asm_statement (c_parser *parser) @@ -6509,17 +6511,28 @@ c_parser_asm_statement (c_parser *parser) nsections = 3 + is_goto; for (section = 0; section < nsections; ++section) { - if (!c_parser_require (parser, CPP_COLON, - is_goto - ? G_("expected %<:%>") - : G_("expected %<:%> or %<)%>"), - UNKNOWN_LOCATION, is_goto)) + if (c_parser_next_token_is (parser, CPP_SCOPE)) + { + ++section; + if (section == nsections) + { + c_parser_error (parser, "expected %<)%>"); + goto error_close_paren; + } + c_parser_consume_token (parser); + } + else if (!c_parser_require (parser, CPP_COLON, + is_goto + ? G_("expected %<:%>") + : G_("expected %<:%> or %<)%>"), + UNKNOWN_LOCATION, is_goto)) goto error_close_paren; /* Once past any colon, we're no longer a simple asm. */ simple = false; if ((!c_parser_next_token_is (parser, CPP_COLON) + && !c_parser_next_token_is (parser, CPP_SCOPE) && !c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) || section == 3) switch (section) |