mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[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
This commit is contained in:
@@ -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)) || \
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -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 <>
|
||||
|
||||
@@ -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 @@ private:
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
}
|
||||
|
||||
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 @@ public:
|
||||
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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user