[libcxx-commits] [libcxx] 2544060 - [libc++] Remove C++11 work-arounds in src.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 9 09:31:10 PST 2021


Author: Mark de Wever
Date: 2021-02-09T18:31:00+01:00
New Revision: 2544060e718098c2cf736e2667ee007fbc58da50

URL: https://github.com/llvm/llvm-project/commit/2544060e718098c2cf736e2667ee007fbc58da50
DIFF: https://github.com/llvm/llvm-project/commit/2544060e718098c2cf736e2667ee007fbc58da50.diff

LOG: [libc++] Remove C++11 work-arounds in src.

Building libcxx requires at least C++17 so remove the old work-arounds.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96200

Added: 
    

Modified: 
    libcxx/src/experimental/memory_resource.cpp
    libcxx/src/filesystem/filesystem_common.h

Removed: 
    


################################################################################
diff  --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp
index 1304ef3df78f..3319931b78b9 100644
--- a/libcxx/src/experimental/memory_resource.cpp
+++ b/libcxx/src/experimental/memory_resource.cpp
@@ -76,12 +76,7 @@ union ResourceInitHelper {
   ~ResourceInitHelper() {}
 };
 
-// When compiled in C++14 this initialization should be a constant expression.
-// Only in C++11 is "init_priority" needed to ensure initialization order.
-#if _LIBCPP_STD_VER > 11
-_LIBCPP_SAFE_STATIC
-#endif
-ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
+_LIBCPP_SAFE_STATIC ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
 
 } // end namespace
 

diff  --git a/libcxx/src/filesystem/filesystem_common.h b/libcxx/src/filesystem/filesystem_common.h
index a4505171c3eb..38d4eb098e98 100644
--- a/libcxx/src/filesystem/filesystem_common.h
+++ b/libcxx/src/filesystem/filesystem_common.h
@@ -287,8 +287,7 @@ struct time_util_base {
           .count();
 
 private:
-#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
-  static constexpr fs_duration get_min_nsecs() {
+  static _LIBCPP_CONSTEXPR_AFTER_CXX11 fs_duration get_min_nsecs() {
     return duration_cast<fs_duration>(
         fs_nanoseconds(min_nsec_timespec) -
         duration_cast<fs_nanoseconds>(fs_seconds(1)));
@@ -298,7 +297,7 @@ struct time_util_base {
                     FileTimeT::duration::min(),
                 "value doesn't roundtrip");
 
-  static constexpr bool check_range() {
+  static _LIBCPP_CONSTEXPR_AFTER_CXX11 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;
@@ -309,7 +308,6 @@ struct time_util_base {
            min_seconds <= numeric_limits<TimeT>::min();
   }
   static_assert(check_range(), "the representable range is unacceptable small");
-#endif
 };
 
 template <class FileTimeT, class TimeT>


        


More information about the libcxx-commits mailing list