dim created this revision.
dim added reviewers: EricWF, emaste, mclow.lists, theraven.
dim added a subscriber: cfe-commits.
In https://reviews.llvm.org/rL275749 the old _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
define was replaced
by _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR, which is also
auto-detected.
However, it is not overridable by the user, since you cannot use -U or
#undef to get rid of the define after __config was included, at least
not without gross hacks.
In the FreeBSD ports tree we have at least one libc++ consumer that
really needs to turn on the trivial constructor (chromium), see
https://bugs.freebsd.org/214654 for the details. So I would like to
propose making _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
user-settable (to either zero, or nonzero).
https://reviews.llvm.org/D27277
Files:
include/__config
include/utility
test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
Index: test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
===
--- test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
+++ test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
@@ -32,23 +32,23 @@
typedef std::pair P;
{
static_assert(std::is_copy_constructible::value, "");
-#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR == 0
static_assert(std::is_trivially_copy_constructible::value, "");
#endif
}
#if TEST_STD_VER >= 11
{
static_assert(std::is_move_constructible::value, "");
-#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR == 0
static_assert(std::is_trivially_move_constructible::value, "");
#endif
}
{
using P1 = std::pair;
static_assert(!std::is_copy_constructible::value, "");
static_assert(!std::is_trivially_copy_constructible::value, "");
static_assert(std::is_move_constructible::value, "");
-#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR == 0
static_assert(std::is_trivially_move_constructible::value, "");
#endif
}
Index: test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
===
--- test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
+++ test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
@@ -29,7 +29,7 @@
#include "test_macros.h"
-#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR != 0
#error Non-trivial ctor ABI macro defined
#endif
Index: test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
===
--- test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -21,16 +21,16 @@
#undef _LIBCPP_ABI_UNSTABLE
#undef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
-#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR 1
#include
#include
#include
#include
#include "test_macros.h"
-#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR == 0
#error trivial ctor ABI macro defined
#endif
Index: include/utility
===
--- include/utility
+++ include/utility
@@ -296,7 +296,7 @@
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
-#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR != 0
struct __non_trivially_copyable_base {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
__non_trivially_copyable_base() _NOEXCEPT {}
@@ -307,7 +307,7 @@
template
struct _LIBCPP_TYPE_VIS_ONLY pair
-#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#if _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR != 0
: private __non_trivially_copyable_base
#endif
{
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -51,9 +51,13 @@
#elif _LIBCPP_ABI_VERSION == 1
// Feature macros for disabling pre ABI v1 features. All of these options
// are deprecated.
-#if defined(__FreeBSD__)
-#define