* [committed] libstdc++: Use reserved name for attribute [PR101055]
@ 2021-06-14 10:53 Jonathan Wakely
2021-06-14 13:06 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2021-06-14 10:53 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
The no_unique_address attribute is not a reserved name until C++20, so
to use it in C++11/14/17 modes we should use the __no_unique_address_
form. We already use that form when using the attribute, but not in the
__has_cpp_attribute check.
libstdc++-v3/ChangeLog:
PR libstdc++/101055
* include/std/tuple: Use reserved form of attribute name.
* testsuite/17_intro/headers/c++2011/all_attributes.cc: Add
check for no_unique_address.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
Tested powerpc64le-linux. Committed to trunk.
Backport to gcc-11 needed too.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2978 bytes --]
commit 917efba2dd4ff34336d0d3aa55285ae22503e4aa
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Jun 14 10:58:15 2021
libstdc++: Use reserved name for attribute [PR101055]
The no_unique_address attribute is not a reserved name until C++20, so
to use it in C++11/14/17 modes we should use the __no_unique_address_
form. We already use that form when using the attribute, but not in the
__has_cpp_attribute check.
libstdc++-v3/ChangeLog:
PR libstdc++/101055
* include/std/tuple: Use reserved form of attribute name.
* testsuite/17_intro/headers/c++2011/all_attributes.cc: Add
check for no_unique_address.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 3b771c50b25..2d562f8da77 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool = __empty_not_final<_Head>::value>
struct _Head_base;
-#if __has_cpp_attribute(no_unique_address)
+#if __has_cpp_attribute(__no_unique_address__)
template<size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, true>
{
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
index c5c94ad7702..c38fc7d4d84 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
@@ -28,6 +28,7 @@
# define deprecated 1
# define visibility 1
#endif
+#define no_unique_address 1
#define packed 1
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
index c8f036219ff..65d273db19c 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
@@ -28,6 +28,7 @@
# define deprecated 1
# define visibility 1
#endif
+#define no_unique_address 1
#define packed 1
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
index c4e38d6423a..811b3fe3613 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
@@ -26,6 +26,7 @@
# define cold 1
# define visibility 1
#endif
+#define no_unique_address 1
#define packed 1
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [committed] libstdc++: Use reserved name for attribute [PR101055]
2021-06-14 10:53 [committed] libstdc++: Use reserved name for attribute [PR101055] Jonathan Wakely
@ 2021-06-14 13:06 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-06-14 13:06 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 773 bytes --]
On 14/06/21 11:54 +0100, Jonathan Wakely wrote:
>The no_unique_address attribute is not a reserved name until C++20, so
>to use it in C++11/14/17 modes we should use the __no_unique_address_
>form. We already use that form when using the attribute, but not in the
>__has_cpp_attribute check.
>
>libstdc++-v3/ChangeLog:
>
> PR libstdc++/101055
> * include/std/tuple: Use reserved form of attribute name.
> * testsuite/17_intro/headers/c++2011/all_attributes.cc: Add
> check for no_unique_address.
> * testsuite/17_intro/headers/c++2014/all_attributes.cc:
> Likewise.
> * testsuite/17_intro/headers/c++2017/all_attributes.cc:
> Likewise.
And this ensures the modified C++17 test doesn't fail when using a
newer -std option.
Tested powerpc64le-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1224 bytes --]
commit 45fb3d45a4d4b79a00c56fa93e9e69d9d7762ca0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Jun 14 13:17:40 2021
libstdc++: Add explicit -std=gnu++17 option to test
This test has no -std option so when the testsuite is run with
-std=gnu++20 or later, this test will use that. The recent addition of
no_unique_address will cause it to FAIL, because that's a reserved word
after C++17. Add an explicit option, so that this test alays uses
exactly C++17.
libstdc++-v3/ChangeLog:
* testsuite/17_intro/headers/c++2017/all_attributes.cc: Add
-std=gnu++17 option.
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
index 811b3fe3613..ea2c7d20ba2 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
@@ -15,6 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
// Ensure the library only uses the __name__ form for attributes.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-14 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 10:53 [committed] libstdc++: Use reserved name for attribute [PR101055] Jonathan Wakely
2021-06-14 13:06 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).