diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2018-12-06 18:47:52 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2018-12-06 18:47:52 +0100 |
commit | 30bd42b979140de02d343bb1014e9aece2e683c1 (patch) | |
tree | 9425afdd3c7769016beca989282d7389695f48ac /gcc/doc | |
parent | 415937b37d77d7a8ec11273060d45a04b1f3ca62 (diff) | |
download | gcc-30bd42b979140de02d343bb1014e9aece2e683c1.zip gcc-30bd42b979140de02d343bb1014e9aece2e683c1.tar.gz gcc-30bd42b979140de02d343bb1014e9aece2e683c1.tar.bz2 |
asm qualifiers (PR55681)
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.
From-SVN: r266859
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index e27bc02..70c46cf 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -8447,7 +8447,7 @@ for a C symbol, or to place a C variable in a specific register. A basic @code{asm} statement has the following syntax: @example -asm @r{[} volatile @r{]} ( @var{AssemblerInstructions} ) +asm @var{asm-qualifiers} ( @var{AssemblerInstructions} ) @end example The @code{asm} keyword is a GNU extension. @@ -8575,17 +8575,19 @@ Extended @code{asm} syntax uses colons (@samp{:}) to delimit the operand parameters after the assembler template: @example -asm @r{[}volatile@r{]} ( @var{AssemblerTemplate} +asm @var{asm-qualifiers} ( @var{AssemblerTemplate} : @var{OutputOperands} @r{[} : @var{InputOperands} @r{[} : @var{Clobbers} @r{]} @r{]}) -asm @r{[}volatile@r{]} goto ( @var{AssemblerTemplate} +asm @var{asm-qualifiers} ( @var{AssemblerTemplate} : : @var{InputOperands} : @var{Clobbers} : @var{GotoLabels}) @end example +where in the last form, @var{asm-qualifiers} contains @code{goto} (and in the +first form, not). The @code{asm} keyword is a GNU extension. When writing code that can be compiled with @option{-ansi} and the |