diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -179,9 +179,17 @@ "Install libc++experimental.a" ON "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) -set(LIBCXX_ABI_VERSION "1" CACHE STRING "ABI version of libc++. Can be either 1 or 2, where 2 is currently not stable. Defaults to 1.") -set(LIBCXX_ABI_NAMESPACE "" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") -option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) +option(LIBCXX_ABI_UNSTABLE "Use the unstable ABI of libc++. This is equivalent to specifying LIBCXX_ABI_VERSION=n, where n is the not-yet-stable version." OFF) +if (LIBCXX_ABI_UNSTABLE) + set(abi_version "2") +else() + set(abi_version "1") +endif() +set(LIBCXX_ABI_VERSION "${abi_version}" CACHE STRING "ABI version of libc++. Can be either 1 or 2, where 2 is currently the unstable ABI. Defaults to 1 unless LIBCXX_ABI_UNSTABLE is specified, in which case this is 2.") +set(LIBCXX_ABI_NAMESPACE "__${LIBCXX_ABI_VERSION}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") +if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*") + message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier.") +endif() option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.") option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.") @@ -858,19 +866,8 @@ endfunction() # Configuration file flags ===================================================== -if (NOT LIBCXX_ABI_VERSION EQUAL 1) - config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION) -endif() -if (NOT LIBCXX_ABI_NAMESPACE STREQUAL "") - if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*") - message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier.") - endif() - if (LIBCXX_ABI_NAMESPACE MATCHES "__[0-9]+$") - message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE '${LIBCXX_ABI_NAMESPACE}' is reserved for use by libc++.") - endif() - config_define(${LIBCXX_ABI_NAMESPACE} _LIBCPP_ABI_NAMESPACE) -endif() -config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE) +config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION) +config_define(${LIBCXX_ABI_NAMESPACE} _LIBCPP_ABI_NAMESPACE) config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM) config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT) config_define_if(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT) diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -443,10 +443,10 @@ with other libc++ versions. .. warning:: - When providing a custom namespace, it's the users responsibility to ensure the name won't cause + When providing a custom namespace, it's the user's responsibility to ensure the name won't cause conflicts with other names defined by libc++, both now and in the future. In particular, inline - namespaces of the form ``__[0-9]+`` are strictly reserved by libc++ and may not be used by users. - Doing otherwise could cause conflicts and hinder libc++ ABI evolution. + namespaces of the form ``__[0-9]+`` could cause conflicts with future versions of the library, + and so should be avoided. .. option:: LIBCXX_ABI_DEFINES:STRING diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -41,6 +41,12 @@ API Changes ----------- +- The ``_LIBCPP_ABI_UNSTABLE`` macro has been removed in favour of setting + ``_LIBCPP_ABI_VERSION=2``. This should not have any impact on users because + they were not supposed to set ``_LIBCPP_ABI_UNSTABLE`` manually, however we + still feel that it is worth mentioning in the release notes in case some users + had been doing it. + ABI Changes ----------- diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -26,14 +26,6 @@ #define _LIBCPP_VERSION 15000 -#ifdef _LIBCPP_ABI_UNSTABLE -# define _LIBCPP_ABI_VERSION 2 -#endif - -#ifndef _LIBCPP_ABI_VERSION -# define _LIBCPP_ABI_VERSION 1 -#endif - #if __STDC_HOSTED__ == 0 # define _LIBCPP_FREESTANDING #endif @@ -150,13 +142,6 @@ # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION #endif -#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y -#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) - -#ifndef _LIBCPP_ABI_NAMESPACE -# define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) -#endif - #if __cplusplus < 201103L #define _LIBCPP_CXX03_LANG #endif diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -10,7 +10,7 @@ #define _LIBCPP_CONFIG_SITE #cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@ -#cmakedefine _LIBCPP_ABI_UNSTABLE +#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ #cmakedefine _LIBCPP_ABI_FORCE_ITANIUM #cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT #cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT @@ -25,7 +25,6 @@ #cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS #cmakedefine _LIBCPP_NO_VCRUNTIME #cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@ -#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ #cmakedefine _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp --- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp +++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp @@ -14,14 +14,9 @@ // template struct pair -// Test that we properly provide the trivial copy operations by default. - -// FreeBSD provides the old ABI. This test checks the new ABI so we need -// to manually turn it on. -#undef _LIBCPP_ABI_UNSTABLE -#undef _LIBCPP_ABI_VERSION -#define _LIBCPP_ABI_VERSION 1 -#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +// Test that we provide the non-trivial copy operations when _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +// is specified. +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR #include #include @@ -31,10 +26,6 @@ #include "test_macros.h" -#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -#error trivial ctor ABI macro defined -#endif - template struct HasNonTrivialABI : std::integral_constant::value diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp --- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp +++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp @@ -12,11 +12,8 @@ // Test that we properly provide the trivial copy operations by default. -// FreeBSD provides the old ABI. This test checks the new ABI so we need -// to manually turn it on. -#if defined(__FreeBSD__) -#define _LIBCPP_ABI_UNSTABLE -#endif +// FreeBSD still provides the old ABI for std::pair. +// XFAIL: freebsd #include #include @@ -26,10 +23,6 @@ #include "test_macros.h" -#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -#error Non-trivial ctor ABI macro defined -#endif - template struct HasTrivialABI : std::integral_constant::value diff --git a/libcxx/utils/gdb/libcxx/printers.py b/libcxx/utils/gdb/libcxx/printers.py --- a/libcxx/utils/gdb/libcxx/printers.py +++ b/libcxx/utils/gdb/libcxx/printers.py @@ -7,8 +7,7 @@ #===----------------------------------------------------------------------===## """GDB pretty-printers for libc++. -These should work for objects compiled when _LIBCPP_ABI_UNSTABLE is defined -and when it is undefined. +These should work for objects compiled with either the stable ABI or the unstable ABI. """ from __future__ import print_function diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -119,7 +119,6 @@ '_LIBCPP_HAS_THREAD_API_PTHREAD': 'libcpp-has-thread-api-pthread', '_LIBCPP_NO_VCRUNTIME': 'libcpp-no-vcruntime', '_LIBCPP_ABI_VERSION': 'libcpp-abi-version', - '_LIBCPP_ABI_UNSTABLE': 'libcpp-abi-unstable', '_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY': 'libcpp-has-no-filesystem-library', '_LIBCPP_HAS_NO_RANDOM_DEVICE': 'libcpp-has-no-random-device', '_LIBCPP_HAS_NO_LOCALIZATION': 'libcpp-has-no-localization',