asm qualifiers (PR55681)

Programming / Compilers / GCC - segher [138bc75d-0d04-0410-961f-82ee72b054a4] - 6 December 2018 17:47 EST

PR55681 observes that currently only one qualifier is allowed for inline asm, so that e.g. "volatile asm" is allowed, "const asm" is also okay (with a warning), but "const volatile asm" gives an error. Also "goto" has to be last.

This patch changes things so that only "asm-qualifiers" are allowed, that is "volatile" and "goto", in any combination, in any order, but without repetitions.


PR inline-asm/55681
- doc/extend.texi (Basic Asm): Update grammar. (Extended Asm): Update grammar.

gcc/c/ PR inline-asm/55681
- c-parser.c (c_parser_asm_statement): Update grammar. Allow any combination of volatile and goto, in any order, without repetitions.

gcc/cp/ PR inline-asm/55681
- parser.c (cp_parser_asm_definition): Update grammar. Allow any combination of volatile and goto, in any order, without repetitions.

gcc/testsuite/ PR inline-asm/55681
- gcc.dg/asm-qual-1.c: Test that "const" and "restrict" are refused.
- gcc.dg/asm-qual-2.c: New test, test that asm-qualifiers are allowed in any order, but that duplicates are not allowed.

1ba73f97d19 asm qualifiers (PR55681)
gcc/ChangeLog | 6 +++
gcc/c/ChangeLog | 6 +++
gcc/c/c-parser.c | 74 +++++++++++++++++++++----------------
gcc/cp/ChangeLog | 6 +++
gcc/cp/parser.c | 77 ++++++++++++++++++++++++++-------------
gcc/doc/extend.texi | 8 ++--
gcc/testsuite/ChangeLog | 7 ++++
gcc/testsuite/gcc.dg/asm-qual-1.c | 10 +++--
gcc/testsuite/gcc.dg/asm-qual-2.c | 21 +++++++++++
9 files changed, 152 insertions(+), 63 deletions(-)

Upstream: gcc.gnu.org


  • Share