diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2018-12-19 17:16:05 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2018-12-19 17:16:05 +0100 |
commit | 1edf88662b51da93460b6139344edb5f9b943b0e (patch) | |
tree | 4074dd0bc5bdd8115294b76ba0ef8f2f85e76a2a /gcc/c | |
parent | db4fd626ee2bb431adadddf5eca5fba104cea5ca (diff) | |
download | gcc-1edf88662b51da93460b6139344edb5f9b943b0e.zip gcc-1edf88662b51da93460b6139344edb5f9b943b0e.tar.gz gcc-1edf88662b51da93460b6139344edb5f9b943b0e.tar.bz2 |
c/c++, asm: Use nicer error for const and restrict
Not all qualifiers are asm qualifiers. We can talk about that in a
nicer way than just giving a generic parser error.
This also adds two testcases for C++, that previously were for C only.
c/
* c-parser.c (c_parser_asm_statement) <RID_CONST, RID_RESTRICT>: Give
a more specific error message (instead of just falling through).
cp/
* parser.c (cp_parser_asm_definition) <RID_CONST, RID_RESTRICT>: Give
a more specific error message (instead of just falling through).
testsuite/
* g++.dg/asm-qual-1.C: New testcase.
* g++.dg/asm-qual-2.C: New testcase.
* gcc.dg/asm-qual-1.c: Update.
From-SVN: r267279
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 52b2c65..6e12dda 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,10 @@ 2018-12-19 Segher Boessenkool <segher@kernel.crashing.org> + * c-parser.c (c_parser_asm_statement) <RID_CONST, RID_RESTRICT>: Give + a more specific error message (instead of just falling through). + +2018-12-19 Segher Boessenkool <segher@kernel.crashing.org> + * c-parser.c (c_parser_asm_statement): Keep track of the location each asm qualifier is first seen; use that to give nicer "duplicate asm qualifier" messages. Delete 'quals" variable, instead pass the diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 652e53c..0def497 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6411,6 +6411,12 @@ c_parser_asm_statement (c_parser *parser) c_parser_consume_token (parser); continue; + case RID_CONST: + case RID_RESTRICT: + error_at (loc, "%qE is not an asm qualifier", token->value); + c_parser_consume_token (parser); + continue; + default: break; } |