[libcxx-commits] [libcxx] 5a6c1ce - [libc++] Change _LIBCPP_CONSTEXPR_SINCE_XXX to constexpr in the dylib
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 18 10:44:42 PDT 2023
Author: Louis Dionne
Date: 2023-08-18T13:44:26-04:00
New Revision: 5a6c1ce189b54dbae6e79c7b66d519152660ba75
URL: https://github.com/llvm/llvm-project/commit/5a6c1ce189b54dbae6e79c7b66d519152660ba75
DIFF: https://github.com/llvm/llvm-project/commit/5a6c1ce189b54dbae6e79c7b66d519152660ba75.diff
LOG: [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
Added:
Modified:
libcxx/src/chrono.cpp
libcxx/src/condition_variable.cpp
libcxx/src/experimental/memory_resource.cpp
libcxx/src/filesystem/error.h
libcxx/src/filesystem/time_utils.h
libcxx/src/locale.cpp
libcxx/src/memory.cpp
libcxx/src/memory_resource.cpp
libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index 0990d8dc181c23..1247e42be67fb4 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -99,7 +99,7 @@ static system_clock::time_point __libcpp_system_clock_now() {
nanoseconds::period>>;
// The Windows epoch is Jan 1 1601, the Unix epoch Jan 1 1970.
- static _LIBCPP_CONSTEXPR const seconds nt_to_unix_epoch{11644473600};
+ static constexpr const seconds nt_to_unix_epoch{11644473600};
FILETIME ft;
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) || \
diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp
index 85f334e02459d8..87ce1d8434f859 100644
--- a/libcxx/src/condition_variable.cpp
+++ b/libcxx/src/condition_variable.cpp
@@ -61,7 +61,7 @@ condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
__libcpp_timespec_t ts;
seconds s = duration_cast<seconds>(d);
typedef decltype(ts.tv_sec) ts_sec;
- _LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
+ constexpr ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
if (s.count() < ts_sec_max)
{
ts.tv_sec = static_cast<ts_sec>(s.count());
diff --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp
index 8ac2375d69606e..0798d2e72ceda0 100644
--- a/libcxx/src/experimental/memory_resource.cpp
+++ b/libcxx/src/experimental/memory_resource.cpp
@@ -74,7 +74,7 @@ union ResourceInitHelper {
__null_memory_resource_imp null_res;
} resources;
char dummy;
- _LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {}
+ constexpr ResourceInitHelper() : resources() {}
~ResourceInitHelper() {}
};
diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h
index 965e0eadcd0dcf..93da758761516e 100644
--- a/libcxx/src/filesystem/error.h
+++ b/libcxx/src/filesystem/error.h
@@ -112,7 +112,7 @@ inline error_code make_windows_error(int err) {
template <class T>
T error_value();
template <>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX14 void error_value<void>() {}
+inline constexpr void error_value<void>() {}
template <>
inline bool error_value<bool>() {
return false;
@@ -128,7 +128,7 @@ inline uintmax_t error_value<uintmax_t>() {
return uintmax_t(-1);
}
template <>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX14 file_time_type error_value<file_time_type>() {
+inline constexpr file_time_type error_value<file_time_type>() {
return file_time_type::min();
}
template <>
diff --git a/libcxx/src/filesystem/time_utils.h b/libcxx/src/filesystem/time_utils.h
index 9177e1013d078d..eb4176936853a0 100644
--- a/libcxx/src/filesystem/time_utils.h
+++ b/libcxx/src/filesystem/time_utils.h
@@ -147,7 +147,7 @@ struct time_util_base {
.count();
private:
- static _LIBCPP_CONSTEXPR fs_duration get_min_nsecs() {
+ static constexpr fs_duration get_min_nsecs() {
return duration_cast<fs_duration>(
fs_nanoseconds(min_nsec_timespec) -
duration_cast<fs_nanoseconds>(fs_seconds(1)));
@@ -157,7 +157,7 @@ struct time_util_base {
FileTimeT::duration::min(),
"value doesn't roundtrip");
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool check_range() {
+ static constexpr bool check_range() {
// This kinda sucks, but it's what happens when we don't have __int128_t.
if (sizeof(TimeT) == sizeof(rep)) {
typedef duration<long long, ratio<3600 * 24 * 365> > Years;
@@ -225,7 +225,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
public:
template <class CType, class ChronoType>
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool checked_set(CType* out,
+ static constexpr bool checked_set(CType* out,
ChronoType time) {
using Lim = numeric_limits<CType>;
if (time > Lim::max() || time < Lim::min())
@@ -234,7 +234,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
return true;
}
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(TimeSpecT tm) {
+ static constexpr bool is_representable(TimeSpecT tm) {
if (tm.tv_sec >= 0) {
return tm.tv_sec < max_seconds ||
(tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
@@ -245,7 +245,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
}
}
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool is_representable(FileTimeT tm) {
+ static constexpr bool is_representable(FileTimeT tm) {
auto secs = duration_cast<fs_seconds>(tm.time_since_epoch());
auto nsecs = duration_cast<fs_nanoseconds>(tm.time_since_epoch() - secs);
if (nsecs.count() < 0) {
@@ -258,7 +258,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
return secs.count() >= TLim::min();
}
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 FileTimeT
+ static constexpr FileTimeT
convert_from_timespec(TimeSpecT tm) {
if (tm.tv_sec >= 0 || tm.tv_nsec == 0) {
return FileTimeT(fs_seconds(tm.tv_sec) +
@@ -272,7 +272,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
}
template <class SubSecT>
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+ static constexpr bool
set_times_checked(TimeT* sec_out, SubSecT* subsec_out, FileTimeT tp) {
auto dur = tp.time_since_epoch();
auto sec_dur = duration_cast<fs_seconds>(dur);
@@ -289,7 +289,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
return checked_set(sec_out, sec_dur.count()) &&
checked_set(subsec_out, subsec_dur.count());
}
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 bool convert_to_timespec(TimeSpecT& dest,
+ static constexpr bool convert_to_timespec(TimeSpecT& dest,
FileTimeT tp) {
if (!is_representable(tp))
return false;
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 3922bd80cecb55..72ad04053bf19b 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -94,7 +94,7 @@ T& make(Args ...args)
template <typename T, size_t N>
inline
-_LIBCPP_CONSTEXPR
+constexpr
size_t
countof(const T (&)[N])
{
@@ -103,7 +103,7 @@ countof(const T (&)[N])
template <typename T>
inline
-_LIBCPP_CONSTEXPR
+constexpr
size_t
countof(const T * const begin, const T * const end)
{
@@ -1097,7 +1097,7 @@ extern "C" const int ** __ctype_toupper_loc();
const ctype<char>::mask*
ctype<char>::classic_table() noexcept
{
- static _LIBCPP_CONSTEXPR const ctype<char>::mask builtin_table[table_size] = {
+ static constexpr const ctype<char>::mask builtin_table[table_size] = {
cntrl, cntrl,
cntrl, cntrl,
cntrl, cntrl,
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index d01d6140d370ed..4b2a369d89f106 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -149,7 +149,7 @@ static constinit __libcpp_mutex_t mut_back[__sp_mut_count] =
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER
};
-_LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) noexcept
+constexpr __sp_mut::__sp_mut(void* p) noexcept
: __lx_(p)
{
}
diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp
index 3a80b84efae441..3786ec51367504 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -74,7 +74,7 @@ union ResourceInitHelper {
__null_memory_resource_imp null_res;
} resources;
char dummy;
- _LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {}
+ constexpr ResourceInitHelper() : resources() {}
~ResourceInitHelper() {}
};
diff --git a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
index beef2c53e509f1..c85aab28d36e14 100644
--- a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
+++ b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03
+// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: availability-filesystem-missing
// UNSUPPORTED: no-filesystem
// ADDITIONAL_COMPILE_FLAGS: -I %S/../../../../../../src
More information about the libcxx-commits
mailing list