[libc++] Remove Fuchsia-specific knowledge to pick the ABI version

Summary:
The ABI version used by libc++ is a configuration option just like any other
configuration option. It is a knob that can be used by vendors to customize
the libc++ that they ship. As such, we should not be hardcoding vendor-specific
configuration choices in libc++.

When building libc++ for Fuchsia, Fuchsia's build scripts should simply define
the libc++ ABI version to 2 -- this will result in the _LIBCPP_ABI_VERSION
macro being defined in the __config header that is generated when libc++ is
built and installed, which is the correct way to customize libc++'s behavior
for specific vendors.

Reviewers: phosek, EricWF

Subscribers: mgorny, christof, dexonsmith, cfe-commits, libcxx-commits

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

llvm-svn: 343079
This commit is contained in:
Louis Dionne 2018-09-26 08:24:51 +00:00
parent 95aae4c59d
commit f9a52903ef
2 changed files with 3 additions and 12 deletions

View File

@ -111,12 +111,7 @@ cmake_dependent_option(LIBCXX_INSTALL_FILESYSTEM_LIBRARY
"Install libc++fs.a" ON
"LIBCXX_ENABLE_FILESYSTEM;LIBCXX_INSTALL_LIBRARY" OFF)
if (FUCHSIA)
set(DEFAULT_ABI_VERSION 2)
else()
set(DEFAULT_ABI_VERSION 1)
endif()
set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc++.")
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.")
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
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.")
@ -657,7 +652,7 @@ if (LIBCXX_STANDALONE_BUILD)
endif()
# Configuration file flags =====================================================
if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
if (NOT LIBCXX_ABI_VERSION EQUAL 1)
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
endif()
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)

View File

@ -36,11 +36,7 @@
#define _LIBCPP_VERSION 8000
#ifndef _LIBCPP_ABI_VERSION
# ifdef __Fuchsia__
# define _LIBCPP_ABI_VERSION 2
# else
# define _LIBCPP_ABI_VERSION 1
# endif
# define _LIBCPP_ABI_VERSION 1
#endif
#ifndef _LIBCPP_STD_VER