public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Do not use #include inside push visibility scope [PR99871]
@ 2022-05-06 13:45 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-05-06 13:45 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested powerpc64le-linux, pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

	PR libstdc++/99871
	* include/bits/specfun.h: Use visibility attribute on namespace,
	instead of pragma push/pop.
	* libsupc++/compare: Likewise.
	* libsupc++/exception: Likewise.
	* libsupc++/exception.h: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/initializer_list: Likewise.
	* libsupc++/nested_exception.h: Likewise.
---
 libstdc++-v3/include/bits/specfun.h       | 4 ----
 libstdc++-v3/libsupc++/compare            | 6 +-----
 libstdc++-v3/libsupc++/exception          | 8 ++------
 libstdc++-v3/libsupc++/exception.h        | 6 +-----
 libstdc++-v3/libsupc++/exception_ptr.h    | 6 +-----
 libstdc++-v3/libsupc++/initializer_list   | 6 +-----
 libstdc++-v3/libsupc++/nested_exception.h | 8 +-------
 7 files changed, 7 insertions(+), 37 deletions(-)

diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h
index cac350217b8..a12b04b3ea7 100644
--- a/libstdc++-v3/include/bits/specfun.h
+++ b/libstdc++-v3/include/bits/specfun.h
@@ -30,8 +30,6 @@
 #ifndef _GLIBCXX_BITS_SPECFUN_H
 #define _GLIBCXX_BITS_SPECFUN_H 1
 
-#pragma GCC visibility push(default)
-
 #include <bits/c++config.h>
 
 #define __STDCPP_MATH_SPEC_FUNCS__ 201003L
@@ -1385,6 +1383,4 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __gnu_cxx
 #endif // __STRICT_ANSI__
 
-#pragma GCC visibility pop
-
 #endif // _GLIBCXX_BITS_SPECFUN_H
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index e9cf9139def..066867e9ce1 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -34,15 +34,13 @@
 
 #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
 
-#pragma GCC visibility push(default)
-
 #include <concepts>
 
 #if __cpp_lib_concepts
 # define __cpp_lib_three_way_comparison 201907L
 #endif
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   // [cmp.categories], comparison category types
 
@@ -1239,8 +1237,6 @@ namespace std
 #endif // concepts
 } // namespace std
 
-#pragma GCC visibility pop
-
 #endif // C++20
 
 #endif // _COMPARE
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index ae2b0dd7f78..24c91292a16 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -32,14 +32,12 @@
 
 #pragma GCC system_header
 
-#pragma GCC visibility push(default)
-
 #include <bits/c++config.h>
 #include <bits/exception.h>
 
 extern "C++" {
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   /** @addtogroup exceptions
    *  @{
@@ -135,7 +133,7 @@ namespace std
   /// @} group exceptions
 } // namespace std
 
-namespace __gnu_cxx
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
@@ -162,8 +160,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 } // extern "C++"
 
-#pragma GCC visibility pop
-
 #if (__cplusplus >= 201103L)
 #include <bits/exception_ptr.h>
 #include <bits/nested_exception.h>
diff --git a/libstdc++-v3/libsupc++/exception.h b/libstdc++-v3/libsupc++/exception.h
index 7d905184c64..1df02bddc1b 100644
--- a/libstdc++-v3/libsupc++/exception.h
+++ b/libstdc++-v3/libsupc++/exception.h
@@ -33,13 +33,11 @@
 
 #pragma GCC system_header
 
-#pragma GCC visibility push(default)
-
 #include <bits/c++config.h>
 
 extern "C++" {
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   /**
    * @defgroup exceptions Exceptions
@@ -82,6 +80,4 @@ namespace std
 
 }
 
-#pragma GCC visibility pop
-
 #endif
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 6433f059e9c..21c53f686ba 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -31,8 +31,6 @@
 #ifndef _EXCEPTION_PTR_H
 #define _EXCEPTION_PTR_H
 
-#pragma GCC visibility push(default)
-
 #include <bits/c++config.h>
 #include <bits/exception_defines.h>
 #include <bits/cxxabi_init_exception.h>
@@ -51,7 +49,7 @@
 
 extern "C++" {
 
-namespace std 
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   class type_info;
 
@@ -283,6 +281,4 @@ namespace std
 
 } // extern "C++"
 
-#pragma GCC visibility pop
-
 #endif
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
index 79d32b219b4..efa1f164cde 100644
--- a/libstdc++-v3/libsupc++/initializer_list
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -36,11 +36,9 @@
 # include <bits/c++0x_warning.h>
 #else // C++0x
 
-#pragma GCC visibility push(default)
-
 #include <bits/c++config.h>
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   /// initializer_list
   template<class _E>
@@ -102,8 +100,6 @@ namespace std
     { return __ils.end(); }
 }
 
-#pragma GCC visibility pop
-
 #endif // C++11
 
 #endif // _INITIALIZER_LIST
diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h
index 6f0d5399708..002a54e9fef 100644
--- a/libstdc++-v3/libsupc++/nested_exception.h
+++ b/libstdc++-v3/libsupc++/nested_exception.h
@@ -30,18 +30,15 @@
 #ifndef _GLIBCXX_NESTED_EXCEPTION_H
 #define _GLIBCXX_NESTED_EXCEPTION_H 1
 
-#pragma GCC visibility push(default)
-
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
 
-#include <bits/c++config.h>
 #include <bits/move.h>
 
 extern "C++" {
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   /**
    * @addtogroup exceptions
@@ -165,7 +162,4 @@ namespace std
 } // extern "C++"
 
 #endif // C++11
-
-#pragma GCC visibility pop
-
 #endif // _GLIBCXX_NESTED_EXCEPTION_H
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-06 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 13:45 [committed] libstdc++: Do not use #include inside push visibility scope [PR99871] 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).