[patch] Fix invalid attributes in libstdc++
Jonathan Wakely
jwakely@redhat.com
Sun Feb 1 15:08:00 GMT 2015
I failed to CC gcc-patches on this patch ...
On 29/01/15 13:02 +0000, Jonathan Wakely wrote:
>Jakub pointed out that we have some attributes that don't use the
>reserved namespace, e.g. __attribute__ ((always_inline)).
>
>This is a 4.9/5 regression and the fix was pre-approved by Jakub so
>I've committed it to trunk.
>
>When we're back in stage1 I'll fix the TODO comments in the new tests
>(see PR64857) and will also rename testsuite/17_intro/headers/c++200x
>to .../c++2011.
>
>commit 6dd8d699a2dd1801522ad6f38d1232d7f349a494
>Author: Jonathan Wakely <jwakely@redhat.com>
>Date: Wed Jan 28 17:28:12 2015 +0000
>
> * include/bits/atomic_base.h: Use __always_inline__ instead of
> always_inline.
> * include/bits/atomic_futex.h: Likewise.
> * include/bits/c++config: Use __abi_tag__ instead of abi_tag.
> * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Use
> __packed__ instead of packed.
> * include/std/shared_mutex: Use __unused__ instead of unused.
> * testsuite/17_intro/headers/c++1998/all_attributes.cc: New.
> * testsuite/17_intro/headers/c++200x/all_attributes.cc: New.
> * testsuite/17_intro/headers/c++2014/all_attributes.cc: New.
>
>diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
>index 5e610f1..fe6524f 100644
>--- a/libstdc++-v3/include/bits/atomic_base.h
>+++ b/libstdc++-v3/include/bits/atomic_base.h
>@@ -37,7 +37,7 @@
> #include <bits/atomic_lockfree_defines.h>
>
> #ifndef _GLIBCXX_ALWAYS_INLINE
>-#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((always_inline))
>+#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
> #endif
>
> namespace std _GLIBCXX_VISIBILITY(default)
>diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h
>index 51b9c7e..ca3260d 100644
>--- a/libstdc++-v3/include/bits/atomic_futex.h
>+++ b/libstdc++-v3/include/bits/atomic_futex.h
>@@ -41,7 +41,7 @@
> #endif
>
> #ifndef _GLIBCXX_ALWAYS_INLINE
>-#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((always_inline))
>+#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
> #endif
>
> namespace std _GLIBCXX_VISIBILITY(default)
>diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
>index 721778a..46ffa1f 100644
>--- a/libstdc++-v3/include/bits/c++config
>+++ b/libstdc++-v3/include/bits/c++config
>@@ -215,7 +215,7 @@ namespace std
> #if _GLIBCXX_USE_CXX11_ABI
> namespace std
> {
>- inline namespace __cxx11 __attribute__((abi_tag)) { }
>+ inline namespace __cxx11 __attribute__((__abi_tag__)) { }
> }
> # define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
> # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
>@@ -290,7 +290,7 @@ namespace std
> # endif
>
> # if _GLIBCXX_USE_CXX11_ABI
>- inline namespace __cxx11 __attribute__((abi_tag)) { }
>+ inline namespace __cxx11 __attribute__((__abi_tag__)) { }
> # endif
> }
>
>diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
>index 0b71817..a402bef 100644
>--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
>+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
>@@ -162,7 +162,7 @@ namespace __gnu_pbds
> empty_entry_status,
> valid_entry_status,
> erased_entry_status
>- } __attribute__ ((packed));
>+ } __attribute__ ((__packed__));
>
> struct entry : public traits_base::stored_data_type
> {
>diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
>index 47cfc64..5dcc295 100644
>--- a/libstdc++-v3/include/std/shared_mutex
>+++ b/libstdc++-v3/include/std/shared_mutex
>@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> ~shared_timed_mutex()
> {
>- int __ret __attribute((unused)) = pthread_rwlock_destroy(&_M_rwlock);
>+ int __ret __attribute((__unused__)) = pthread_rwlock_destroy(&_M_rwlock);
> // Errors not handled: EBUSY, EINVAL
> _GLIBCXX_DEBUG_ASSERT(__ret == 0);
> }
>@@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> void
> unlock()
> {
>- int __ret __attribute((unused)) = pthread_rwlock_unlock(&_M_rwlock);
>+ int __ret __attribute((__unused__)) = pthread_rwlock_unlock(&_M_rwlock);
> // Errors not handled: EPERM, EBUSY, EINVAL
> _GLIBCXX_DEBUG_ASSERT(__ret == 0);
> }
>diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
>new file mode 100644
>index 0000000..c7ed8ae
>--- /dev/null
>+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
>@@ -0,0 +1,38 @@
>+// Copyright (C) 2015 Free Software Foundation, Inc.
>+//
>+// This file is part of the GNU ISO C++ Library. This library is free
>+// software; you can redistribute it and/or modify it under the
>+// terms of the GNU General Public License as published by the
>+// Free Software Foundation; either version 3, or (at your option)
>+// any later version.
>+
>+// This library is distributed in the hope that it will be useful,
>+// but WITHOUT ANY WARRANTY; without even the implied warranty of
>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>+// GNU General Public License for more details.
>+
>+// You should have received a copy of the GNU General Public License along
>+// with this library; see the file COPYING3. If not see
>+// <http://www.gnu.org/licenses/>.
>+
>+// { dg-options "-std=gnu++98" }
>+// { dg-do compile }
>+
>+// Ensure the library only uses the __name__ form for attributes.
>+// Don't test 'const' because it is reserved anyway.
>+#define abi_tag 1
>+#define always_inline 1
>+#define deprecated 1
>+#define noreturn 1
>+#define packed 1
>+#define pure 1
>+#define unused 1
>+#define visibility 1
>+
>+#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
>+#include <bits/extc++.h>
>+
>+int
>+main()
>+{
>+}
>diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc
>new file mode 100644
>index 0000000..c7ec27a
>--- /dev/null
>+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc
>@@ -0,0 +1,38 @@
>+// Copyright (C) 2015 Free Software Foundation, Inc.
>+//
>+// This file is part of the GNU ISO C++ Library. This library is free
>+// software; you can redistribute it and/or modify it under the
>+// terms of the GNU General Public License as published by the
>+// Free Software Foundation; either version 3, or (at your option)
>+// any later version.
>+
>+// This library is distributed in the hope that it will be useful,
>+// but WITHOUT ANY WARRANTY; without even the implied warranty of
>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>+// GNU General Public License for more details.
>+
>+// You should have received a copy of the GNU General Public License along
>+// with this library; see the file COPYING3. If not see
>+// <http://www.gnu.org/licenses/>.
>+
>+// { dg-options "-std=gnu++11" }
>+// { dg-do compile }
>+
>+// Ensure the library only uses the __name__ form for attributes.
>+// Don't test 'const' and 'noreturn' because they are reserved anyway.
>+#define abi_tag 1
>+#define always_inline 1
>+#define deprecated 1
>+#define packed 1
>+#define pure 1
>+#define unused 1
>+#define visibility 1
>+
>+#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
>+#include <codecvt> // TODO: this is missing from <bits/stdc++.h>
>+#include <bits/extc++.h>
>+
>+int
>+main()
>+{
>+}
>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
>new file mode 100644
>index 0000000..533a6f1
>--- /dev/null
>+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
>@@ -0,0 +1,38 @@
>+// Copyright (C) 2015 Free Software Foundation, Inc.
>+//
>+// This file is part of the GNU ISO C++ Library. This library is free
>+// software; you can redistribute it and/or modify it under the
>+// terms of the GNU General Public License as published by the
>+// Free Software Foundation; either version 3, or (at your option)
>+// any later version.
>+
>+// This library is distributed in the hope that it will be useful,
>+// but WITHOUT ANY WARRANTY; without even the implied warranty of
>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>+// GNU General Public License for more details.
>+
>+// You should have received a copy of the GNU General Public License along
>+// with this library; see the file COPYING3. If not see
>+// <http://www.gnu.org/licenses/>.
>+
>+// { dg-options "-std=gnu++14" }
>+// { dg-do compile }
>+
>+// Ensure the library only uses the __name__ form for attributes.
>+// Don't test 'const' and 'noreturn' because they are reserved anyway.
>+#define abi_tag 1
>+#define always_inline 1
>+#define deprecated 1
>+#define packed 1
>+#define pure 1
>+#define unused 1
>+#define visibility 1
>+
>+#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
>+#include <shared_mutex> // TODO: this is missing from <bits/stdc++.h>
>+#include <bits/extc++.h>
>+
>+int
>+main()
>+{
>+}
More information about the Libstdc++
mailing list