Skip to content

Commit 5a6c1ce

Browse files
committed
[libc++] Change _LIBCPP_CONSTEXPR_SINCE_XXX to constexpr in the dylib
Since we build the dylib with C++20, there's no need to use conditional macros anymore. Differential Revision: https://reviews.llvm.org/D157995
1 parent cf5e918 commit 5a6c1ce

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

libcxx/src/chrono.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static system_clock::time_point __libcpp_system_clock_now() {
9999
nanoseconds::period>>;
100100

101101
// The Windows epoch is Jan 1 1601, the Unix epoch Jan 1 1970.
102-
static _LIBCPP_CONSTEXPR const seconds nt_to_unix_epoch{11644473600};
102+
static constexpr const seconds nt_to_unix_epoch{11644473600};
103103

104104
FILETIME ft;
105105
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) || \

libcxx/src/condition_variable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
6161
__libcpp_timespec_t ts;
6262
seconds s = duration_cast<seconds>(d);
6363
typedef decltype(ts.tv_sec) ts_sec;
64-
_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
64+
constexpr ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
6565
if (s.count() < ts_sec_max)
6666
{
6767
ts.tv_sec = static_cast<ts_sec>(s.count());

libcxx/src/experimental/memory_resource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ union ResourceInitHelper {
7474
__null_memory_resource_imp null_res;
7575
} resources;
7676
char dummy;
77-
_LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {}
77+
constexpr ResourceInitHelper() : resources() {}
7878
~ResourceInitHelper() {}
7979
};
8080

libcxx/src/filesystem/error.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ inline error_code make_windows_error(int err) {
112112
template <class T>
113113
T error_value();
114114
template <>
115-
inline _LIBCPP_CONSTEXPR_SINCE_CXX14 void error_value<void>() {}
115+
inline constexpr void error_value<void>() {}
116116
template <>
117117
inline bool error_value<bool>() {
118118
return false;
@@ -128,7 +128,7 @@ inline uintmax_t error_value<uintmax_t>() {
128128
return uintmax_t(-1);
129129
}
130130
template <>
131-
inline _LIBCPP_CONSTEXPR_SINCE_CXX14 file_time_type error_value<file_time_type>() {
131+
inline constexpr file_time_type error_value<file_time_type>() {
132132
return file_time_type::min();
133133
}
134134
template <>

libcxx/src/filesystem/time_utils.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct time_util_base {
147147
.count();
148148

149149
private:
150-
static _LIBCPP_CONSTEXPR fs_duration get_min_nsecs() {
150+
static constexpr fs_duration get_min_nsecs() {
151151
return duration_cast<fs_duration>(
152152
fs_nanoseconds(min_nsec_timespec) -
153153
duration_cast<fs_nanoseconds>(fs_seconds(1)));
@@ -157,7 +157,7 @@ struct time_util_base {
157157
FileTimeT::duration::min(),
158158
"value doesn't roundtrip");
159159

160-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool check_range() {
160+
static constexpr bool check_range() {
161161
// This kinda sucks, but it's what happens when we don't have __int128_t.
162162
if (sizeof(TimeT) == sizeof(rep)) {
163163
typedef duration<long long, ratio<3600 * 24 * 365> > Years;
@@ -225,7 +225,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
225225

226226
public:
227227
template <class CType, class ChronoType>
228-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool checked_set(CType* out,
228+
static constexpr bool checked_set(CType* out,
229229
ChronoType time) {
230230
using Lim = numeric_limits<CType>;
231231
if (time > Lim::max() || time < Lim::min())
@@ -234,7 +234,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
234234
return true;
235235
}
236236

237-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(TimeSpecT tm) {
237+
static constexpr bool is_representable(TimeSpecT tm) {
238238
if (tm.tv_sec >= 0) {
239239
return tm.tv_sec < max_seconds ||
240240
(tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
@@ -245,7 +245,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
245245
}
246246
}
247247

248-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(FileTimeT tm) {
248+
static constexpr bool is_representable(FileTimeT tm) {
249249
auto secs = duration_cast<fs_seconds>(tm.time_since_epoch());
250250
auto nsecs = duration_cast<fs_nanoseconds>(tm.time_since_epoch() - secs);
251251
if (nsecs.count() < 0) {
@@ -258,7 +258,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
258258
return secs.count() >= TLim::min();
259259
}
260260

261-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 FileTimeT
261+
static constexpr FileTimeT
262262
convert_from_timespec(TimeSpecT tm) {
263263
if (tm.tv_sec >= 0 || tm.tv_nsec == 0) {
264264
return FileTimeT(fs_seconds(tm.tv_sec) +
@@ -272,7 +272,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
272272
}
273273

274274
template <class SubSecT>
275-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
275+
static constexpr bool
276276
set_times_checked(TimeT* sec_out, SubSecT* subsec_out, FileTimeT tp) {
277277
auto dur = tp.time_since_epoch();
278278
auto sec_dur = duration_cast<fs_seconds>(dur);
@@ -289,7 +289,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
289289
return checked_set(sec_out, sec_dur.count()) &&
290290
checked_set(subsec_out, subsec_dur.count());
291291
}
292-
static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool convert_to_timespec(TimeSpecT& dest,
292+
static constexpr bool convert_to_timespec(TimeSpecT& dest,
293293
FileTimeT tp) {
294294
if (!is_representable(tp))
295295
return false;

libcxx/src/locale.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ T& make(Args ...args)
9494

9595
template <typename T, size_t N>
9696
inline
97-
_LIBCPP_CONSTEXPR
97+
constexpr
9898
size_t
9999
countof(const T (&)[N])
100100
{
@@ -103,7 +103,7 @@ countof(const T (&)[N])
103103

104104
template <typename T>
105105
inline
106-
_LIBCPP_CONSTEXPR
106+
constexpr
107107
size_t
108108
countof(const T * const begin, const T * const end)
109109
{
@@ -1097,7 +1097,7 @@ extern "C" const int ** __ctype_toupper_loc();
10971097
const ctype<char>::mask*
10981098
ctype<char>::classic_table() noexcept
10991099
{
1100-
static _LIBCPP_CONSTEXPR const ctype<char>::mask builtin_table[table_size] = {
1100+
static constexpr const ctype<char>::mask builtin_table[table_size] = {
11011101
cntrl, cntrl,
11021102
cntrl, cntrl,
11031103
cntrl, cntrl,

libcxx/src/memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static constinit __libcpp_mutex_t mut_back[__sp_mut_count] =
149149
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER
150150
};
151151

152-
_LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) noexcept
152+
constexpr __sp_mut::__sp_mut(void* p) noexcept
153153
: __lx_(p)
154154
{
155155
}

libcxx/src/memory_resource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ union ResourceInitHelper {
7474
__null_memory_resource_imp null_res;
7575
} resources;
7676
char dummy;
77-
_LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {}
77+
constexpr ResourceInitHelper() : resources() {}
7878
~ResourceInitHelper() {}
7979
};
8080

libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: c++03
9+
// UNSUPPORTED: c++03, c++11
1010
// UNSUPPORTED: availability-filesystem-missing
1111
// UNSUPPORTED: no-filesystem
1212
// ADDITIONAL_COMPILE_FLAGS: -I %S/../../../../../../src

0 commit comments

Comments
 (0)