diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-09-20 18:37:29 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-09-20 18:37:29 +0200 |
commit | 53d834a7fae3afffebb45a2d66908f705773a7fc (patch) | |
tree | 4af979256b3f85649ada1d5cabc08c21cf6947db /libgcc/enable-execute-stack-empty.c | |
parent | 27282dc0931484c31fa391772499d878afcc746a (diff) | |
download | gcc-53d834a7fae3afffebb45a2d66908f705773a7fc.zip gcc-53d834a7fae3afffebb45a2d66908f705773a7fc.tar.gz gcc-53d834a7fae3afffebb45a2d66908f705773a7fc.tar.bz2 |
c, c++: Accept __builtin_classify_type (typename)
As mentioned in my stdckdint.h mail, __builtin_classify_type has
a problem that argument promotion (the argument is passed to ...
prototyped builtin function) means that certain type classes will
simply never appear.
I think it is too late to change how it behaves, lots of code in the
wild might rely on the current behavior.
So, the following patch adds option to use a typename rather than
expression as the operand to the builtin, making it behave similarly
to sizeof, typeof or say the clang _Generic extension where the
first argument can be there not just expression, but also typename.
I think we have other prior art here, e.g. __builtin_va_arg also
expects typename.
I've added this to both C and C++, because it would be weird if it
supported it only in C and not in C++.
2023-09-20 Jakub Jelinek <jakub@redhat.com>
gcc/
* builtins.h (type_to_class): Declare.
* builtins.cc (type_to_class): No longer static. Return
int rather than enum.
* doc/extend.texi (__builtin_classify_type): Document.
gcc/c/
* c-parser.cc (c_parser_postfix_expression_after_primary): Parse
__builtin_classify_type call with typename as argument.
gcc/cp/
* parser.cc (cp_parser_postfix_expression): Parse
__builtin_classify_type call with typename as argument.
* pt.cc (tsubst_copy_and_build): Handle __builtin_classify_type
with dependent typename as argument.
gcc/testsuite/
* c-c++-common/builtin-classify-type-1.c: New test.
* g++.dg/ext/builtin-classify-type-1.C: New test.
* g++.dg/ext/builtin-classify-type-2.C: New test.
* gcc.dg/builtin-classify-type-1.c: New test.
Diffstat (limited to 'libgcc/enable-execute-stack-empty.c')
0 files changed, 0 insertions, 0 deletions