[libcxx-commits] [PATCH] D145589: [libc++] Make std::allocator_arg and friends conforming in C++17

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 19 14:33:25 PDT 2023


ldionne updated this revision to Diff 515096.
ldionne added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145589/new/

https://reviews.llvm.org/D145589

Files:
  libcxx/include/__functional/bind.h
  libcxx/include/__memory/allocator_arg_t.h
  libcxx/include/__mutex/tag_types.h
  libcxx/include/__utility/piecewise_construct.h


Index: libcxx/include/__utility/piecewise_construct.h
===================================================================
--- libcxx/include/__utility/piecewise_construct.h
+++ libcxx/include/__utility/piecewise_construct.h
@@ -19,8 +19,10 @@
 
 struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
 
-#if !defined(_LIBCPP_CXX03_LANG)
-/* inline */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+#if _LIBCPP_STD_VER >= 17
+inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+#elif !defined(_LIBCPP_CXX03_LANG)
+constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
 #endif
 
 _LIBCPP_END_NAMESPACE_STD
Index: libcxx/include/__mutex/tag_types.h
===================================================================
--- libcxx/include/__mutex/tag_types.h
+++ libcxx/include/__mutex/tag_types.h
@@ -31,10 +31,14 @@
   explicit adopt_lock_t() = default;
 };
 
-#  if !defined(_LIBCPP_CXX03_LANG)
-/* inline */ constexpr defer_lock_t defer_lock   = defer_lock_t();
-/* inline */ constexpr try_to_lock_t try_to_lock = try_to_lock_t();
-/* inline */ constexpr adopt_lock_t adopt_lock   = adopt_lock_t();
+#  if _LIBCPP_STD_VER >= 17
+inline constexpr defer_lock_t defer_lock   = defer_lock_t();
+inline constexpr try_to_lock_t try_to_lock = try_to_lock_t();
+inline constexpr adopt_lock_t adopt_lock   = adopt_lock_t();
+#  elif !defined(_LIBCPP_CXX03_LANG)
+constexpr defer_lock_t defer_lock   = defer_lock_t();
+constexpr try_to_lock_t try_to_lock = try_to_lock_t();
+constexpr adopt_lock_t adopt_lock   = adopt_lock_t();
 #  endif
 
 _LIBCPP_END_NAMESPACE_STD
Index: libcxx/include/__memory/allocator_arg_t.h
===================================================================
--- libcxx/include/__memory/allocator_arg_t.h
+++ libcxx/include/__memory/allocator_arg_t.h
@@ -25,7 +25,11 @@
 
 struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
 
-#ifndef _LIBCPP_CXX03_LANG
+#if _LIBCPP_STD_VER >= 17
+inline constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#elif !defined(_LIBCPP_CXX03_LANG)
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#endif
 
 /* inline */ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
 
Index: libcxx/include/__functional/bind.h
===================================================================
--- libcxx/include/__functional/bind.h
+++ libcxx/include/__functional/bind.h
@@ -62,17 +62,28 @@
 _LIBCPP_FUNC_VIS extern const __ph<8>   _8;
 _LIBCPP_FUNC_VIS extern const __ph<9>   _9;
 _LIBCPP_FUNC_VIS extern const __ph<10> _10;
+#elif _LIBCPP_STD_VER >= 17
+inline constexpr __ph<1>   _1{};
+inline constexpr __ph<2>   _2{};
+inline constexpr __ph<3>   _3{};
+inline constexpr __ph<4>   _4{};
+inline constexpr __ph<5>   _5{};
+inline constexpr __ph<6>   _6{};
+inline constexpr __ph<7>   _7{};
+inline constexpr __ph<8>   _8{};
+inline constexpr __ph<9>   _9{};
+inline constexpr __ph<10> _10{};
 #else
-/* inline */ constexpr __ph<1>   _1{};
-/* inline */ constexpr __ph<2>   _2{};
-/* inline */ constexpr __ph<3>   _3{};
-/* inline */ constexpr __ph<4>   _4{};
-/* inline */ constexpr __ph<5>   _5{};
-/* inline */ constexpr __ph<6>   _6{};
-/* inline */ constexpr __ph<7>   _7{};
-/* inline */ constexpr __ph<8>   _8{};
-/* inline */ constexpr __ph<9>   _9{};
-/* inline */ constexpr __ph<10> _10{};
+constexpr __ph<1>   _1{};
+constexpr __ph<2>   _2{};
+constexpr __ph<3>   _3{};
+constexpr __ph<4>   _4{};
+constexpr __ph<5>   _5{};
+constexpr __ph<6>   _6{};
+constexpr __ph<7>   _7{};
+constexpr __ph<8>   _8{};
+constexpr __ph<9>   _9{};
+constexpr __ph<10> _10{};
 #endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
 
 } // namespace placeholders


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145589.515096.patch
Type: text/x-patch
Size: 3818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230419/e36b6919/attachment.bin>


More information about the libcxx-commits mailing list