diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-10-20 19:41:49 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-10-20 19:42:28 +0100 |
commit | 154c6d430ee173904237de64d5aae11565201318 (patch) | |
tree | cc68a8d85ac866b452cb25e711e7926964b1776a /gcc | |
parent | 885f9b4ad59a1c37742b68505edc80c7f419d9a4 (diff) | |
download | gcc-154c6d430ee173904237de64d5aae11565201318.zip gcc-154c6d430ee173904237de64d5aae11565201318.tar.gz gcc-154c6d430ee173904237de64d5aae11565201318.tar.bz2 |
doc: Fix documentation around 'asm' keyword in C++
The documentation on asm statements suggests asm is always a GNU
extension, but it's been part of ISO C++ since the first standard.
The documentation of -fno-asm is wrong for C++ as it states that it only
affects typeof, but actually it affects typeof and asm (despite asm
being part of ISO C++).
gcc/ChangeLog:
* doc/extend.texi (Basic Asm): Clarify that asm is not an
extension in C++.
* doc/invoke.texi (-fno-asm): Fix description for C++.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/doc/extend.texi | 10 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 16 |
2 files changed, 14 insertions, 12 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 3c942d8..eee4c67 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9728,10 +9728,12 @@ A basic @code{asm} statement has the following syntax: asm @var{asm-qualifiers} ( @var{AssemblerInstructions} ) @end example -The @code{asm} keyword is a GNU extension. -When writing code that can be compiled with @option{-ansi} and the -various @option{-std} options, use @code{__asm__} instead of -@code{asm} (@pxref{Alternate Keywords}). +For the C language, the @code{asm} keyword is a GNU extension. +When writing C code that can be compiled with @option{-ansi} and the +@option{-std} options that select C dialects without GNU extensions, use +@code{__asm__} instead of @code{asm} (@pxref{Alternate Keywords}). For +the C++ language, @code{asm} is a standard keyword, but @code{__asm__} +can be used for code compiled with @option{-fno-asm}. @subsubheading Qualifiers @table @code diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c93d8224..6d1e328 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2485,14 +2485,14 @@ supported for C as this construct is allowed by C++. Do not recognize @code{asm}, @code{inline} or @code{typeof} as a keyword, so that code can use these words as identifiers. You can use the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} -instead. @option{-ansi} implies @option{-fno-asm}. - -In C++, this switch only affects the @code{typeof} keyword, since -@code{asm} and @code{inline} are standard keywords. You may want to -use the @option{-fno-gnu-keywords} flag instead, which has the same -effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this -switch only affects the @code{asm} and @code{typeof} keywords, since -@code{inline} is a standard keyword in ISO C99. +instead. In C, @option{-ansi} implies @option{-fno-asm}. + +In C++, @code{inline} is a standard keyword and is not affected by +this switch. You may want to use the @option{-fno-gnu-keywords} flag +instead, which disables @code{typeof} but not @code{asm} and +@code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), +this switch only affects the @code{asm} and @code{typeof} keywords, +since @code{inline} is a standard keyword in ISO C99. @item -fno-builtin @itemx -fno-builtin-@var{function} |