c++: Change the mangling of __alignof__ [PR88115]
authorPatrick Palka <ppalka@redhat.com>
Wed, 11 Nov 2020 20:11:23 +0000 (15:11 -0500)
committerPatrick Palka <ppalka@redhat.com>
Wed, 11 Nov 2020 20:11:23 +0000 (15:11 -0500)
commitb1c9b3c3408c1ec8043f9b9e1a148f84bb7f3b25
tree005cdc1c5d50f3abaf02bd6680a57bf9c489de81
parent61827d5d9a5a09a8c05d5e41f95b03ebc6c43f61
c++: Change the mangling of __alignof__ [PR88115]

This patch changes the mangling of __alignof__ to v111__alignof__,
making its mangling distinct from that of alignof(type) and
alignof(expr).

How we mangle ALIGNOF_EXPR now depends on its ALIGNOF_EXPR_STD_P flag,
which after the previous patch gets consistently set for alignof(type)
as well as alignof(expr).

gcc/c-family/ChangeLog:

PR c++/88115
* c-opts.c (c_common_post_options): Update latest_abi_version.

gcc/ChangeLog:

PR c++/88115
* common.opt (-fabi-version): Document =15.
* doc/invoke.texi (C++ Dialect Options): Likewise.

gcc/cp/ChangeLog:

PR c++/88115
* mangle.c (write_expression): Mangle __alignof_ differently
from alignof when the ABI version is at least 15.

libiberty/ChangeLog:

PR c++/88115
* cp-demangle.c (d_print_comp_inner)
<case DEMANGLE_COMPONENT_EXTENDED_OPERATOR>: Don't print the
"operator " prefix for __alignof__.
<case DEMANGLE_COMPONENT_UNARY>: Always print parens around the
operand of __alignof__.
* testsuite/demangle-expected: Test demangling for __alignof__.

gcc/testsuite/ChangeLog:

PR c++/88115
* g++.dg/abi/macro0.C: Adjust.
* g++.dg/cpp0x/alignof7.C: New test.
* g++.dg/cpp0x/alignof8.C: New test.
gcc/c-family/c-opts.c
gcc/common.opt
gcc/cp/mangle.c
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/abi/macro0.C
gcc/testsuite/g++.dg/cpp0x/alignof7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/alignof8.C [new file with mode: 0644]
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected