summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-05-11 16:35:45 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-05-13 13:32:22 +0100
commite4905f11852d722cd711b53a5626245528ace1d2 (patch)
tree715f08b60d0bae7d829a8de1577ea4b7200f6e6a /libstdc++-v3
parentlibstdc++: Fix typo in doxygen @headerfile command (diff)
downloadgcc-e4905f11852d722cd711b53a5626245528ace1d2.tar.gz
gcc-e4905f11852d722cd711b53a5626245528ace1d2.tar.bz2
gcc-e4905f11852d722cd711b53a5626245528ace1d2.tar.xz
libstdc++: Add macros for the inline namespace std::_V2
Use macros to open and close the inline namespace _V2 that is used for ABI versioning of individual components such as chrono::system_clock. This allows the namespace to be hidden in the docs generated by Doxygen, so that we document std::foo instead of std::_V2::foo. This also makes it easy to remove that namespace entirely for the gnu-versioned-namespace build, where everything is already versioned as std::__8 and there are no backwards compatibility guarantees. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Expand new macros to nothing. * include/bits/c++config (_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE) (_GLIBCXX_END_INLINE_ABI_NAMESPACE): Define new macros. * include/bits/algorithmfwd.h (_V2::__rotate): Use new macros for the namespace. * include/bits/chrono.h (chrono::_V2::system_clock): Likewise. * include/bits/stl_algo.h (_V2::__rotate): Likewise. * include/std/condition_variable (_V2::condition_variable_any): Likewise. * include/std/system_error (_V2::error_category): Likewise.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/doc/doxygen/user.cfg.in2
-rw-r--r--libstdc++-v3/include/bits/algorithmfwd.h15
-rw-r--r--libstdc++-v3/include/bits/c++config11
-rw-r--r--libstdc++-v3/include/bits/chrono.h4
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h5
-rw-r--r--libstdc++-v3/include/std/condition_variable4
-rw-r--r--libstdc++-v3/include/std/system_error5
7 files changed, 28 insertions, 18 deletions
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index b9babc3993e..2dbed727013 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -2347,6 +2347,8 @@ PREDEFINED = __cplusplus=202002L \
2347 "_GLIBCXX_END_NAMESPACE_CONTAINER= " \ 2347 "_GLIBCXX_END_NAMESPACE_CONTAINER= " \
2348 "_GLIBCXX_END_NAMESPACE_CXX11= " \ 2348 "_GLIBCXX_END_NAMESPACE_CXX11= " \
2349 "_GLIBCXX_END_NAMESPACE_LDBL= " \ 2349 "_GLIBCXX_END_NAMESPACE_LDBL= " \
2350 "-D_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X)= " \
2351 "-D_GLIBCXX_END_INLINE_ABI_NAMESPACE(X)= " \
2350 "_GLIBCXX_TEMPLATE_ARGS=... " \ 2352 "_GLIBCXX_TEMPLATE_ARGS=... " \
2351 "_GLIBCXX_DEPRECATED= " \ 2353 "_GLIBCXX_DEPRECATED= " \
2352 "_GLIBCXX_DEPRECATED_SUGGEST(E)= " \ 2354 "_GLIBCXX_DEPRECATED_SUGGEST(E)= " \
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 5271a90b501..aacc34e09e8 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -601,13 +601,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
601 _OIter 601 _OIter
602 reverse_copy(_BIter, _BIter, _OIter); 602 reverse_copy(_BIter, _BIter, _OIter);
603 603
604 inline namespace _V2 604_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
605 { 605
606 template<typename _FIter> 606 template<typename _FIter>
607 _GLIBCXX20_CONSTEXPR 607 _GLIBCXX20_CONSTEXPR
608 _FIter 608 _FIter
609 rotate(_FIter, _FIter, _FIter); 609 rotate(_FIter, _FIter, _FIter);
610 } 610
611_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
611 612
612 template<typename _FIter, typename _OIter> 613 template<typename _FIter, typename _OIter>
613 _GLIBCXX20_CONSTEXPR 614 _GLIBCXX20_CONSTEXPR
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 2798b9786dc..150b0bc5834 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -345,13 +345,16 @@ namespace __gnu_cxx
345# define _GLIBCXX_DEFAULT_ABI_TAG 345# define _GLIBCXX_DEFAULT_ABI_TAG
346#endif 346#endif
347 347
348// Defined if inline namespaces are used for versioning. 348// Non-zero if inline namespaces are used for versioning the entire library.
349#define _GLIBCXX_INLINE_VERSION 349#define _GLIBCXX_INLINE_VERSION
350 350
351// Inline namespace for symbol versioning.
352#if _GLIBCXX_INLINE_VERSION 351#if _GLIBCXX_INLINE_VERSION
352// Inline namespace for symbol versioning of (nearly) everything in std.
353# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 { 353# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
354# define _GLIBCXX_END_NAMESPACE_VERSION } 354# define _GLIBCXX_END_NAMESPACE_VERSION }
355// Unused when everything in std is versioned anyway.
356# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X)
357# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X)
355 358
356namespace std 359namespace std
357{ 360{
@@ -376,8 +379,12 @@ _GLIBCXX_END_NAMESPACE_VERSION
376} 379}
377 380
378#else 381#else
382// Unused.
379# define _GLIBCXX_BEGIN_NAMESPACE_VERSION 383# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
380# define _GLIBCXX_END_NAMESPACE_VERSION 384# define _GLIBCXX_END_NAMESPACE_VERSION
385// Used to version individual components, e.g. std::_V2::error_category.
386# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) inline namespace X {
387# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X
381#endif 388#endif
382 389
383// Inline namespaces for special modes: debug, parallel. 390// Inline namespaces for special modes: debug, parallel.
diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h
index 421898516ae..745f9a81357 100644
--- a/libstdc++-v3/include/bits/chrono.h
+++ b/libstdc++-v3/include/bits/chrono.h
@@ -1099,7 +1099,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
1099 // compatibility definitions for previous versions. At some 1099 // compatibility definitions for previous versions. At some
1100 // point, when these clocks settle down, the inlined namespaces 1100 // point, when these clocks settle down, the inlined namespaces
1101 // can be removed. XXX GLIBCXX_ABI Deprecated 1101 // can be removed. XXX GLIBCXX_ABI Deprecated
1102 inline namespace _V2 { 1102_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
1103 1103
1104 /** 1104 /**
1105 * @brief System clock. 1105 * @brief System clock.
@@ -1171,7 +1171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
1171 */ 1171 */
1172 using high_resolution_clock = system_clock; 1172 using high_resolution_clock = system_clock;
1173 1173
1174 } // end inline namespace _V2 1174_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
1175 1175
1176#if __cplusplus >= 202002L 1176#if __cplusplus >= 202002L
1177 /// @addtogroup chrono 1177 /// @addtogroup chrono
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 1f07b9e6589..6619ff7bf1d 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -1190,8 +1190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
1190 return __m; 1190 return __m;
1191 } 1191 }
1192 1192
1193 inline namespace _V2 1193_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
1194 {
1195 1194
1196 /// This is a helper function for the rotate algorithm. 1195 /// This is a helper function for the rotate algorithm.
1197 template<typename _ForwardIterator> 1196 template<typename _ForwardIterator>
@@ -1398,7 +1397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
1398 std::__iterator_category(__first)); 1397 std::__iterator_category(__first));
1399 } 1398 }
1400 1399
1401 } // namespace _V2 1400_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
1402 1401
1403 /** 1402 /**
1404 * @brief Copy a sequence, rotating its elements. 1403 * @brief Copy a sequence, rotating its elements.
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 2a23e65bbd3..06c4ff9ebdd 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
234 void (*_M_cb)(void*); 234 void (*_M_cb)(void*);
235 }; 235 };
236 236
237 inline namespace _V2 { 237_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
238 238
239 /// condition_variable_any 239 /// condition_variable_any
240 // Like above, but mutex is not required to have try_lock. 240 // Like above, but mutex is not required to have try_lock.
@@ -439,7 +439,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
439#endif 439#endif
440 }; 440 };
441 441
442 } // end inline namespace 442_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
443 443
444 /// @} group condition_variables 444 /// @} group condition_variables
445_GLIBCXX_END_NAMESPACE_VERSION 445_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 45a1d283556..dcef94e16e2 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
77#endif // C++17 77#endif // C++17
78 /// @} 78 /// @}
79 79
80 inline namespace _V2 { 80_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
81 81
82 /** @addtogroup diagnostics 82 /** @addtogroup diagnostics
83 * @{ 83 * @{
@@ -168,7 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
168 _GLIBCXX_CONST const error_category& system_category() noexcept; 168 _GLIBCXX_CONST const error_category& system_category() noexcept;
169 169
170 /// @} 170 /// @}
171 } // end inline namespace 171
172_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
172 173
173 /** @addtogroup diagnostics 174 /** @addtogroup diagnostics
174 * @{ 175 * @{