aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-08-11 09:34:15 +0200
committerJakub Jelinek <jakub@redhat.com>2023-08-11 09:34:15 +0200
commit607d9d50ee44163cee621cd991600acaf78c2fee (patch)
tree32195274031ddc81bb6f9f37dde88b7ac5af35c0 /gcc/doc/extend.texi
parentf956c232649e4bb7482786cd54e5d5b4085cd00a (diff)
downloadgcc-607d9d50ee44163cee621cd991600acaf78c2fee.zip
gcc-607d9d50ee44163cee621cd991600acaf78c2fee.tar.gz
gcc-607d9d50ee44163cee621cd991600acaf78c2fee.tar.bz2
c: Add __typeof_unqual__ and __typeof_unqual support
As I mentioned in my stdckdint.h mail, I think having __ prefixed keywords for the typeof_unqual keyword which can be used in earlier language modes can be useful, not all code can be switched to C23 right away. The following patch implements that. It keeps the non-C23 behavior for it for the _Noreturn functions to stay compatible with how __typeof__ behaves. I think we don't need it for C++, in C++ we have standard traits to remove qualifiers etc. 2023-08-11 Jakub Jelinek <jakub@redhat.com> gcc/ * doc/extend.texi (Typeof): Document typeof_unqual and __typeof_unqual__. gcc/c-family/ * c-common.cc (c_common_reswords): Add __typeof_unqual and __typeof_unqual__ spellings of typeof_unqual. gcc/c/ * c-parser.cc (c_parser_typeof_specifier): Handle __typeof_unqual and __typeof_unqual__ as !is_std. gcc/testsuite/ * gcc.dg/c11-typeof-2.c: New test. * gcc.dg/c11-typeof-3.c: New test. * gcc.dg/gnu11-typeof-3.c: New test. * gcc.dg/gnu11-typeof-4.c: New test.
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 89c5b4e..73a9972 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -843,6 +843,13 @@ Thus, @code{array (pointer (char), 4)} is the type of arrays of 4
pointers to @code{char}.
@end itemize
+The ISO C2X operator @code{typeof_unqual} is available in ISO C2X mode
+and its result is the non-atomic unqualified version of what @code{typeof}
+operator returns. Alternate spelling @code{__typeof_unqual__} is
+available in all C modes and provides non-atomic unqualified version of
+what @code{__typeof__} operator returns.
+@xref{Alternate Keywords}.
+
@cindex @code{__auto_type} in GNU C
In GNU C, but not GNU C++, you may also declare the type of a variable
as @code{__auto_type}. In that case, the declaration must declare