[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
Fri Apr 21 05:07:43 PDT 2023
ldionne updated this revision to Diff 515686.
ldionne added a comment.
Make inline as an extension
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,8 @@
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();
+#ifndef _LIBCPP_CXX03_LANG
+inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); // extension: inline before C++17
#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,10 @@
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 !defined(_LIBCPP_CXX03_LANG) // extension: we make those inline before C++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();
# 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
@@ -26,8 +26,7 @@
struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
#ifndef _LIBCPP_CXX03_LANG
-
-/* inline */ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+inline constexpr allocator_arg_t allocator_arg = allocator_arg_t(); // extension: inline before C++17
// allocator construction
Index: libcxx/include/__functional/bind.h
===================================================================
--- libcxx/include/__functional/bind.h
+++ libcxx/include/__functional/bind.h
@@ -62,17 +62,17 @@
_LIBCPP_FUNC_VIS extern const __ph<8> _8;
_LIBCPP_FUNC_VIS extern const __ph<9> _9;
_LIBCPP_FUNC_VIS extern const __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{};
+#else // extension: we make these inline before C++17 too
+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{};
#endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
} // namespace placeholders
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145589.515686.patch
Type: text/x-patch
Size: 3274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230421/207e1ebf/attachment-0001.bin>
More information about the libcxx-commits
mailing list