Skip to content

Commit deaf53e

Browse files
authored
[libc++][NFC] Reorder availability macros in introduction order (#82531)
Reorder the availability macros in __availability to respect the order in which they were introduced in the dylib. This simple refactor will greatly simplify an upcoming change I am working on.
1 parent 1f8b7e3 commit deaf53e

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

libcxx/include/__availability

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,31 +101,38 @@
101101
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST 1
102102
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
103103

104-
// These macros controls the availability of __cxa_init_primary_exception
105-
// in the built library, which std::make_exception_ptr might use
106-
// (see libcxx/include/__exception/exception_ptr.h).
107-
# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 1
108-
# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
109-
110104
// These macros control the availability of all parts of <filesystem> that
111105
// depend on something in the dylib.
112106
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
113107
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
114108
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
115109
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
116110

117-
// This controls the availability of floating-point std::to_chars functions.
118-
// These overloads were added later than the integer overloads.
119-
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
120-
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
121-
122111
// This controls the availability of the C++20 synchronization library,
123112
// which requires shared library support for various operations
124113
// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
125114
// <semaphore>, and notification functions on std::atomic.
126115
# define _LIBCPP_AVAILABILITY_HAS_SYNC 1
127116
# define _LIBCPP_AVAILABILITY_SYNC
128117

118+
// Enable additional explicit instantiations of iostreams components. This
119+
// reduces the number of weak definitions generated in programs that use
120+
// iostreams by providing a single strong definition in the shared library.
121+
//
122+
// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
123+
// or once libc++ doesn't use the attribute anymore.
124+
// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
125+
# if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
126+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1
127+
# else
128+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
129+
# endif
130+
131+
// This controls the availability of floating-point std::to_chars functions.
132+
// These overloads were added later than the integer overloads.
133+
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
134+
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
135+
129136
// This controls whether the library claims to provide a default verbose
130137
// termination function, and consequently whether the headers will try
131138
// to use it when the mechanism isn't overriden at compile-time.
@@ -137,29 +144,22 @@
137144
# define _LIBCPP_AVAILABILITY_HAS_PMR 1
138145
# define _LIBCPP_AVAILABILITY_PMR
139146

140-
// This controls the availability of the C++20 time zone database.
141-
// The parser code is built in the library.
142-
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
143-
# define _LIBCPP_AVAILABILITY_TZDB
147+
// These macros controls the availability of __cxa_init_primary_exception
148+
// in the built library, which std::make_exception_ptr might use
149+
// (see libcxx/include/__exception/exception_ptr.h).
150+
# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 1
151+
# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
144152

145153
// This controls the availability of C++23 <print>, which
146154
// has a dependency on the built library (it needs access to
147155
// the underlying buffer types of std::cout, std::cerr, and std::clog.
148156
# define _LIBCPP_AVAILABILITY_HAS_PRINT 1
149157
# define _LIBCPP_AVAILABILITY_PRINT
150158

151-
// Enable additional explicit instantiations of iostreams components. This
152-
// reduces the number of weak definitions generated in programs that use
153-
// iostreams by providing a single strong definition in the shared library.
154-
//
155-
// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
156-
// or once libc++ doesn't use the attribute anymore.
157-
// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
158-
# if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
159-
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1
160-
# else
161-
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
162-
# endif
159+
// This controls the availability of the C++20 time zone database.
160+
// The parser code is built in the library.
161+
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
162+
# define _LIBCPP_AVAILABILITY_TZDB
163163

164164
#elif defined(__APPLE__)
165165

0 commit comments

Comments
 (0)