aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-03-08 08:45:23 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-03-08 08:45:23 +0100
commit5d1504d42af6b12efeb83a2056424ceb1512961f (patch)
tree209c2c9466dd1c797803e52abe98f97ce69792b3 /gcc/cp/parser.c
parented3ea9f271aecfdea1650c87f835efa70a6f1bac (diff)
downloadgcc-5d1504d42af6b12efeb83a2056424ceb1512961f.zip
gcc-5d1504d42af6b12efeb83a2056424ceb1512961f.tar.gz
gcc-5d1504d42af6b12efeb83a2056424ceb1512961f.tar.bz2
re PR c++/89585 (GCC 8.3: asm volatile no longer accepted at file scope)
PR c++/89585 * parser.c (cp_parser_asm_definition): Just warn instead of error on volatile qualifier outside of function body. * g++.dg/asm-qual-3.C: Adjust expected diagnostics for toplevel asm volatile. From-SVN: r269483
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5ac6fc4..e6c2036 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19782,9 +19782,12 @@ cp_parser_asm_definition (cp_parser* parser)
inform (volatile_loc, "first seen here");
}
else
- volatile_loc = loc;
- if (!first_loc)
- first_loc = loc;
+ {
+ if (!parser->in_function_body)
+ warning_at (loc, 0, "asm qualifier %qT ignored outside of "
+ "function body", token->u.value);
+ volatile_loc = loc;
+ }
cp_lexer_consume_token (parser->lexer);
continue;
@@ -19830,10 +19833,10 @@ cp_parser_asm_definition (cp_parser* parser)
bool inline_p = (inline_loc != UNKNOWN_LOCATION);
bool goto_p = (goto_loc != UNKNOWN_LOCATION);
- if (!parser->in_function_body && (volatile_p || inline_p || goto_p))
+ if (!parser->in_function_body && (inline_p || goto_p))
{
error_at (first_loc, "asm qualifier outside of function body");
- volatile_p = inline_p = goto_p = false;
+ inline_p = goto_p = false;
}
/* Look for the opening `('. */