Index: vendor/libc++/dist-release_70/CMakeLists.txt =================================================================== --- vendor/libc++/dist-release_70/CMakeLists.txt (revision 338004) +++ vendor/libc++/dist-release_70/CMakeLists.txt (revision 338005) @@ -1,758 +1,760 @@ # See www/CMake.html for instructions on how to build libcxx with CMake. #=============================================================================== # Setup Project #=============================================================================== cmake_minimum_required(VERSION 3.4.3) if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default endif() if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang endif() if(POLICY CMP0068) cmake_policy(SET CMP0068 NEW) set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) endif() # Add path for custom modules set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH} ) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(libcxx CXX C) set(PACKAGE_NAME libcxx) set(PACKAGE_VERSION 7.0.0) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") # Find the LLVM sources and simulate LLVM CMake options. include(HandleOutOfTreeLLVM) endif() if (LIBCXX_STANDALONE_BUILD) include(FindPythonInterp) if( NOT PYTHONINTERP_FOUND ) message(WARNING "Failed to find python interpreter. " "The libc++ test suite will be disabled.") set(LLVM_INCLUDE_TESTS OFF) endif() endif() # Require out of source build. include(MacroEnsureOutOfSourceBuild) MACRO_ENSURE_OUT_OF_SOURCE_BUILD( "${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there." ) if (MSVC) set(LIBCXX_TARGETING_MSVC ON) else() set(LIBCXX_TARGETING_MSVC OFF) endif() #=============================================================================== # Setup CMake Options #=============================================================================== include(CMakeDependentOption) include(HandleCompilerRT) # Basic options --------------------------------------------------------------- option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF) option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) if (WIN32) set(ENABLE_FILESYSTEM_DEFAULT OFF) endif() option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++fs.a" ${ENABLE_FILESYSTEM_DEFAULT}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) # Benchmark options ----------------------------------------------------------- option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependancies" ON) set(LIBCXX_BENCHMARK_NATIVE_STDLIB "" CACHE STRING "Build the benchmarks against the specified native STL. The value must be one of libc++/libstdc++") set(LIBCXX_BENCHMARK_NATIVE_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain when building the native benchmarks") if (LIBCXX_BENCHMARK_NATIVE_STDLIB) if (NOT (LIBCXX_BENCHMARK_NATIVE_STDLIB STREQUAL "libc++" OR LIBCXX_BENCHMARK_NATIVE_STDLIB STREQUAL "libstdc++")) message(FATAL_ERROR "Invalid value for LIBCXX_BENCHMARK_NATIVE_STDLIB: " "'${LIBCXX_BENCHMARK_NATIVE_STDLIB}'") endif() endif() option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS}) set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "Define suffix of library directory name (32/64)") option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON) option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON) cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY "Install the static libc++ library." ON "LIBCXX_ENABLE_STATIC;LIBCXX_INSTALL_LIBRARY" OFF) cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY "Install the shared libc++ library." ON "LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF) option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON) cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY "Install libc++experimental.a" ON "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) 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++.") 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.") +option(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT "Enable per TU ABI insulation by default. To be used by vendors." OFF) set(LIBCXX_ABI_DEFINES "" CACHE STRING "A semicolon separated list of ABI macros to define in the site config header.") option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF) if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) message(FATAL_ERROR "libc++ must be built as either a shared or static library.") endif() # ABI Library options --------------------------------------------------------- set(LIBCXX_CXX_ABI "default" CACHE STRING "Specify C++ ABI library to use.") set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++ vcruntime) set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS}) # Setup the default options if LIBCXX_CXX_ABI is not specified. if (LIBCXX_CXX_ABI STREQUAL "default") find_path( LIBCXX_LIBCXXABI_INCLUDES_INTERNAL cxxabi.h PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxxabi/include ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) if (LIBCXX_TARGETING_MSVC) # FIXME: Figure out how to configure the ABI library on Windows. set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) elseif (APPLE) set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_SYSTEM 1) elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1") else() set(LIBCXX_CXX_ABI_LIBNAME "default") endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") endif() # Use a static copy of the ABI library when linking libc++. This option # cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT. option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF) cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY "Statically link the ABI library to static library" ON "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF) cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY "Statically link the ABI library to shared library" ON - "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF) + "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF) # Generate and install a linker script inplace of libc++.so. The linker script # will link libc++ to the correct ABI library. This option is on by default # on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' # is on. This option is also disabled when the ABI library is not specified # or is specified to be "none". set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF) if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none" AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default" AND PYTHONINTERP_FOUND AND LIBCXX_ENABLE_SHARED) set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON) endif() option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT "Use and install a linker script for the given ABI library" ${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE}) set(ENABLE_NEW_DELETE_DEFAULT ON) if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link # programs due to undefined references to new/delete in libc++abi so to work # around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS # to ON. Once the GCC bug has been worked around this option should be changed # back to OFF. set(ENABLE_NEW_DELETE_DEFAULT ON) endif() option(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS "Build libc++ with definitions for operator new/delete. This option can be used to disable the definitions when libc++abi is expected to provide them" ${ENABLE_NEW_DELETE_DEFAULT}) # Build libc++abi with libunwind. We need this option to determine whether to # link with libunwind or libgcc_s while running the test cases. option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF) option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF) # Target options -------------------------------------------------------------- option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS}) set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.") set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.") # Feature options ------------------------------------------------------------- option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON) option(LIBCXX_ENABLE_RTTI "Use run time type information." ON) option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON) option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON) option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON) option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON) option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON) option(LIBCXX_ENABLE_MONOTONIC_CLOCK "Build libc++ with support for a monotonic clock. This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON) option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF) option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF) option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF) option(LIBCXX_HAS_EXTERNAL_THREAD_API "Build libc++ with an externalized threading API. This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF) option(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY "Build libc++ with an externalized threading library. This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON" OFF) # Misc options ---------------------------------------------------------------- # FIXME: Turn -pedantic back ON. It is currently off because it warns # about #include_next which is used everywhere. option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) option(LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS "Disable #warnings about conflicting macros." OFF) option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF) set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING "The Profile-rt library used to build with code coverage") # Don't allow a user to accidentally overwrite the system libc++ installation on Darwin. # If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++ # will not be generated and a warning will be issued. option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF) mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default. if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL) if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") message(WARNING "Disabling libc++ install rules because installation would " "overwrite the systems installation. Configure with " "-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.") mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option. set(LIBCXX_INSTALL_HEADERS OFF) set(LIBCXX_INSTALL_LIBRARY OFF) endif() endif() set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF) if (XCODE OR MSVC_IDE) set(LIBCXX_CONFIGURE_IDE_DEFAULT ON) endif() option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE" ${LIBCXX_CONFIGURE_IDE_DEFAULT}) #=============================================================================== # Check option configurations #=============================================================================== if (LIBCXX_ENABLE_FILESYSTEM AND NOT LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) message(FATAL_ERROR "LIBCXX_ENABLE_FILESYSTEM cannot be turned on when LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF") endif() # Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when # LIBCXX_ENABLE_THREADS is on. if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK) message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF" " when LIBCXX_ENABLE_THREADS is also set to OFF.") endif() if(NOT LIBCXX_ENABLE_THREADS) if(LIBCXX_HAS_PTHREAD_API) message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON" " when LIBCXX_ENABLE_THREADS is also set to ON.") endif() if(LIBCXX_HAS_EXTERNAL_THREAD_API) message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON" " when LIBCXX_ENABLE_THREADS is also set to ON.") endif() if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set " "to ON when LIBCXX_ENABLE_THREADS is also set to ON.") endif() if (LIBCXX_HAS_WIN32_THREAD_API) message(FATAL_ERROR "LIBCXX_HAS_WIN32_THREAD_API can only be set to ON" " when LIBCXX_ENABLE_THREADS is also set to ON.") endif() endif() if (LIBCXX_HAS_EXTERNAL_THREAD_API) if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) message(FATAL_ERROR "The options LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY and " "LIBCXX_HAS_EXTERNAL_THREAD_API cannot both be ON at " "the same time") endif() if (LIBCXX_HAS_PTHREAD_API) message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" "and LIBCXX_HAS_PTHREAD_API cannot be both" "set to ON at the same time.") endif() if (LIBCXX_HAS_WIN32_THREAD_API) message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" "and LIBCXX_HAS_WIN32_THREAD_API cannot be both" "set to ON at the same time.") endif() endif() if (LIBCXX_HAS_PTHREAD_API) if (LIBCXX_HAS_WIN32_THREAD_API) message(FATAL_ERROR "The options LIBCXX_HAS_PTHREAD_API" "and LIBCXX_HAS_WIN32_THREAD_API cannot be both" "set to ON at the same time.") endif() endif() # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE # is ON. if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE) message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE") endif() # Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS) # and check that we can build with 32 bits if requested. if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32) if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM message(STATUS "Building 32 bits executables and libraries.") endif() elseif(LIBCXX_BUILD_32_BITS) message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.") endif() # Check that this option is not enabled on Apple and emit a usage warning. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) if (APPLE) message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X") else() message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option") endif() if (LIBCXX_ENABLE_STATIC AND NOT PYTHONINTERP_FOUND) message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY requires python but it was not found.") endif() endif() if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) if (APPLE) message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets") endif() if (NOT PYTHONINTERP_FOUND) message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.") endif() if (NOT LIBCXX_ENABLE_SHARED) message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT is only available for shared library builds.") endif() endif() if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) message(FATAL_ERROR "Conflicting options given. LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with LIBCXX_ENABLE_ABI_LINKER_SCRIPT") endif() if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS) message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off" "when building for Musl with LIBCXX_HAS_MUSL_LIBC.") endif() if (LIBCXX_ABI_FORCE_ITANIUM AND LIBCXX_ABI_FORCE_MICROSOFT) message(FATAL_ERROR "Only one of LIBCXX_ABI_FORCE_ITANIUM and LIBCXX_ABI_FORCE_MICROSOFT can be specified.") endif () #=============================================================================== # Configure System #=============================================================================== set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) set(DEFAULT_INSTALL_HEADER_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBCXX_LIBDIR_SUFFIX}) set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) endif() file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") set(LIBCXX_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libc++ destination prefix.") set(LIBCXX_INSTALL_HEADER_PREFIX ${DEFAULT_INSTALL_HEADER_PREFIX} CACHE STRING "Define libc++ header destination prefix.") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) # Declare libc++ configuration variables. # They are intended for use as follows: # LIBCXX_CXX_FLAGS: General flags for both the compiler and linker. # LIBCXX_COMPILE_FLAGS: Compile only flags. # LIBCXX_LINK_FLAGS: Linker only flags. # LIBCXX_LIBRARIES: libraries libc++ is linked to. # LIBCXX_INTERFACE_LIBRARIES: Libraries that must be linked when using libc++ # These libraries are exposed in the linker script. set(LIBCXX_COMPILE_FLAGS "") set(LIBCXX_LINK_FLAGS "") set(LIBCXX_LIBRARIES "") set(LIBCXX_INTERFACE_LIBRARIES "") # Include macros for adding and removing libc++ flags. include(HandleLibcxxFlags) # Target flags ================================================================ # These flags get added to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS so that # 'config-ix' use them during feature checks. It also adds them to both # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32") add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}") add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}") add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") if (LIBCXX_TARGET_TRIPLE) set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}") endif() # Configure compiler. include(config-ix) if (LIBCXX_USE_COMPILER_RT) list(APPEND LIBCXX_LINK_FLAGS "-rtlib=compiler-rt") endif() # Configure coverage options. if (LIBCXX_GENERATE_COVERAGE) include(CodeCoverage) set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE) endif() string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") set(LIBCXX_DEBUG_BUILD ON) else() set(LIBCXX_DEBUG_BUILD OFF) endif() #=============================================================================== # Setup Compiler Flags #=============================================================================== include(HandleLibCXXABI) # Setup the ABI library flags if (NOT LIBCXX_STANDALONE_BUILD) # Remove flags that may have snuck in. remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG -lc++abi) endif() remove_flags(-stdlib=libc++ -stdlib=libstdc++) # FIXME: Remove all debug flags and flags that change which Windows # default libraries are linked. Currently we only support linking the # non-debug DLLs remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md") # FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors # so they don't get transformed into -Wno and -errors respectively. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) # Required flags ============================================================== set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") if (LIBCXX_HAS_MUSL_LIBC) # musl's pthread implementations uses volatile types in their structs which is # not a constexpr in C++11 but is in C++14, so we use C++14 with musl. set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change build dialect") endif() add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME) if(NOT ${SUPPORTS_DIALECT_NAME}) if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}") endif() endif() # On all systems the system c++ standard library headers need to be excluded. # MSVC only has -X, which disables all default includes; including the crt. # Thus, we do nothing and hope we don't accidentally include any of the C++ # headers add_compile_flags_if_supported(-nostdinc++) # Hide all inline function definitions which have not explicitly been marked # visible. This prevents new definitions for inline functions from appearing in # the dylib when get ODR used by another function. add_compile_flags_if_supported(-fvisibility-inlines-hidden) if (LIBCXX_CONFIGURE_IDE) # This simply allows IDE to process add_compile_flags_if_supported(-fcoroutines-ts) endif() # Let the library headers know they are currently being used to build the # library. add_definitions(-D_LIBCPP_BUILDING_LIBRARY) if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS) add_definitions(-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS) endif() # Warning flags =============================================================== add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) add_compile_flags_if_supported( -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") add_compile_flags_if_supported( -Wno-user-defined-literals -Wno-covered-switch-default) elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") add_compile_flags_if_supported( -Wno-literal-suffix -Wno-c++14-compat -Wno-noexcept-type) endif() if (LIBCXX_ENABLE_WERROR) add_compile_flags_if_supported(-Werror) add_compile_flags_if_supported(-WX) else() # TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is # added elsewhere. add_compile_flags_if_supported(-Wno-error) endif() if (LIBCXX_ENABLE_PEDANTIC) add_compile_flags_if_supported(-pedantic) endif() if (LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS) add_definitions(-D_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) endif() # Exception flags ============================================================= if (LIBCXX_ENABLE_EXCEPTIONS) # Catches C++ exceptions only and tells the compiler to assume that extern C # functions never throw a C++ exception. add_compile_flags_if_supported(-EHsc) else() add_definitions(-D_LIBCPP_NO_EXCEPTIONS) add_compile_flags_if_supported(-EHs- -EHa-) add_compile_flags_if_supported(-fno-exceptions) endif() # RTTI flags ================================================================== if (NOT LIBCXX_ENABLE_RTTI) add_definitions(-D_LIBCPP_NO_RTTI) add_compile_flags_if_supported(-GR-) add_compile_flags_if_supported(-fno-rtti) endif() # Threading flags ============================================================= if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED) # Need to allow unresolved symbols if this is to work with shared library builds if (APPLE) add_link_flags("-undefined dynamic_lookup") else() # Relax this restriction from HandleLLVMOptions string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") endif() endif() # Assertion flags ============================================================= define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG) define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG) define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0) define_if(LIBCXX_DEBUG_BUILD -D_DEBUG) if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD) # MSVC doesn't like _DEBUG on release builds. See PR 4379. define_if_not(LIBCXX_TARGETING_MSVC -D_DEBUG) endif() # Modules flags =============================================================== # FIXME The libc++ sources are fundamentally non-modular. They need special # versions of the headers in order to provide C++03 and legacy ABI definitions. # NOTE: The public headers can be used with modules in all other contexts. if (LLVM_ENABLE_MODULES) # Ignore that the rest of the modules flags are now unused. add_compile_flags_if_supported(-Wno-unused-command-line-argument) add_compile_flags(-fno-modules) endif() # Sanitizer flags ============================================================= # Configure for sanitizers. If LIBCXX_STANDALONE_BUILD then we have to do # the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it. if (LIBCXX_STANDALONE_BUILD) set(LLVM_USE_SANITIZER "" CACHE STRING "Define the sanitizer used to build the library and tests") # NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC. # But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do. if (LLVM_USE_SANITIZER AND NOT MSVC) add_flags_if_supported("-fno-omit-frame-pointer") add_flags_if_supported("-gline-tables-only") if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") add_flags_if_supported("-gline-tables-only") endif() if (LLVM_USE_SANITIZER STREQUAL "Address") add_flags("-fsanitize=address") elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?") add_flags(-fsanitize=memory) if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins") add_flags("-fsanitize-memory-track-origins") endif() elseif (LLVM_USE_SANITIZER STREQUAL "Undefined") add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all") elseif (LLVM_USE_SANITIZER STREQUAL "Thread") add_flags(-fsanitize=thread) else() message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}") endif() elseif(LLVM_USE_SANITIZER AND MSVC) message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.") endif() endif() # Configuration file flags ===================================================== if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION) config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION) endif() config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE) 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) config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE) config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN) config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT) config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS) config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK) config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS) config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD) config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL) config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32) config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME) if (LIBCXX_ABI_DEFINES) set(abi_defines) foreach (abi_define ${LIBCXX_ABI_DEFINES}) if (NOT abi_define MATCHES "^_LIBCPP_ABI_") message(SEND_ERROR "Invalid ABI macro ${abi_define} in LIBCXX_ABI_DEFINES") endif() list(APPEND abi_defines "#define ${abi_define}") endforeach() string(REPLACE ";" "\n" abi_defines "${abi_defines}") config_define(${abi_defines} _LIBCPP_ABI_DEFINES) endif() # By default libc++ on Windows expects to use a shared library, which requires # the headers to use DLL import/export semantics. However when building a # static library only we modify the headers to disable DLL import/export. if (DEFINED WIN32 AND LIBCXX_ENABLE_STATIC AND NOT LIBCXX_ENABLE_SHARED) message(STATUS "Generating custom __config for non-DLL Windows build") config_define(ON _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) endif() set(site_config_path "${LIBCXX_BINARY_DIR}/__config_site") if (LIBCXX_NEEDS_SITE_CONFIG) configure_file("include/__config_site.in" "${site_config_path}" @ONLY) # Provide the config definitions by included the generated __config_site # file at compile time. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") add_compile_flags("/FI\"${LIBCXX_BINARY_DIR}/__config_site\"") else() add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site") endif() else() if (EXISTS "${site_config_path}") message(STATUS "Removing stale site configuration ${site_config_path}") file(REMOVE "${site_config_path}") endif() endif() #=============================================================================== # Setup Source Code And Tests #=============================================================================== include_directories(include) add_subdirectory(include) add_subdirectory(lib) if (LIBCXX_INCLUDE_BENCHMARKS) add_subdirectory(benchmarks) endif() # Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or # LLVM_FOUND is OFF. This allows users to run the tests manually using # LIT without requiring a full LLVM checkout. # # However, since some submission systems strip test/ subdirectories, check for # it before adding it. if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") add_subdirectory(test) endif() if (LIBCXX_INCLUDE_TESTS) add_subdirectory(lib/abi) endif() if (LIBCXX_STANDALONE_BUILD AND EXISTS "${LLVM_MAIN_SRC_DIR}/utils/llvm-lit") include(AddLLVM) # for get_llvm_lit_path # Make sure the llvm-lit script is generated into the bin directory, and do # it after adding all tests, since the generated script will only work # correctly discovered tests against test locations from the source tree that # have already been discovered. add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit) endif() if (LIBCXX_INCLUDE_DOCS) add_subdirectory(docs) endif() Index: vendor/libc++/dist-release_70/docs/BuildingLibcxx.rst =================================================================== --- vendor/libc++/dist-release_70/docs/BuildingLibcxx.rst (revision 338004) +++ vendor/libc++/dist-release_70/docs/BuildingLibcxx.rst (revision 338005) @@ -1,513 +1,522 @@ .. _BuildingLibcxx: =============== Building libc++ =============== .. contents:: :local: .. _build instructions: Getting Started =============== On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install Xcode 4.2 or later. However if you want to install tip-of-trunk from here (getting the bleeding edge), read on. The basic steps needed to build libc++ are: #. Checkout LLVM: * ``cd where-you-want-llvm-to-live`` * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` #. Checkout libc++: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/projects`` * ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx`` #. Checkout libc++abi: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/projects`` * ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi`` #. Configure and build libc++ with libc++abi: CMake is the only supported configuration system. Clang is the preferred compiler when building and using libc++. * ``cd where you want to build llvm`` * ``mkdir build`` * ``cd build`` * ``cmake -G [options] `` For more information about configuring libc++ see :ref:`CMake Options`. * ``make cxx`` --- will build libc++ and libc++abi. * ``make check-cxx check-cxxabi`` --- will run the test suites. Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib. See :ref:`using an alternate libc++ installation ` #. **Optional**: Install libc++ and libc++abi If your system already provides a libc++ installation it is important to be careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to select a safe place to install libc++. * ``make install-cxx install-cxxabi`` --- Will install the libraries and the headers .. warning:: * Replacing your systems libc++ installation could render the system non-functional. * Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``. The instructions are for building libc++ on FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library. On Linux, it is also possible to use :ref:`libsupc++ ` or libcxxrt. It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree build would look like this: .. code-block:: bash $ cd where-you-want-libcxx-to-live $ # Check out llvm, libc++ and libc++abi. $ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` $ ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx`` $ ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi`` $ cd where-you-want-to-build $ mkdir build && cd build $ export CC=clang CXX=clang++ $ cmake -DLLVM_PATH=path/to/llvm \ -DLIBCXX_CXX_ABI=libcxxabi \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include \ path/to/libcxx $ make $ make check-libcxx # optional Experimental Support for Windows -------------------------------- The Windows support requires building with clang-cl as cl does not support one required extension: `#include_next`. Furthermore, VS 2015 or newer (19.00) is required. In the case of clang-cl, we need to specify the "MS Compatibility Version" as it defaults to 2014 (18.00). CMake + Visual Studio ~~~~~~~~~~~~~~~~~~~~~ Building with Visual Studio currently does not permit running tests. However, it is the simplest way to build. .. code-block:: batch > cmake -G "Visual Studio 14 2015" ^ -T "LLVM-vs2014" ^ -DLIBCXX_ENABLE_SHARED=YES ^ -DLIBCXX_ENABLE_STATIC=NO ^ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^ \path\to\libcxx > cmake --build . CMake + ninja ~~~~~~~~~~~~~ Building with ninja is required for development to enable tests. Unfortunately, doing so requires additional configuration as we cannot just specify a toolset. .. code-block:: batch > cmake -G Ninja ^ -DCMAKE_MAKE_PROGRAM=/path/to/ninja ^ -DCMAKE_SYSTEM_NAME=Windows ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^ -DCMAKE_CXX_COMPILER=clang-cl ^ -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^ -DLLVM_PATH=/path/to/llvm/tree ^ -DLIBCXX_ENABLE_SHARED=YES ^ -DLIBCXX_ENABLE_STATIC=NO ^ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^ \path\to\libcxx > /path/to/ninja cxx > /path/to/ninja check-cxx Note that the paths specified with backward slashes must use the `\\` as the directory separator as clang-cl may otherwise parse the path as an argument. .. _`libc++abi`: http://libcxxabi.llvm.org/ .. _CMake Options: CMake Options ============= Here are some of the CMake variables that are used often, along with a brief explanation and LLVM-specific notes. For full documentation, check the CMake docs or execute ``cmake --help-variable VARIABLE_NAME``. **CMAKE_BUILD_TYPE**:STRING Sets the build type for ``make`` based generators. Possible values are Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio the user sets the build type with the IDE settings. **CMAKE_INSTALL_PREFIX**:PATH Path where LLVM will be installed if "make install" is invoked or the "INSTALL" target is built. **CMAKE_CXX_COMPILER**:STRING The C++ compiler to use when building and testing libc++. .. _libcxx-specific options: libc++ specific options ----------------------- .. option:: LIBCXX_INSTALL_LIBRARY:BOOL **Default**: ``ON`` Toggle the installation of the library portion of libc++. .. option:: LIBCXX_INSTALL_HEADERS:BOOL **Default**: ``ON`` Toggle the installation of the libc++ headers. .. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL **Default**: ``ON`` Build libc++ with assertions enabled. .. option:: LIBCXX_BUILD_32_BITS:BOOL **Default**: ``OFF`` Build libc++ as a 32 bit library. Also see `LLVM_BUILD_32_BITS`. .. option:: LIBCXX_ENABLE_SHARED:BOOL **Default**: ``ON`` Build libc++ as a shared library. Either `LIBCXX_ENABLE_SHARED` or `LIBCXX_ENABLE_STATIC` has to be enabled. .. option:: LIBCXX_ENABLE_STATIC:BOOL **Default**: ``ON`` Build libc++ as a static library. Either `LIBCXX_ENABLE_SHARED` or `LIBCXX_ENABLE_STATIC` has to be enabled. .. option:: LIBCXX_LIBDIR_SUFFIX:STRING Extra suffix to append to the directory where libraries are to be installed. This option overrides `LLVM_LIBDIR_SUFFIX`. .. option:: LIBCXX_INSTALL_PREFIX:STRING **Default**: ``""`` Define libc++ destination prefix. .. _libc++experimental options: libc++experimental Specific Options ------------------------------------ .. option:: LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL **Default**: ``ON`` Build and test libc++experimental.a. .. option:: LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY:BOOL **Default**: ``LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY AND LIBCXX_INSTALL_LIBRARY`` Install libc++experimental.a alongside libc++. .. option:: LIBCXX_ENABLE_FILESYSTEM:BOOL **Default**: ``ON`` Build filesystem as a standalone library libc++fs.a. .. option:: LIBCXX_INSTALL_FILESYSTEM_LIBRARY:BOOL **Default**: ``LIBCXX_ENABLE_FILESYSTEM AND LIBCXX_INSTALL_LIBRARY`` Install libc++fs.a alongside libc++. .. _ABI Library Specific Options: ABI Library Specific Options ---------------------------- .. option:: LIBCXX_CXX_ABI:STRING **Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``, ``libsupc++``. Select the ABI library to build libc++ against. .. option:: LIBCXX_CXX_ABI_INCLUDE_PATHS:PATHS Provide additional search paths for the ABI library headers. .. option:: LIBCXX_CXX_ABI_LIBRARY_PATH:PATH Provide the path to the ABI library that libc++ should link against. .. option:: LIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL **Default**: ``OFF`` If this option is enabled, libc++ will try and link the selected ABI library statically. .. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL **Default**: ``ON`` by default on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``. This option generate and installs a linker script as ``libc++.so`` which links the correct ABI library. .. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL **Default**: ``OFF`` Build and use the LLVM unwinder. Note: This option can only be used when libc++abi is the C++ ABI library used. libc++ Feature Options ---------------------- .. option:: LIBCXX_ENABLE_EXCEPTIONS:BOOL **Default**: ``ON`` Build libc++ with exception support. .. option:: LIBCXX_ENABLE_RTTI:BOOL **Default**: ``ON`` Build libc++ with run time type information. .. option:: LIBCXX_INCLUDE_BENCHMARKS:BOOL **Default**: ``ON`` Build the libc++ benchmark tests and the Google Benchmark library needed to support them. .. option:: LIBCXX_BENCHMARK_NATIVE_STDLIB:STRING **Default**:: ``""`` **Values**:: ``libc++``, ``libstdc++`` Build the libc++ benchmark tests and Google Benchmark library against the specified standard library on the platform. On linux this can be used to compare libc++ to libstdc++ by building the benchmark tests against both standard libraries. .. option:: LIBCXX_BENCHMARK_NATIVE_GCC_TOOLCHAIN:STRING Use the specified GCC toolchain and standard library when building the native stdlib benchmark tests. +.. option:: LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT:BOOL + + **Default**: ``OFF`` + + Pick the default for whether to constrain ABI-unstable symbols to + each individual translation unit. This setting controls whether + `_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined by default -- + see the documentation of that macro for details. + libc++ ABI Feature Options -------------------------- The following options allow building libc++ for a different ABI version. .. option:: LIBCXX_ABI_VERSION:STRING **Default**: ``1`` Defines the target ABI version of libc++. .. option:: LIBCXX_ABI_UNSTABLE:BOOL **Default**: ``OFF`` Build the "unstable" ABI version of libc++. Includes all ABI changing features on top of the current stable version. .. option:: LIBCXX_ABI_DEFINES:STRING **Default**: ``""`` A semicolon-separated list of ABI macros to persist in the site config header. See ``include/__config`` for the list of ABI macros. .. _LLVM-specific variables: LLVM-specific options --------------------- .. option:: LLVM_LIBDIR_SUFFIX:STRING Extra suffix to append to the directory where libraries are to be installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64`` to install libraries to ``/usr/lib64``. .. option:: LLVM_BUILD_32_BITS:BOOL Build 32-bits executables and libraries on 64-bits systems. This option is available only on some 64-bits unix systems. Defaults to OFF. .. option:: LLVM_LIT_ARGS:STRING Arguments given to lit. ``make check`` and ``make clang-test`` are affected. By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on others. Using Alternate ABI libraries ============================= .. _libsupcxx: Using libsupc++ on Linux ------------------------ You will need libstdc++ in order to provide libsupc++. Figure out where the libsupc++ headers are on your system. On Ubuntu this is ``/usr/include/c++/`` and ``/usr/include/c++//`` You can also figure this out by running .. code-block:: bash $ echo | g++ -Wp,-v -x c++ - -fsyntax-only ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/4.7 /usr/include/c++/4.7/x86_64-linux-gnu /usr/include/c++/4.7/backward /usr/lib/gcc/x86_64-linux-gnu/4.7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. Note that the first two entries happen to be what we are looking for. This may not be correct on other platforms. We can now run CMake: .. code-block:: bash $ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \ -DLIBCXX_CXX_ABI=libstdc++ \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ You can also substitute ``-DLIBCXX_CXX_ABI=libsupc++`` above, which will cause the library to be linked to libsupc++ instead of libstdc++, but this is only recommended if you know that you will never need to link against libstdc++ in the same executable as libc++. GCC ships libsupc++ separately but only as a static library. If a program also needs to link against libstdc++, it will provide its own copy of libsupc++ and this can lead to subtle problems. .. code-block:: bash $ make cxx $ make install You can now run clang with -stdlib=libc++. .. _libcxxrt_ref: Using libcxxrt on Linux ------------------------ You will need to keep the source tree of `libcxxrt`_ available on your build machine and your copy of the libcxxrt shared library must be placed where your linker will find it. We can now run CMake like: .. code-block:: bash $ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \ -DLIBCXX_CXX_ABI=libcxxrt \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxrt-sources/src \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ $ make cxx $ make install Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, as clang is set up to link for libc++ linked to libsupc++. To get around this you'll have to set up your linker yourself (or patch clang). For example, .. code-block:: bash $ clang++ -stdlib=libc++ helloworld.cpp \ -nodefaultlibs -lc++ -lcxxrt -lm -lc -lgcc_s -lgcc Alternately, you could just add libcxxrt to your libraries list, which in most situations will give the same result: .. code-block:: bash $ clang++ -stdlib=libc++ helloworld.cpp -lcxxrt .. _`libcxxrt`: https://github.com/pathscale/libcxxrt/ Using a local ABI library installation --------------------------------------- .. warning:: This is not recommended in almost all cases. These instructions should only be used when you can't install your ABI library. Normally you must link libc++ against a ABI shared library that the linker can find. If you want to build and test libc++ against an ABI library not in the linker's path you needq to set ``-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib`` when configuring CMake. An example build using libc++abi would look like: .. code-block:: bash $ CC=clang CXX=clang++ cmake \ -DLIBCXX_CXX_ABI=libc++abi \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/path/to/libcxxabi/include" \ -DLIBCXX_CXX_ABI_LIBRARY_PATH="/path/to/libcxxabi-build/lib" \ path/to/libcxx $ make When testing libc++ LIT will automatically link against the proper ABI library. Index: vendor/libc++/dist-release_70/docs/DesignDocs/VisibilityMacros.rst =================================================================== --- vendor/libc++/dist-release_70/docs/DesignDocs/VisibilityMacros.rst (revision 338004) +++ vendor/libc++/dist-release_70/docs/DesignDocs/VisibilityMacros.rst (revision 338005) @@ -1,179 +1,212 @@ ======================== Symbol Visibility Macros ======================== .. contents:: :local: Overview ======== Libc++ uses various "visibility" macros in order to provide a stable ABI in both the library and the headers. These macros work by changing the visibility and inlining characteristics of the symbols they are applied to. Visibility Macros ================= **_LIBCPP_HIDDEN** Mark a symbol as hidden so it will not be exported from shared libraries. **_LIBCPP_FUNC_VIS** Mark a symbol as being exported by the libc++ library. This attribute must be applied to the declaration of all functions exported by the libc++ dylib. **_LIBCPP_EXTERN_VIS** Mark a symbol as being exported by the libc++ library. This attribute may only be applied to objects defined in the libc++ library. On Windows this macro applies `dllimport`/`dllexport` to the symbol. On all other platforms this macro has no effect. **_LIBCPP_OVERRIDABLE_FUNC_VIS** Mark a symbol as being exported by the libc++ library, but allow it to be overridden locally. On non-Windows, this is equivalent to `_LIBCPP_FUNC_VIS`. This macro is applied to all `operator new` and `operator delete` overloads. **Windows Behavior**: Any symbol marked `dllimport` cannot be overridden locally, since `dllimport` indicates the symbol should be bound to a separate DLL. All `operator new` and `operator delete` overloads are required to be locally overridable, and therefore must not be marked `dllimport`. On Windows, this macro therefore expands to `__declspec(dllexport)` when building the library and has an empty definition otherwise. **_LIBCPP_HIDE_FROM_ABI** Mark a function as not being part of the ABI of any final linked image that - uses it, and also as being internal to each TU that uses that function. In - other words, the address of a function marked with this attribute is not - guaranteed to be the same across translation units. + uses it. + +**_LIBCPP_HIDE_FROM_ABI_PER_TU** + This macro controls whether symbols hidden from the ABI with `_LIBCPP_HIDE_FROM_ABI` + are local to each translation unit in addition to being local to each final + linked image. This macro is defined to either 0 or 1. When it is defined to + 1, translation units compiled with different versions of libc++ can be linked + together, since all non ABI-facing functions are local to each translation unit. + This allows static archives built with different versions of libc++ to be linked + together. This also means that functions marked with `_LIBCPP_HIDE_FROM_ABI` + are not guaranteed to have the same address across translation unit boundaries. + + When the macro is defined to 0, there is no guarantee that translation units + compiled with different versions of libc++ can interoperate. However, this + leads to code size improvements, since non ABI-facing functions can be + deduplicated across translation unit boundaries. + + This macro can be defined by users to control the behavior they want from + libc++. The default value of this macro (0 or 1) is controlled by whether + `_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined, which is intended to + be used by vendors only (see below). + +**_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT** + This macro controls the default value for `_LIBCPP_HIDE_FROM_ABI_PER_TU`. + When the macro is defined, per TU ABI insulation is enabled by default, and + `_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 1 unless overriden by users. + Otherwise, per TU ABI insulation is disabled by default, and + `_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 0 unless overriden by users. + + This macro is intended for vendors to control whether they want to ship + libc++ with per TU ABI insulation enabled by default. Users can always + control the behavior they want by defining `_LIBCPP_HIDE_FROM_ABI_PER_TU` + appropriately. + + By default, this macro is not defined, which means that per TU ABI insulation + is not provided unless explicitly overriden by users. **_LIBCPP_TYPE_VIS** Mark a type's typeinfo, vtable and members as having default visibility. This attribute cannot be used on class templates. **_LIBCPP_TEMPLATE_VIS** Mark a type's typeinfo and vtable as having default visibility. This macro has no effect on the visibility of the type's member functions. **GCC Behavior**: GCC does not support Clang's `type_visibility(...)` attribute. With GCC the `visibility(...)` attribute is used and member functions are affected. **Windows Behavior**: DLLs do not support dllimport/export on class templates. The macro has an empty definition on this platform. **_LIBCPP_ENUM_VIS** Mark the typeinfo of an enum as having default visibility. This attribute should be applied to all enum declarations. **Windows Behavior**: DLLs do not support importing or exporting enumeration typeinfo. The macro has an empty definition on this platform. **GCC Behavior**: GCC un-hides the typeinfo for enumerations by default, even if `-fvisibility=hidden` is specified. Additionally applying a visibility attribute to an enum class results in a warning. The macro has an empty definition with GCC. **_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS** Mark the member functions, typeinfo, and vtable of the type named in a `_LIBCPP_EXTERN_TEMPLATE` declaration as being exported by the libc++ library. This attribute must be specified on all extern class template declarations. This macro is used to override the `_LIBCPP_TEMPLATE_VIS` attribute specified on the primary template and to export the member functions produced by the explicit instantiation in the dylib. **GCC Behavior**: GCC ignores visibility attributes applied the type in extern template declarations and applying an attribute results in a warning. However since `_LIBCPP_TEMPLATE_VIS` is the same as `__attribute__((visibility("default"))` the visibility is already correct. The macro has an empty definition with GCC. **Windows Behavior**: `extern template` and `dllexport` are fundamentally incompatible *on a class template* on Windows; the former suppresses instantiation, while the latter forces it. Specifying both on the same declaration makes the class template be instantiated, which is not desirable inside headers. This macro therefore expands to `dllimport` outside of libc++ but nothing inside of it (rather than expanding to `dllexport`); instead, the explicit instantiations themselves are marked as exported. Note that this applies *only* to extern *class* templates. Extern *function* templates obey regular import/export semantics, and applying `dllexport` directly to the extern template declaration (i.e. using `_LIBCPP_FUNC_VIS`) is the correct thing to do for them. **_LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS** Mark the member functions, typeinfo, and vtable of an explicit instantiation of a class template as being exported by the libc++ library. This attribute must be specified on all class template explicit instantiations. It is only necessary to mark the explicit instantiation itself (as opposed to the extern template declaration) as exported on Windows, as discussed above. On all other platforms, this macro has an empty definition. **_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS** Mark a symbol as hidden so it will not be exported from shared libraries. This is intended specifically for method templates of either classes marked with `_LIBCPP_TYPE_VIS` or classes with an extern template instantiation declaration marked with `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`. When building libc++ with hidden visibility, we want explicit template instantiations to export members, which is consistent with existing Windows behavior. We also want classes annotated with `_LIBCPP_TYPE_VIS` to export their members, which is again consistent with existing Windows behavior. Both these changes are necessary for clients to be able to link against a libc++ DSO built with hidden visibility without encountering missing symbols. An unfortunate side effect, however, is that method templates of classes either marked `_LIBCPP_TYPE_VIS` or with extern template instantiation declarations marked with `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` also get default visibility when instantiated. These methods are often implicitly instantiated inside other libraries which use the libc++ headers, and will therefore end up being exported from those libraries, since those implicit instantiations will receive default visibility. This is not acceptable for libraries that wish to control their visibility, and led to PR30642. Consequently, all such problematic method templates are explicitly marked either hidden (via this macro) or inline, so that they don't leak into client libraries. The problematic methods were found by running `bad-visibility-finder `_ against the libc++ headers after making `_LIBCPP_TYPE_VIS` and `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` expand to default visibility. **_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY** Mark a member function of a class template as visible and always inline. This macro should only be applied to member functions of class templates that are externally instantiated. It is important that these symbols are not marked as hidden as that will prevent the dylib definition from being found. This macro is used to maintain ABI compatibility for symbols that have been historically exported by the libc++ library but are now marked inline. **_LIBCPP_EXCEPTION_ABI** Mark the member functions, typeinfo, and vtable of the type as being exported by the libc++ library. This macro must be applied to all *exception types*. Exception types should be defined directly in namespace `std` and not the versioning namespace. This allows throwing and catching some exception types between libc++ and libstdc++. **_LIBCPP_INTERNAL_LINKAGE** Mark the affected entity as having internal linkage (i.e. the `static` keyword in C). This is only a best effort: when the `internal_linkage` attribute is not available, we fall back to forcing the function to be inlined, which approximates internal linkage since an externally visible symbol is never generated for that function. This is an internal macro used as an implementation detail by other visibility macros. Never mark a function or a class with this macro directly. **_LIBCPP_ALWAYS_INLINE** Forces inlining of the function it is applied to. For visibility purposes, this macro is used to make sure that an externally visible symbol is never generated in an object file when the `internal_linkage` attribute is not available. This is an internal macro used by other visibility macros, and it should not be used directly. Links ===== * `[cfe-dev] Visibility in libc++ - 1 `_ * `[cfe-dev] Visibility in libc++ - 2 `_ * `[libcxx] Visibility fixes for Windows `_ Index: vendor/libc++/dist-release_70/include/__config =================================================================== --- vendor/libc++/dist-release_70/include/__config (revision 338004) +++ vendor/libc++/dist-release_70/include/__config (revision 338005) @@ -1,1356 +1,1376 @@ // -*- C++ -*- //===--------------------------- __config ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG #if defined(_MSC_VER) && !defined(__clang__) # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # endif #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #pragma GCC system_header #endif #ifdef __cplusplus #ifdef __GNUC__ # define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme // introduced in GCC 5.0. # define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else # define _GNUC_VER 0 # define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 7000 #ifndef _LIBCPP_ABI_VERSION # ifdef __Fuchsia__ # define _LIBCPP_ABI_VERSION 2 # else # define _LIBCPP_ABI_VERSION 1 # endif #endif #ifndef _LIBCPP_STD_VER # if __cplusplus <= 201103L # define _LIBCPP_STD_VER 11 # elif __cplusplus <= 201402L # define _LIBCPP_STD_VER 14 # elif __cplusplus <= 201703L # define _LIBCPP_STD_VER 17 # else # define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification # endif #endif // _LIBCPP_STD_VER #if defined(__ELF__) # define _LIBCPP_OBJECT_FORMAT_ELF 1 #elif defined(__MACH__) # define _LIBCPP_OBJECT_FORMAT_MACHO 1 #elif defined(_WIN32) # define _LIBCPP_OBJECT_FORMAT_COFF 1 #elif defined(__wasm__) # define _LIBCPP_OBJECT_FORMAT_WASM 1 #else # error Unknown object file format #endif #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. # define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. # define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. # define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. # define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB # define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB # define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. # define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR // Define the `pointer_safety` enum as a C++11 strongly typed enumeration // instead of as a class simulating an enum. If this option is enabled // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. # define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION // Enable optimized version of __do_get_(un)signed which avoids redundant copies. # define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusivly. # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION #elif _LIBCPP_ABI_VERSION == 1 # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would // conflict with the dllexport-emitted copy, so we disable it. # define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS # endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. # if defined(__FreeBSD__) # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR # endif #endif #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \ use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead #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) #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) #if __cplusplus < 201103L #define _LIBCPP_CXX03_LANG #endif #ifndef __has_attribute #define __has_attribute(__x) 0 #endif #ifndef __has_builtin #define __has_builtin(__x) 0 #endif #ifndef __has_extension #define __has_extension(__x) 0 #endif #ifndef __has_feature #define __has_feature(__x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(__x) 0 #endif // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. #ifndef __is_identifier #define __is_identifier(__x) 1 #endif #ifndef __has_declspec_attribute #define __has_declspec_attribute(__x) 0 #endif #define __has_keyword(__x) !(__is_identifier(__x)) #ifndef __has_include #define __has_include(...) 0 #endif #if defined(__clang__) # define _LIBCPP_COMPILER_CLANG # ifndef __apple_build_version__ # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) # endif #elif defined(__GNUC__) # define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) # define _LIBCPP_COMPILER_MSVC #elif defined(__IBMCPP__) # define _LIBCPP_COMPILER_IBM #endif #ifndef _LIBCPP_CLANG_VER #define _LIBCPP_CLANG_VER 0 #endif // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. #if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) # error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" #elif defined(_LIBCPP_ABI_FORCE_ITANIUM) # define _LIBCPP_ABI_ITANIUM #elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) # define _LIBCPP_ABI_MICROSOFT #else # if defined(_WIN32) && defined(_MSC_VER) # define _LIBCPP_ABI_MICROSOFT # else # define _LIBCPP_ABI_ITANIUM # endif #endif // Need to detect which libc we're using if we're on Linux. #if defined(__linux__) # include # if defined(__GLIBC_PREREQ) # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) # else # define _LIBCPP_GLIBC_PREREQ(a, b) 0 # endif // defined(__GLIBC_PREREQ) #endif // defined(__linux__) #ifdef __LITTLE_ENDIAN__ # if __LITTLE_ENDIAN__ # define _LIBCPP_LITTLE_ENDIAN # endif // __LITTLE_ENDIAN__ #endif // __LITTLE_ENDIAN__ #ifdef __BIG_ENDIAN__ # if __BIG_ENDIAN__ # define _LIBCPP_BIG_ENDIAN # endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ #ifdef __BYTE_ORDER__ # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define _LIBCPP_LITTLE_ENDIAN # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # define _LIBCPP_BIG_ENDIAN # endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #endif // __BYTE_ORDER__ #ifdef __FreeBSD__ # include # if _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_BIG_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN # ifndef __LONG_LONG_SUPPORTED # define _LIBCPP_HAS_NO_LONG_LONG # endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef __NetBSD__ # include # if _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_BIG_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_HAS_QUICK_EXIT #endif // __NetBSD__ #if defined(_WIN32) # define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN # define _LIBCPP_SHORT_WCHAR 1 // Both MinGW and native MSVC provide a "MSVC"-like enviroment # define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only if // a MS compatibility version is specified. # if defined(_MSC_VER) && !defined(__MINGW32__) # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library # endif # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) # define _LIBCPP_HAS_BITSCAN64 # endif # define _LIBCPP_HAS_OPEN_WITH_WCHAR # if defined(_LIBCPP_MSVCRT) # define _LIBCPP_HAS_QUICK_EXIT # endif // Some CRT APIs are unavailable to store apps # if defined(WINAPI_FAMILY) # include # if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ (!defined(WINAPI_PARTITION_SYSTEM) || \ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) # define _LIBCPP_WINDOWS_STORE_APP # endif # endif #endif // defined(_WIN32) #ifdef __sun__ # include # ifdef _LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # else # define _LIBCPP_BIG_ENDIAN # endif #endif // __sun__ #if defined(__CloudABI__) // Certain architectures provide arc4random(). Prefer using // arc4random() over /dev/{u,}random to make it possible to obtain // random data even when using sandboxing mechanisms such as chroots, // Capsicum, etc. # define _LIBCPP_USING_ARC4_RANDOM #elif defined(__Fuchsia__) # define _LIBCPP_USING_GETENTROPY #elif defined(__native_client__) // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, // including accesses to the special files under /dev. C++11's // std::random_device is instead exposed through a NaCl syscall. # define _LIBCPP_USING_NACL_RANDOM #elif defined(_LIBCPP_WIN32API) # define _LIBCPP_USING_WIN32_RANDOM #else # define _LIBCPP_USING_DEV_RANDOM #endif #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) # include # if __BYTE_ORDER == __LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # elif __BYTE_ORDER == __BIG_ENDIAN # define _LIBCPP_BIG_ENDIAN # else // __BYTE_ORDER == __BIG_ENDIAN # error unable to determine endian # endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) # define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) #else # define _LIBCPP_NO_CFI #endif +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L +# if defined(__FreeBSD__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__Fuchsia__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_TIMESPEC_GET +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__linux__) +# if !defined(_LIBCPP_HAS_MUSL_LIBC) +# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) +# define _LIBCPP_HAS_QUICK_EXIT +# endif +# if _LIBCPP_GLIBC_PREREQ(2, 17) +# define _LIBCPP_HAS_C11_FEATURES +# define _LIBCPP_HAS_TIMESPEC_GET +# endif +# else // defined(_LIBCPP_HAS_MUSL_LIBC) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_TIMESPEC_GET +# define _LIBCPP_HAS_C11_FEATURES +# endif +# endif // __linux__ +#endif + #if defined(_LIBCPP_COMPILER_CLANG) // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \ defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif #if __has_feature(cxx_alignas) # define _ALIGNAS_TYPE(x) alignas(x) # define _ALIGNAS(x) alignas(x) #else # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) # define _ALIGNAS(x) __attribute__((__aligned__(x))) #endif #if __cplusplus < 201103L typedef __char16_t char16_t; typedef __char32_t char32_t; #endif #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS) #define _LIBCPP_NO_EXCEPTIONS #endif #if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI) #define _LIBCPP_NO_RTTI #endif #if !(__has_feature(cxx_strong_enums)) #define _LIBCPP_HAS_NO_STRONG_ENUMS #endif #if !(__has_feature(cxx_decltype)) #define _LIBCPP_HAS_NO_DECLTYPE #endif #if __has_feature(cxx_attributes) # define _LIBCPP_NORETURN [[noreturn]] #else # define _LIBCPP_NORETURN __attribute__ ((noreturn)) #endif #if !(__has_feature(cxx_lambdas)) #define _LIBCPP_HAS_NO_LAMBDAS #endif #if !(__has_feature(cxx_nullptr)) # if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) # define nullptr __nullptr # else # define _LIBCPP_HAS_NO_NULLPTR # endif #endif #if !(__has_feature(cxx_rvalue_references)) #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif #if !(__has_feature(cxx_auto_type)) #define _LIBCPP_HAS_NO_AUTO_TYPE #endif #if !(__has_feature(cxx_variadic_templates)) #define _LIBCPP_HAS_NO_VARIADICS #endif #if !(__has_feature(cxx_generalized_initializers)) #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif #if __has_feature(is_base_of) #define _LIBCPP_HAS_IS_BASE_OF #endif #if __has_feature(is_final) #define _LIBCPP_HAS_IS_FINAL #endif // Objective-C++ features (opt-in) #if __has_feature(objc_arc) #define _LIBCPP_HAS_OBJC_ARC #endif #if __has_feature(objc_arc_weak) #define _LIBCPP_HAS_OBJC_ARC_WEAK #endif #if !(__has_feature(cxx_constexpr)) #define _LIBCPP_HAS_NO_CONSTEXPR #endif #if !(__has_feature(cxx_relaxed_constexpr)) #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #endif #if !(__has_feature(cxx_variable_templates)) #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #endif -#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L -# if defined(__FreeBSD__) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# elif defined(__Fuchsia__) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# elif defined(__linux__) -# if !defined(_LIBCPP_HAS_MUSL_LIBC) -# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if _LIBCPP_GLIBC_PREREQ(2, 17) -# define _LIBCPP_HAS_C11_FEATURES -# endif -# else // defined(_LIBCPP_HAS_MUSL_LIBC) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# endif -# endif // __linux__ -#endif - #if !(__has_feature(cxx_noexcept)) #define _LIBCPP_HAS_NO_NOEXCEPT #endif #if __has_feature(underlying_type) #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #endif #if __has_feature(is_literal) #define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_END_NAMESPACE_STD } } #define _VSTD std::_LIBCPP_NAMESPACE namespace std { inline namespace _LIBCPP_NAMESPACE { } } #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) #define _LIBCPP_HAS_NO_ASAN #endif // Allow for build-time disabling of unsigned integer sanitization #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize) #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) #endif #if __has_builtin(__builtin_launder) #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER #endif #if !__is_identifier(__has_unique_object_representations) #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS #endif #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) #define _LIBCPP_NORETURN __attribute__((noreturn)) #if _GNUC_VER >= 407 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) #define _LIBCPP_HAS_IS_FINAL #endif #if defined(__GNUC__) && _GNUC_VER >= 403 #define _LIBCPP_HAS_IS_BASE_OF #endif #if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS) #define _LIBCPP_NO_EXCEPTIONS #endif // constexpr was added to GCC in 4.6. #if _GNUC_VER < 406 # define _LIBCPP_HAS_NO_CONSTEXPR // Can only use constexpr in c++11 mode. #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L # define _LIBCPP_HAS_NO_CONSTEXPR #endif // Determine if GCC supports relaxed constexpr #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #endif // GCC 5 will support variable templates #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_HAS_NO_NOEXCEPT #else // __GXX_EXPERIMENTAL_CXX0X__ #if _GNUC_VER < 403 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif #if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // _GNUC_VER < 404 #if _GNUC_VER < 406 #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR #endif #endif // __GXX_EXPERIMENTAL_CXX0X__ #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_END_NAMESPACE_STD } } #define _VSTD std::_LIBCPP_NAMESPACE namespace std { inline namespace _LIBCPP_NAMESPACE { } } #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) #define _LIBCPP_HAS_NO_ASAN #endif #if _GNUC_VER >= 700 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER #endif #if _GNUC_VER >= 700 #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS #endif #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) #elif defined(_LIBCPP_COMPILER_MSVC) #define _LIBCPP_TOSTRING2(x) #x #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) #if _MSC_VER < 1900 #error "MSVC versions prior to Visual Studio 2015 are not supported" #endif #define _LIBCPP_HAS_IS_BASE_OF #define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #define _LIBCPP_HAS_NO_NOEXCEPT #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) #define _ALIGNAS_TYPE(x) alignas(x) #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { #define _LIBCPP_END_NAMESPACE_STD } #define _VSTD std namespace std { } #define _LIBCPP_WEAK #define _LIBCPP_HAS_NO_ASAN #define _LIBCPP_ALWAYS_INLINE __forceinline #define _LIBCPP_HAS_NO_VECTOR_EXTENSION #elif defined(_LIBCPP_COMPILER_IBM) #define _ALIGNAS(x) __attribute__((__aligned__(x))) #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) #define _ATTRIBUTE(x) __attribute__((x)) #define _LIBCPP_NORETURN __attribute__((noreturn)) #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_IS_BASE_OF #define _LIBCPP_HAS_IS_FINAL #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #if defined(_AIX) #define __MULTILOCALE_API #endif #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_END_NAMESPACE_STD } } #define _VSTD std::_LIBCPP_NAMESPACE namespace std { inline namespace _LIBCPP_NAMESPACE { } } #define _LIBCPP_HAS_NO_ASAN #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) #define _LIBCPP_HAS_NO_VECTOR_EXTENSION #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] #if _LIBCPP_STD_VER >= 17 #define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { #else #define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { #endif #define _LIBCPP_END_NAMESPACE_FILESYSTEM \ _LIBCPP_END_NAMESPACE_STD } } #define _VSTD_FS _VSTD::__fs::filesystem #if defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifdef _DLL # define _LIBCPP_CRT_FUNC __declspec(dllimport) #else # define _LIBCPP_CRT_FUNC #endif #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_DLL_VIS # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS #elif defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_DLL_VIS __declspec(dllexport) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS #else # define _LIBCPP_DLL_VIS __declspec(dllimport) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS #endif #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS #define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS #define _LIBCPP_HIDDEN #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS #define _LIBCPP_TEMPLATE_VIS #define _LIBCPP_ENUM_VIS #if defined(_LIBCPP_COMPILER_MSVC) # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline #else # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) #endif #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifndef _LIBCPP_HIDDEN # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) # else # define _LIBCPP_HIDDEN # endif #endif #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) // The inline should be removed once PR32114 is resolved # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN # else # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS # endif #endif #ifndef _LIBCPP_FUNC_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) # else # define _LIBCPP_FUNC_VIS # endif #endif #ifndef _LIBCPP_TYPE_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) # else # define _LIBCPP_TYPE_VIS # endif #endif #ifndef _LIBCPP_TEMPLATE_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # if __has_attribute(__type_visibility__) # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) # else # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) # endif # else # define _LIBCPP_TEMPLATE_VIS # endif #endif #ifndef _LIBCPP_EXTERN_VIS #define _LIBCPP_EXTERN_VIS #endif #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS #define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS #endif #ifndef _LIBCPP_EXCEPTION_ABI # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) # else # define _LIBCPP_EXCEPTION_ABI # endif #endif #ifndef _LIBCPP_ENUM_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) # define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) # else # define _LIBCPP_ENUM_VIS # endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) # else # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # endif #endif #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS #define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS #endif #if __has_attribute(internal_linkage) # define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage)) #else # define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE #endif +#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU +# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 +# else +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# endif +#endif + #ifndef _LIBCPP_HIDE_FROM_ABI -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# if _LIBCPP_HIDE_FROM_ABI_PER_TU +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE +# endif #endif // Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually. #define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) # else # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) # endif #endif #ifndef _LIBCPP_PREFERRED_OVERLOAD # if __has_attribute(__enable_if__) # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) # endif #endif #ifndef _LIBCPP_HAS_NO_NOEXCEPT # define _NOEXCEPT noexcept # define _NOEXCEPT_(x) noexcept(x) #else # define _NOEXCEPT throw() # define _NOEXCEPT_(x) #endif #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS) # if !defined(_LIBCPP_DEBUG) # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined # endif # ifdef _LIBCPP_HAS_NO_NOEXCEPT # define _NOEXCEPT_DEBUG # define _NOEXCEPT_DEBUG_(x) # else # define _NOEXCEPT_DEBUG noexcept(false) # define _NOEXCEPT_DEBUG_(x) noexcept(false) # endif #else # define _NOEXCEPT_DEBUG _NOEXCEPT # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) #endif #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS typedef unsigned short char16_t; typedef unsigned int char32_t; #endif // _LIBCPP_HAS_NO_UNICODE_CHARS #ifndef __SIZEOF_INT128__ #define _LIBCPP_HAS_NO_INT128 #endif #ifdef _LIBCPP_CXX03_LANG # if __has_extension(c_static_assert) # define static_assert(__b, __m) _Static_assert(__b, __m) # else extern "C++" { template struct __static_assert_test; template <> struct __static_assert_test {}; template struct __static_assert_check {}; } # define static_assert(__b, __m) \ typedef __static_assert_check)> \ _LIBCPP_CONCAT(__t, __LINE__) # endif // __has_extension(c_static_assert) #endif // _LIBCPP_CXX03_LANG #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. # if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 # define decltype(__x) __decltype(__x) # else # define decltype(__x) __typeof__(__x) # endif #endif #ifdef _LIBCPP_HAS_NO_CONSTEXPR # define _LIBCPP_CONSTEXPR #else # define _LIBCPP_CONSTEXPR constexpr #endif #ifdef _LIBCPP_CXX03_LANG # define _LIBCPP_DEFAULT {} #else # define _LIBCPP_DEFAULT = default; #endif #ifdef _LIBCPP_CXX03_LANG # define _LIBCPP_EQUAL_DELETE #else # define _LIBCPP_EQUAL_DELETE = delete #endif #ifdef __GNUC__ # define _NOALIAS __attribute__((__malloc__)) #else # define _NOALIAS #endif #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \ (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions # define _LIBCPP_EXPLICIT explicit #else # define _LIBCPP_EXPLICIT #endif #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) #define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE #endif #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS # define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ __lx __v_; \ _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \ }; #else // _LIBCPP_HAS_NO_STRONG_ENUMS # define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) #endif // _LIBCPP_HAS_NO_STRONG_ENUMS #ifdef _LIBCPP_DEBUG # if _LIBCPP_DEBUG == 0 # define _LIBCPP_DEBUG_LEVEL 1 # elif _LIBCPP_DEBUG == 1 # define _LIBCPP_DEBUG_LEVEL 2 # else # error Supported values for _LIBCPP_DEBUG are 0 and 1 # endif # if !defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_EXTERN_TEMPLATE(...) # endif #endif #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE #define _LIBCPP_EXTERN_TEMPLATE(...) #define _LIBCPP_EXTERN_TEMPLATE2(...) #endif #ifndef _LIBCPP_EXTERN_TEMPLATE #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; #endif #ifndef _LIBCPP_EXTERN_TEMPLATE2 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; #endif #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63) #endif #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) #define _LIBCPP_LOCALE__L_EXTENSIONS 1 #endif #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. # if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) # define _LIBCPP_HAS_CATOPEN 1 # endif #endif #ifdef __FreeBSD__ #define _DECLARE_C99_LDBL_MATH 1 #endif // If we are getting operator new from the MSVC CRT, then allocation overloads // for align_val_t were added in 19.12, aka VS 2017 version 15.3. #if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 #define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif #if defined(__APPLE__) # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ # endif # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION # endif # endif #endif // defined(__APPLE__) +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ + !defined(_LIBCPP_BUILDING_LIBRARY) && \ + (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +#endif #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE #endif #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) #define _LIBCPP_WCTYPE_IS_MASK #endif #if _LIBCPP_STD_VER > 11 # define _LIBCPP_DEPRECATED [[deprecated]] #else # define _LIBCPP_DEPRECATED #endif #if _LIBCPP_STD_VER <= 11 # define _LIBCPP_EXPLICIT_AFTER_CXX11 # define _LIBCPP_DEPRECATED_AFTER_CXX11 #else # define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit # define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) # define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #else # define _LIBCPP_CONSTEXPR_AFTER_CXX11 #endif #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) # define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr #else # define _LIBCPP_CONSTEXPR_AFTER_CXX14 #endif #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) # define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr #else # define _LIBCPP_CONSTEXPR_AFTER_CXX17 #endif #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) # define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] #else # define _LIBCPP_NODISCARD_AFTER_CXX17 #endif #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) # define _LIBCPP_INLINE_VAR inline #else # define _LIBCPP_INLINE_VAR #endif #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) #else # define _LIBCPP_EXPLICIT_MOVE(x) (x) #endif #ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG #if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) #define _LIBCPP_CONSTEXPR_IF_NODEBUG #else #define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr #endif #endif #ifndef _LIBCPP_HAS_NO_ASAN _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( const void *, const void *, const void *, const void *); #endif // Try to find out if RTTI is disabled. // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. #if !defined(_LIBCPP_NO_RTTI) # if defined(__GNUC__) && \ ((__GNUC__ >= 5) || \ (__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \ !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI # elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) # define _LIBCPP_NO_RTTI # endif #endif #ifndef _LIBCPP_WEAK #define _LIBCPP_WEAK __attribute__((__weak__)) #endif // Thread API #if !defined(_LIBCPP_HAS_NO_THREADS) && \ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) # if defined(__FreeBSD__) || \ defined(__Fuchsia__) || \ defined(__NetBSD__) || \ defined(__linux__) || \ defined(__APPLE__) || \ defined(__CloudABI__) || \ defined(__sun__) || \ (defined(__MINGW32__) && __has_include()) # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(_LIBCPP_WIN32API) # define _LIBCPP_HAS_THREAD_API_WIN32 # else # error "No thread API" # endif // _LIBCPP_HAS_THREAD_API #endif // _LIBCPP_HAS_NO_THREADS #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) #error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ _LIBCPP_HAS_NO_THREADS is not defined. #endif #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) #error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ _LIBCPP_HAS_NO_THREADS is defined. #endif #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) #error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ _LIBCPP_HAS_NO_THREADS is defined. #endif // Systems that use capability-based security (FreeBSD with Capsicum, // Nuxi CloudABI) may only provide local filesystem access (using *at()). // Functions like open(), rename(), unlink() and stat() should not be // used, as they attempt to access the global filesystem namespace. #ifdef __CloudABI__ #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE #endif // CloudABI is intended for running networked services. Processes do not // have standard input and output channels. #ifdef __CloudABI__ #define _LIBCPP_HAS_NO_STDIN #define _LIBCPP_HAS_NO_STDOUT #endif #if defined(__BIONIC__) || defined(__CloudABI__) || \ defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif // Thread-unsafe functions such as strtok() and localtime() // are not available. #ifdef __CloudABI__ #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS #endif #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) # define _LIBCPP_HAS_C_ATOMIC_IMP #elif _GNUC_VER > 407 # define _LIBCPP_HAS_GCC_ATOMIC_IMP #endif #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ || defined(_LIBCPP_HAS_NO_THREADS) #define _LIBCPP_HAS_NO_ATOMIC_HEADER #endif #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK #endif #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) # if defined(__clang__) && __has_attribute(acquire_capability) // Work around the attribute handling in clang. When both __declspec and // __attribute__ are present, the processing goes awry preventing the definition // of the types. # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) # define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS # endif # endif #endif #if __has_attribute(require_constant_initialization) # define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) #else # define _LIBCPP_SAFE_STATIC #endif #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) # if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) # define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS # endif #endif #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) # define _LIBCPP_DIAGNOSE_WARNING(...) \ __attribute__((diagnose_if(__VA_ARGS__, "warning"))) # define _LIBCPP_DIAGNOSE_ERROR(...) \ __attribute__((diagnose_if(__VA_ARGS__, "error"))) #else # define _LIBCPP_DIAGNOSE_WARNING(...) # define _LIBCPP_DIAGNOSE_ERROR(...) #endif #if __has_attribute(fallthough) || _GNUC_VER >= 700 // Use a function like macro to imply that it must be followed by a semicolon # define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) #else # define _LIBCPP_FALLTHROUGH() ((void)0) #endif #if defined(_LIBCPP_ABI_MICROSOFT) && \ (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) #else # define _LIBCPP_DECLSPEC_EMPTY_BASES #endif #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR #define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS #define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 #define _LIBCPP_HAS_NO_DEDUCTION_GUIDES #endif #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) #define _LIBCPP_HAS_NO_IS_AGGREGATE #endif #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L #define _LIBCPP_HAS_NO_COROUTINES #endif // FIXME: Correct this macro when either (A) a feature test macro for the // spaceship operator is provided, or (B) a compiler provides a complete // implementation. #define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR // Decide whether to use availability macros. #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ __has_feature(attribute_availability_with_strict) && \ __has_feature(attribute_availability_in_templates) # ifdef __APPLE__ # define _LIBCPP_USE_AVAILABILITY_APPLE # endif #endif // Define availability macros. #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ __attribute__((availability(ios,strict,introduced=6.0))) # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) #else # define _LIBCPP_AVAILABILITY_SHARED_MUTEX # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE # define _LIBCPP_AVAILABILITY_FUTURE_ERROR # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR #endif // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. #ifdef _LIBCPP_NO_EXCEPTIONS # define _LIBCPP_AVAILABILITY_DYNARRAY # define _LIBCPP_AVAILABILITY_FUTURE # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST #else # define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH # define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \ _LIBCPP_AVAILABILITY_BAD_ANY_CAST #endif // Availability of stream API in the dylib got dropped and re-added. The // extern template should effectively be available at: // availability(macosx,introduced=10.9) // availability(ios,introduced=7.0) #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \ ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)) #define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE #endif #if defined(_LIBCPP_COMPILER_IBM) #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO #endif #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) # define _LIBCPP_PUSH_MACROS # define _LIBCPP_POP_MACROS #else // Don't warn about macro conflicts when we can restore them at the // end of the header. # ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS # define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS # endif # if defined(_LIBCPP_COMPILER_MSVC) # define _LIBCPP_PUSH_MACROS \ __pragma(push_macro("min")) \ __pragma(push_macro("max")) # define _LIBCPP_POP_MACROS \ __pragma(pop_macro("min")) \ __pragma(pop_macro("max")) # else # define _LIBCPP_PUSH_MACROS \ _Pragma("push_macro(\"min\")") \ _Pragma("push_macro(\"max\")") # define _LIBCPP_POP_MACROS \ _Pragma("pop_macro(\"min\")") \ _Pragma("pop_macro(\"max\")") # endif #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) #ifndef _LIBCPP_NO_AUTO_LINK # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) # if defined(_DLL) # pragma comment(lib, "c++.lib") # else # pragma comment(lib, "libc++.lib") # endif # endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) #endif // _LIBCPP_NO_AUTO_LINK #endif // __cplusplus #endif // _LIBCPP_CONFIG Index: vendor/libc++/dist-release_70/include/__config_site.in =================================================================== --- vendor/libc++/dist-release_70/include/__config_site.in (revision 338004) +++ vendor/libc++/dist-release_70/include/__config_site.in (revision 338005) @@ -1,33 +1,34 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_CONFIG_SITE #define _LIBCPP_CONFIG_SITE #cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@ #cmakedefine _LIBCPP_ABI_UNSTABLE #cmakedefine _LIBCPP_ABI_FORCE_ITANIUM #cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT +#cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT #cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE #cmakedefine _LIBCPP_HAS_NO_STDIN #cmakedefine _LIBCPP_HAS_NO_STDOUT #cmakedefine _LIBCPP_HAS_NO_THREADS #cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK #cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL #cmakedefine _LIBCPP_HAS_THREAD_API_WIN32 #cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #cmakedefine _LIBCPP_NO_VCRUNTIME @_LIBCPP_ABI_DEFINES@ #endif // _LIBCPP_CONFIG_SITE Index: vendor/libc++/dist-release_70/include/cstdlib =================================================================== --- vendor/libc++/dist-release_70/include/cstdlib (revision 338004) +++ vendor/libc++/dist-release_70/include/cstdlib (revision 338005) @@ -1,164 +1,164 @@ // -*- C++ -*- //===--------------------------- cstdlib ----------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_CSTDLIB #define _LIBCPP_CSTDLIB /* cstdlib synopsis Macros: EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX NULL RAND_MAX namespace std { Types: size_t div_t ldiv_t lldiv_t // C99 double atof (const char* nptr); int atoi (const char* nptr); long atol (const char* nptr); long long atoll(const char* nptr); // C99 double strtod (const char* restrict nptr, char** restrict endptr); float strtof (const char* restrict nptr, char** restrict endptr); // C99 long double strtold (const char* restrict nptr, char** restrict endptr); // C99 long strtol (const char* restrict nptr, char** restrict endptr, int base); long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 int rand(void); void srand(unsigned int seed); void* calloc(size_t nmemb, size_t size); void free(void* ptr); void* malloc(size_t size); void* realloc(void* ptr, size_t size); void abort(void); int atexit(void (*func)(void)); void exit(int status); void _Exit(int status); char* getenv(const char* name); int system(const char* string); void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); int abs( int j); long abs( long j); long long abs(long long j); // C++0X long labs( long j); long long llabs(long long j); // C99 div_t div( int numer, int denom); ldiv_t div( long numer, long denom); lldiv_t div(long long numer, long long denom); // C++0X ldiv_t ldiv( long numer, long denom); lldiv_t lldiv(long long numer, long long denom); // C99 int mblen(const char* s, size_t n); int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); int wctomb(char* s, wchar_t wchar); size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); int at_quick_exit(void (*func)(void)) // C++11 void quick_exit(int status); // C++11 void *aligned_alloc(size_t alignment, size_t size); // C11 } // std */ #include <__config> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #ifdef __GNUC__ #define _LIBCPP_UNREACHABLE() __builtin_unreachable() #else #define _LIBCPP_UNREACHABLE() _VSTD::abort() #endif _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t; using ::div_t; using ::ldiv_t; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv_t; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::atof; using ::atoi; using ::atol; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::atoll; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtod; using ::strtof; using ::strtold; using ::strtol; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoll; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtoul; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoull; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::rand; using ::srand; using ::calloc; using ::free; using ::malloc; using ::realloc; using ::abort; using ::atexit; using ::exit; using ::_Exit; #ifndef _LIBCPP_WINDOWS_STORE_APP using ::getenv; using ::system; #endif using ::bsearch; using ::qsort; using ::abs; using ::labs; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::llabs; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::div; using ::ldiv; #ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv; #endif // _LIBCPP_HAS_NO_LONG_LONG using ::mblen; using ::mbtowc; using ::wctomb; using ::mbstowcs; using ::wcstombs; -#ifdef _LIBCPP_HAS_QUICK_EXIT +#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT) using ::at_quick_exit; using ::quick_exit; #endif -#ifdef _LIBCPP_HAS_C11_FEATURES +#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) using ::aligned_alloc; #endif _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CSTDLIB Index: vendor/libc++/dist-release_70/include/ctime =================================================================== --- vendor/libc++/dist-release_70/include/ctime (revision 338004) +++ vendor/libc++/dist-release_70/include/ctime (revision 338005) @@ -1,82 +1,82 @@ // -*- C++ -*- //===---------------------------- ctime -----------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_CTIME #define _LIBCPP_CTIME /* ctime synopsis Macros: NULL CLOCKS_PER_SEC TIME_UTC // C++17 namespace std { Types: clock_t size_t time_t tm timespec // C++17 clock_t clock(); double difftime(time_t time1, time_t time0); time_t mktime(tm* timeptr); time_t time(time_t* timer); char* asctime(const tm* timeptr); char* ctime(const time_t* timer); tm* gmtime(const time_t* timer); tm* localtime(const time_t* timer); size_t strftime(char* restrict s, size_t maxsize, const char* restrict format, const tm* restrict timeptr); int timespec_get( struct timespec *ts, int base); // C++17 } // std */ #include <__config> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD using ::clock_t; using ::size_t; using ::time_t; using ::tm; #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) using ::timespec; #endif using ::clock; using ::difftime; using ::mktime; using ::time; #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS using ::asctime; using ::ctime; using ::gmtime; using ::localtime; #endif using ::strftime; -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) +#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) using ::timespec_get; #endif _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CTIME Index: vendor/libc++/dist-release_70/include/new =================================================================== --- vendor/libc++/dist-release_70/include/new (revision 338004) +++ vendor/libc++/dist-release_70/include/new (revision 338005) @@ -1,323 +1,316 @@ // -*- C++ -*- //===----------------------------- new ------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_NEW #define _LIBCPP_NEW /* new synopsis namespace std { class bad_alloc : public exception { public: bad_alloc() noexcept; bad_alloc(const bad_alloc&) noexcept; bad_alloc& operator=(const bad_alloc&) noexcept; virtual const char* what() const noexcept; }; class bad_array_length : public bad_alloc // FIXME: Not part of C++ { public: bad_array_length() noexcept; }; class bad_array_new_length : public bad_alloc // C++14 { public: bad_array_new_length() noexcept; }; enum class align_val_t : size_t {}; // C++17 struct nothrow_t {}; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler new_p) noexcept; new_handler get_new_handler() noexcept; // 21.6.4, pointer optimization barrier template constexpr T* launder(T* p) noexcept; // C++17 } // std void* operator new(std::size_t size); // replaceable, nodiscard in C++2a void* operator new(std::size_t size, std::align_val_t alignment); // replaceable, C++17, nodiscard in C++2a void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++2a void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17, nodiscard in C++2a void operator delete(void* ptr) noexcept; // replaceable void operator delete(void* ptr, std::size_t size) noexcept; // replaceable, C++14 void operator delete(void* ptr, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete(void* ptr, std:align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17 void* operator new[](std::size_t size); // replaceable, nodiscard in C++2a void* operator new[](std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17, nodiscard in C++2a void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++2a void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17, nodiscard in C++2a void operator delete[](void* ptr) noexcept; // replaceable void operator delete[](void* ptr, std::size_t size) noexcept; // replaceable, C++14 void operator delete[](void* ptr, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17 void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++2a void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++2a void operator delete (void* ptr, void*) noexcept; void operator delete[](void* ptr, void*) noexcept; */ #include <__config> #include #include #include #ifdef _LIBCPP_NO_EXCEPTIONS #include #endif #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) #include #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if !(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER >= 14 || \ (defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309)) # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION #endif -#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ - (!(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER > 14 || \ - (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))) -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -#endif - - #if !__has_builtin(__builtin_operator_new) || \ __has_builtin(__builtin_operator_new) < 201802L || \ defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606 #define _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE #endif namespace std // purposefully not using versioning namespace { #if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) struct _LIBCPP_TYPE_VIS nothrow_t {}; extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; class _LIBCPP_EXCEPTION_ABI bad_alloc : public exception { public: bad_alloc() _NOEXCEPT; virtual ~bad_alloc() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_array_new_length : public bad_alloc { public: bad_array_new_length() _NOEXCEPT; virtual ~bad_array_new_length() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; typedef void (*new_handler)(); _LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; #endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec #if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11) class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH bad_array_length : public bad_alloc { public: bad_array_length() _NOEXCEPT; virtual ~bad_array_length() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; #define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED #endif // defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11) #if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; #else enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif #endif } // std #if defined(_LIBCPP_CXX03_LANG) #define _THROW_BAD_ALLOC throw(std::bad_alloc) #else #define _THROW_BAD_ALLOC #endif #if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; #endif _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; #endif #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif #endif _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} #endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT { #ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__; #else return __align > alignment_of::value; #endif } inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) { #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast(__align); # ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE return ::operator new(__size, __align_val); # else return __builtin_operator_new(__size, __align_val); # endif } #else ((void)__align); #endif #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator new(__size); #else return __builtin_operator_new(__size); #endif } inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __align) { #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast(__align); # ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE return ::operator delete(__ptr, __align_val); # else return __builtin_operator_delete(__ptr, __align_val); # endif } #else ((void)__align); #endif #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator delete(__ptr); #else return __builtin_operator_delete(__ptr); #endif } #ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_NO_EXCEPTIONS _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH #endif void __throw_bad_array_length() { #ifndef _LIBCPP_NO_EXCEPTIONS throw bad_array_length(); #else _VSTD::abort(); #endif } #endif template _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { static_assert (!(is_function<_Tp>::value), "can't launder functions" ); static_assert (!(is_same::type>::value), "can't launder cv-void" ); #ifdef _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER return __builtin_launder(__p); #else return __p; #endif } #if _LIBCPP_STD_VER > 14 template _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp* launder(_Tp* __p) noexcept { return _VSTD::__launder(__p); } #endif _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_NEW Index: vendor/libc++/dist-release_70/test/libcxx/language.support/has_c11_features.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/libcxx/language.support/has_c11_features.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/libcxx/language.support/has_c11_features.pass.cpp (revision 338005) @@ -1,29 +1,32 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // We have two macros for checking whether or not the underlying C library // has C11 features: // TEST_HAS_C11_FEATURES - which is defined in "test_macros.h" // _LIBCPP_HAS_C11_FEATURES - which is defined in <__config> // They should always be the same +#include <__config> +#include "test_macros.h" + #ifdef TEST_HAS_C11_FEATURES # ifndef _LIBCPP_HAS_C11_FEATURES # error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is not" # endif #endif #ifdef _LIBCPP_HAS_C11_FEATURES # ifndef TEST_HAS_C11_FEATURES # error "_LIBCPP_HAS_C11_FEATURES is defined, but TEST_HAS_C11_FEATURES is not" # endif #endif int main() {} Index: vendor/libc++/dist-release_70/test/libcxx/memory/aligned_allocation_macro.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/libcxx/memory/aligned_allocation_macro.pass.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/libcxx/memory/aligned_allocation_macro.pass.cpp (revision 338005) @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// aligned allocation functions are not provided prior to macosx10.13 +// XFAIL: macosx10.12 +// XFAIL: macosx10.11 +// XFAIL: macosx10.10 +// XFAIL: macosx10.9 +// XFAIL: macosx10.8 +// XFAIL: macosx10.7 + +#include + + +#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it" +#endif + +int main() { } Property changes on: vendor/libc++/dist-release_70/test/libcxx/memory/aligned_allocation_macro.pass.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/depr/depr.c.headers/float_h.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/depr/depr.c.headers/float_h.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/depr/depr.c.headers/float_h.pass.cpp (revision 338005) @@ -1,182 +1,184 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test #include +#include "test_macros.h" + #ifndef FLT_ROUNDS #error FLT_ROUNDS not defined #endif #ifndef FLT_EVAL_METHOD #error FLT_EVAL_METHOD not defined #endif #ifndef FLT_RADIX #error FLT_RADIX not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_HAS_SUBNORM #error FLT_HAS_SUBNORM not defined #endif #ifndef DBL_HAS_SUBNORM #error DBL_HAS_SUBNORM not defined #endif #ifndef LDBL_HAS_SUBNORM #error LDBL_HAS_SUBNORM not defined #endif #endif #ifndef FLT_MANT_DIG #error FLT_MANT_DIG not defined #endif #ifndef DBL_MANT_DIG #error DBL_MANT_DIG not defined #endif #ifndef LDBL_MANT_DIG #error LDBL_MANT_DIG not defined #endif #ifndef DECIMAL_DIG #error DECIMAL_DIG not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_DECIMAL_DIG #error FLT_DECIMAL_DIG not defined #endif #ifndef DBL_DECIMAL_DIG #error DBL_DECIMAL_DIG not defined #endif #ifndef LDBL_DECIMAL_DIG #error LDBL_DECIMAL_DIG not defined #endif #endif #ifndef FLT_DIG #error FLT_DIG not defined #endif #ifndef DBL_DIG #error DBL_DIG not defined #endif #ifndef LDBL_DIG #error LDBL_DIG not defined #endif #ifndef FLT_MIN_EXP #error FLT_MIN_EXP not defined #endif #ifndef DBL_MIN_EXP #error DBL_MIN_EXP not defined #endif #ifndef LDBL_MIN_EXP #error LDBL_MIN_EXP not defined #endif #ifndef FLT_MIN_10_EXP #error FLT_MIN_10_EXP not defined #endif #ifndef DBL_MIN_10_EXP #error DBL_MIN_10_EXP not defined #endif #ifndef LDBL_MIN_10_EXP #error LDBL_MIN_10_EXP not defined #endif #ifndef FLT_MAX_EXP #error FLT_MAX_EXP not defined #endif #ifndef DBL_MAX_EXP #error DBL_MAX_EXP not defined #endif #ifndef LDBL_MAX_EXP #error LDBL_MAX_EXP not defined #endif #ifndef FLT_MAX_10_EXP #error FLT_MAX_10_EXP not defined #endif #ifndef DBL_MAX_10_EXP #error DBL_MAX_10_EXP not defined #endif #ifndef LDBL_MAX_10_EXP #error LDBL_MAX_10_EXP not defined #endif #ifndef FLT_MAX #error FLT_MAX not defined #endif #ifndef DBL_MAX #error DBL_MAX not defined #endif #ifndef LDBL_MAX #error LDBL_MAX not defined #endif #ifndef FLT_EPSILON #error FLT_EPSILON not defined #endif #ifndef DBL_EPSILON #error DBL_EPSILON not defined #endif #ifndef LDBL_EPSILON #error LDBL_EPSILON not defined #endif #ifndef FLT_MIN #error FLT_MIN not defined #endif #ifndef DBL_MIN #error DBL_MIN not defined #endif #ifndef LDBL_MIN #error LDBL_MIN not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_TRUE_MIN #error FLT_TRUE_MIN not defined #endif #ifndef DBL_TRUE_MIN #error DBL_TRUE_MIN not defined #endif #ifndef LDBL_TRUE_MIN #error LDBL_TRUE_MIN not defined #endif #endif int main() { } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::align_val_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::align_val_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp (revision 338005) @@ -1,102 +1,112 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang-7, apple-clang-8 +// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. -// XFAIL: gcc-5, gcc-6 +// UNSUPPORTED: gcc-5, gcc-6 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int unsized_delete_called = 0; int unsized_delete_nothrow_called = 0; int aligned_delete_called = 0; void reset() { unsized_delete_called = 0; unsized_delete_nothrow_called = 0; aligned_delete_called = 0; } void operator delete(void* p) TEST_NOEXCEPT { ++unsized_delete_called; std::free(p); } void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT { ++unsized_delete_nothrow_called; std::free(p); } void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT { ++aligned_delete_called; std::free(p); } struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; int main() { reset(); { B *b = new B[2]; DoNotOptimize(b); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] b; DoNotOptimize(b); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { A *a = new A[2]; DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] a; DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp (revision 338005) @@ -1,93 +1,102 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME change this to XFAIL. // UNSUPPORTED: no-aligned-allocation && !gcc -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } int A_constructed = 0; struct alignas(OverAligned) A { A() { ++A_constructed;} ~A() { --A_constructed;} }; void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(my_new_handler); try { void* vp = operator new[] (std::numeric_limits::max(), static_cast(32)); ((void)vp); assert(false); } catch (std::bad_alloc&) { assert(new_handler_called == 1); } catch (...) { assert(false); } #endif } int main() { { A* ap = new A[2]; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed == 2); delete [] ap; assert(A_constructed == 0); } { test_throw_max_size(); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp (revision 338005) @@ -1,94 +1,104 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } int A_constructed = 0; struct alignas(OverAligned) A { A() { ++A_constructed; } ~A() { --A_constructed; } }; void test_max_alloc() { std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new [](std::numeric_limits::max(), std::align_val_t(OverAligned), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); }; #ifndef TEST_HAS_NO_EXCEPTIONS try { do_test(); } catch (...) { assert(false); } #else do_test(); #endif } int main() { { A* ap = new(std::nothrow) A[3]; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed == 3); delete [] ap; assert(!A_constructed); } { test_max_alloc(); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp (revision 338005) @@ -1,95 +1,107 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so our +// custom aligned allocation functions are not called and the test fails +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Our custom aligned allocation functions are not called when deploying to +// platforms older than macosx10.13, since those platforms don't support +// aligned allocation. +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // XFAIL: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int A_constructed = 0; struct alignas(OverAligned) A { A() {++A_constructed;} ~A() {--A_constructed;} }; int B_constructed = 0; struct B { std::max_align_t member; B() { ++B_constructed; } ~B() { --B_constructed; } }; int new_called = 0; alignas(OverAligned) char Buff[OverAligned * 3]; void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc) { assert(!new_called); assert(s <= sizeof(Buff)); assert(static_cast(a) == OverAligned); ++new_called; return Buff; } void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT { assert(p == Buff); assert(static_cast(a) == OverAligned); assert(new_called); --new_called; } int main() { { A* ap = new (std::nothrow) A[2]; assert(ap); assert(A_constructed == 2); assert(new_called); delete [] ap; assert(A_constructed == 0); assert(!new_called); } { B* bp = new (std::nothrow) B[2]; assert(bp); assert(B_constructed == 2); assert(!new_called); delete [] bp; assert(!new_called); assert(!B_constructed); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::align_val_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::align_val_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new(std::size_t, std::align_val_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new(4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp (nonexistent) @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new(std::size_t, std::align_val_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp (revision 338005) @@ -1,101 +1,111 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang-7, apple-clang-8 +// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. -// XFAIL: gcc-5, gcc-6 +// UNSUPPORTED: gcc-5, gcc-6 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int unsized_delete_called = 0; int unsized_delete_nothrow_called = 0; int aligned_delete_called = 0; void reset() { unsized_delete_called = 0; unsized_delete_nothrow_called = 0; aligned_delete_called = 0; } void operator delete(void* p) TEST_NOEXCEPT { ++unsized_delete_called; std::free(p); } void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT { ++unsized_delete_nothrow_called; std::free(p); } void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT { ++aligned_delete_called; std::free(p); } struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; int main() { reset(); { B *bp = new B; DoNotOptimize(bp); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete bp; DoNotOptimize(bp); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { A *ap = new A; DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete ap; DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp (revision 338005) @@ -1,92 +1,102 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(my_new_handler); try { void* vp = operator new (std::numeric_limits::max(), static_cast(32)); ((void)vp); assert(false); } catch (std::bad_alloc&) { assert(new_handler_called == 1); } catch (...) { assert(false); } #endif } int main() { { A* ap = new A; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed); delete ap; assert(!A_constructed); } { test_throw_max_size(); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp (revision 338005) @@ -1,94 +1,104 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Using aligned allocation functions is a compiler error when deploying to +// platforms older than macosx10.13 +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; void test_max_alloc() { std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new (std::numeric_limits::max(), std::align_val_t(OverAligned), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); }; #ifndef TEST_HAS_NO_EXCEPTIONS try { do_test(); } catch (...) { assert(false); } #else do_test(); #endif } int main() { { A* ap = new(std::nothrow) A; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed); delete ap; assert(!A_constructed); } { test_max_alloc(); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp (revision 338005) @@ -1,97 +1,109 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// dylibs shipped before macosx10.13 do not provide aligned allocation, so our +// custom aligned allocation functions are not called and the test fails +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 +// UNSUPPORTED: with_system_cxx_lib=macosx10.8 +// UNSUPPORTED: with_system_cxx_lib=macosx10.7 + +// Our custom aligned allocation functions are not called when deploying to +// platforms older than macosx10.13, since those platforms don't support +// aligned allocation. +// UNSUPPORTED: macosx10.12 +// UNSUPPORTED: macosx10.11 +// UNSUPPORTED: macosx10.10 +// UNSUPPORTED: macosx10.9 +// UNSUPPORTED: macosx10.8 +// UNSUPPORTED: macosx10.7 // NOTE: gcc doesn't provide -faligned-allocation flag to test for // XFAIL: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; bool B_constructed = false; struct B { std::max_align_t member; B() { B_constructed = true; } ~B() { B_constructed = false; } }; int new_called = 0; alignas(OverAligned) char Buff[OverAligned * 2]; void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc) { assert(!new_called); assert(s <= sizeof(Buff)); assert(static_cast(a) == OverAligned); ++new_called; return Buff; } void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT { assert(p == Buff); assert(static_cast(a) == OverAligned); assert(new_called); --new_called; } int main() { { A* ap = new (std::nothrow) A; assert(ap); assert(A_constructed); assert(new_called); delete ap; assert(!A_constructed); assert(!new_called); } { B* bp = new (std::nothrow) B; assert(bp); assert(B_constructed); assert(!new_called); delete bp; assert(!new_called); assert(!B_constructed); } } Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new(std::size_t, std::align_val_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new(4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp (nonexistent) +++ vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp (revision 338005) @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new(std::size_t, std::align_val_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} Property changes on: vendor/libc++/dist-release_70/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist-release_70/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp (revision 338005) @@ -1,182 +1,184 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test cfloat #include +#include "test_macros.h" + #ifndef FLT_ROUNDS #error FLT_ROUNDS not defined #endif #ifndef FLT_EVAL_METHOD #error FLT_EVAL_METHOD not defined #endif #ifndef FLT_RADIX #error FLT_RADIX not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_HAS_SUBNORM #error FLT_HAS_SUBNORM not defined #endif #ifndef DBL_HAS_SUBNORM #error DBL_HAS_SUBNORM not defined #endif #ifndef LDBL_HAS_SUBNORM #error LDBL_HAS_SUBNORM not defined #endif #endif #ifndef FLT_MANT_DIG #error FLT_MANT_DIG not defined #endif #ifndef DBL_MANT_DIG #error DBL_MANT_DIG not defined #endif #ifndef LDBL_MANT_DIG #error LDBL_MANT_DIG not defined #endif #ifndef DECIMAL_DIG #error DECIMAL_DIG not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_DECIMAL_DIG #error FLT_DECIMAL_DIG not defined #endif #ifndef DBL_DECIMAL_DIG #error DBL_DECIMAL_DIG not defined #endif #ifndef LDBL_DECIMAL_DIG #error LDBL_DECIMAL_DIG not defined #endif #endif #ifndef FLT_DIG #error FLT_DIG not defined #endif #ifndef DBL_DIG #error DBL_DIG not defined #endif #ifndef LDBL_DIG #error LDBL_DIG not defined #endif #ifndef FLT_MIN_EXP #error FLT_MIN_EXP not defined #endif #ifndef DBL_MIN_EXP #error DBL_MIN_EXP not defined #endif #ifndef LDBL_MIN_EXP #error LDBL_MIN_EXP not defined #endif #ifndef FLT_MIN_10_EXP #error FLT_MIN_10_EXP not defined #endif #ifndef DBL_MIN_10_EXP #error DBL_MIN_10_EXP not defined #endif #ifndef LDBL_MIN_10_EXP #error LDBL_MIN_10_EXP not defined #endif #ifndef FLT_MAX_EXP #error FLT_MAX_EXP not defined #endif #ifndef DBL_MAX_EXP #error DBL_MAX_EXP not defined #endif #ifndef LDBL_MAX_EXP #error LDBL_MAX_EXP not defined #endif #ifndef FLT_MAX_10_EXP #error FLT_MAX_10_EXP not defined #endif #ifndef DBL_MAX_10_EXP #error DBL_MAX_10_EXP not defined #endif #ifndef LDBL_MAX_10_EXP #error LDBL_MAX_10_EXP not defined #endif #ifndef FLT_MAX #error FLT_MAX not defined #endif #ifndef DBL_MAX #error DBL_MAX not defined #endif #ifndef LDBL_MAX #error LDBL_MAX not defined #endif #ifndef FLT_EPSILON #error FLT_EPSILON not defined #endif #ifndef DBL_EPSILON #error DBL_EPSILON not defined #endif #ifndef LDBL_EPSILON #error LDBL_EPSILON not defined #endif #ifndef FLT_MIN #error FLT_MIN not defined #endif #ifndef DBL_MIN #error DBL_MIN not defined #endif #ifndef LDBL_MIN #error LDBL_MIN not defined #endif -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0 #ifndef FLT_TRUE_MIN #error FLT_TRUE_MIN not defined #endif #ifndef DBL_TRUE_MIN #error DBL_TRUE_MIN not defined #endif #ifndef LDBL_TRUE_MIN #error LDBL_TRUE_MIN not defined #endif #endif int main() { } Index: vendor/libc++/dist-release_70/test/std/language.support/support.runtime/ctime.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.runtime/ctime.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.runtime/ctime.pass.cpp (revision 338005) @@ -1,62 +1,62 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test #include #include #include "test_macros.h" #ifndef NULL #error NULL not defined #endif #ifndef CLOCKS_PER_SEC #error CLOCKS_PER_SEC not defined #endif #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) #ifndef TIME_UTC #error TIME_UTC not defined #endif #endif int main() { std::clock_t c = 0; std::size_t s = 0; std::time_t t = 0; std::tm tm = {}; #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) std::timespec tmspec = {}; ((void)tmspec); // Prevent unused warning #endif ((void)c); // Prevent unused warning ((void)s); // Prevent unused warning ((void)t); // Prevent unused warning ((void)tm); // Prevent unused warning static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET) static_assert((std::is_same::value), ""); #endif #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #endif char* c1 = 0; const char* c2 = 0; ((void)c1); // Prevent unused warning ((void)c2); // Prevent unused warning static_assert((std::is_same::value), ""); } Index: vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit.pass.cpp (revision 338005) @@ -1,23 +1,23 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// +// UNSUPPORTED: c++98, c++03 // test quick_exit and at_quick_exit #include void f() {} int main() { #ifdef _LIBCPP_HAS_QUICK_EXIT std::at_quick_exit(f); std::quick_exit(0); #endif } Index: vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp (revision 338005) @@ -1,25 +1,26 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // +// UNSUPPORTED: c++98, c++03 // test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined // results in a compile error. #include void f() {} int main() { #ifndef _LIBCPP_HAS_QUICK_EXIT std::at_quick_exit(f); #else #error #endif } Index: vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp (revision 338005) @@ -1,25 +1,25 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// +// UNSUPPORTED: c++98, c++03 // test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined // results in a compile error. #include void f() {} int main() { #ifndef _LIBCPP_HAS_QUICK_EXIT std::quick_exit(0); #else #error #endif } Index: vendor/libc++/dist-release_70/test/std/utilities/time/date.time/ctime.pass.cpp =================================================================== --- vendor/libc++/dist-release_70/test/std/utilities/time/date.time/ctime.pass.cpp (revision 338004) +++ vendor/libc++/dist-release_70/test/std/utilities/time/date.time/ctime.pass.cpp (revision 338005) @@ -1,60 +1,60 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include #include #include "test_macros.h" #ifndef NULL #error NULL not defined #endif #ifndef CLOCKS_PER_SEC #error CLOCKS_PER_SEC not defined #endif #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) #ifndef TIME_UTC #error TIME_UTC not defined #endif #endif int main() { std::clock_t c = 0; std::size_t s = 0; std::time_t t = 0; std::tm tm = {}; char str[3]; ((void)c); // Prevent unused warning ((void)s); // Prevent unused warning ((void)t); // Prevent unused warning ((void)tm); // Prevent unused warning ((void)str); // Prevent unused warning #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) std::timespec tmspec = {}; ((void)tmspec); // Prevent unused warning #endif static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET) static_assert((std::is_same::value), ""); #endif #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #endif static_assert((std::is_same::value), ""); } Index: vendor/libc++/dist-release_70/test/support/nasty_macros.hpp =================================================================== --- vendor/libc++/dist-release_70/test/support/nasty_macros.hpp (revision 338004) +++ vendor/libc++/dist-release_70/test/support/nasty_macros.hpp (revision 338005) @@ -1,58 +1,62 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SUPPORT_NASTY_MACROS_HPP #define SUPPORT_NASTY_MACROS_HPP #define NASTY_MACRO This should not be expanded!!! #define _A NASTY_MACRO #define _B NASTY_MACRO #define _C NASTY_MACRO #define _D NASTY_MACRO #define _E NASTY_MACRO #define _F NASTY_MACRO #define _G NASTY_MACRO #define _H NASTY_MACRO #define _I NASTY_MACRO #define _J NASTY_MACRO #define _K NASTY_MACRO #define _L NASTY_MACRO +// Because FreeBSD uses _M in its , and it is hard to avoid +// including that header, only define _M for other operating systems. +#ifndef __FreeBSD__ #define _M NASTY_MACRO +#endif #define _N NASTY_MACRO #define _O NASTY_MACRO #define _P NASTY_MACRO #define _Q NASTY_MACRO #define _R NASTY_MACRO #define _S NASTY_MACRO #define _T NASTY_MACRO #define _U NASTY_MACRO #define _V NASTY_MACRO #define _W NASTY_MACRO #define _X NASTY_MACRO #define _Y NASTY_MACRO #define _Z NASTY_MACRO // tchar.h defines these macros on Windows. #define _UI NASTY_MACRO #define _PUC NASTY_MACRO #define _CPUC NASTY_MACRO #define _PC NASTY_MACRO #define _CRPC NASTY_MACRO #define _CPC NASTY_MACRO // Test that libc++ doesn't use names reserved by WIN32 API Macros. // NOTE: Obviously we can only define these on non-windows platforms. #ifndef _WIN32 #define __deallocate NASTY_MACRO #define __out NASTY_MACRO #endif #define __output NASTY_MACRO #define __input NASTY_MACRO #endif // SUPPORT_NASTY_MACROS_HPP Index: vendor/libc++/dist-release_70/test/support/test_macros.h =================================================================== --- vendor/libc++/dist-release_70/test/support/test_macros.h (revision 338004) +++ vendor/libc++/dist-release_70/test/support/test_macros.h (revision 338005) @@ -1,282 +1,289 @@ // -*- C++ -*- //===---------------------------- test_macros.h ---------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SUPPORT_TEST_MACROS_HPP #define SUPPORT_TEST_MACROS_HPP #include // Get STL specific macros like _LIBCPP_VERSION #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wvariadic-macros" #endif #define TEST_CONCAT1(X, Y) X##Y #define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y) #ifdef __has_feature #define TEST_HAS_FEATURE(X) __has_feature(X) #else #define TEST_HAS_FEATURE(X) 0 #endif #ifndef __has_include #define __has_include(...) 0 #endif #ifdef __has_extension #define TEST_HAS_EXTENSION(X) __has_extension(X) #else #define TEST_HAS_EXTENSION(X) 0 #endif #ifdef __has_builtin #define TEST_HAS_BUILTIN(X) __has_builtin(X) #else #define TEST_HAS_BUILTIN(X) 0 #endif #ifdef __is_identifier // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. #define TEST_HAS_BUILTIN_IDENTIFIER(X) !__is_identifier(X) #else #define TEST_HAS_BUILTIN_IDENTIFIER(X) 0 #endif #if defined(__EDG__) # define TEST_COMPILER_EDG #elif defined(__clang__) # define TEST_COMPILER_CLANG # if defined(__apple_build_version__) # define TEST_COMPILER_APPLE_CLANG # endif #elif defined(_MSC_VER) # define TEST_COMPILER_C1XX #elif defined(__GNUC__) # define TEST_COMPILER_GCC #endif #if defined(__apple_build_version__) #define TEST_APPLE_CLANG_VER (__clang_major__ * 100) + __clang_minor__ #elif defined(__clang_major__) #define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__ #elif defined(__GNUC__) #define TEST_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) #endif /* Make a nice name for the standard version */ #ifndef TEST_STD_VER #if __cplusplus <= 199711L # define TEST_STD_VER 3 #elif __cplusplus <= 201103L # define TEST_STD_VER 11 #elif __cplusplus <= 201402L # define TEST_STD_VER 14 #elif __cplusplus <= 201703L # define TEST_STD_VER 17 #else # define TEST_STD_VER 99 // greater than current standard // This is deliberately different than _LIBCPP_STD_VER to discourage matching them up. #endif #endif // Attempt to deduce GCC version #if defined(_LIBCPP_VERSION) && __has_include() #include #define TEST_HAS_GLIBC #define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor) #endif #if TEST_STD_VER >= 11 #define TEST_ALIGNOF(...) alignof(__VA_ARGS__) #define TEST_ALIGNAS(...) alignas(__VA_ARGS__) #define TEST_CONSTEXPR constexpr #define TEST_NOEXCEPT noexcept #define TEST_NOEXCEPT_FALSE noexcept(false) #define TEST_NOEXCEPT_COND(...) noexcept(__VA_ARGS__) # if TEST_STD_VER >= 14 # define TEST_CONSTEXPR_CXX14 constexpr # else # define TEST_CONSTEXPR_CXX14 # endif # if TEST_STD_VER > 14 # define TEST_THROW_SPEC(...) # else # define TEST_THROW_SPEC(...) throw(__VA_ARGS__) # endif #else #define TEST_ALIGNOF(...) __alignof(__VA_ARGS__) #define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__))) #define TEST_CONSTEXPR #define TEST_CONSTEXPR_CXX14 #define TEST_NOEXCEPT throw() #define TEST_NOEXCEPT_FALSE #define TEST_NOEXCEPT_COND(...) #define TEST_THROW_SPEC(...) throw(__VA_ARGS__) #endif // Sniff out to see if the underling C library has C11 features // Note that at this time (July 2018), MacOS X and iOS do NOT. -#if __ISO_C_VISIBLE >= 2011 +// This is cribbed from __config; but lives here as well because we can't assume libc++ +#if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11 # if defined(__FreeBSD__) +// Specifically, FreeBSD does NOT have timespec_get, even though they have all +// the rest of C11 - this is PR#38495 # define TEST_HAS_C11_FEATURES # elif defined(__Fuchsia__) # define TEST_HAS_C11_FEATURES +# define TEST_HAS_TIMESPEC_GET # elif defined(__linux__) # if !defined(_LIBCPP_HAS_MUSL_LIBC) # if _LIBCPP_GLIBC_PREREQ(2, 17) +# define TEST_HAS_TIMESPEC_GET # define TEST_HAS_C11_FEATURES # endif # else // defined(_LIBCPP_HAS_MUSL_LIBC) # define TEST_HAS_C11_FEATURES +# define TEST_HAS_TIMESPEC_GET # endif # elif defined(_WIN32) # if defined(_MSC_VER) && !defined(__MINGW32__) # define TEST_HAS_C11_FEATURES // Using Microsoft's C Runtime library +# define TEST_HAS_TIMESPEC_GET # endif # endif #endif /* Features that were introduced in C++14 */ #if TEST_STD_VER >= 14 #define TEST_HAS_EXTENDED_CONSTEXPR #define TEST_HAS_VARIABLE_TEMPLATES #endif /* Features that were introduced in C++17 */ #if TEST_STD_VER >= 17 #endif /* Features that were introduced after C++17 */ #if TEST_STD_VER > 17 #endif #define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__)) #if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \ && !defined(__GXX_RTTI) #define TEST_HAS_NO_RTTI #endif #if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cpp_exceptions) \ && !defined(__EXCEPTIONS) #define TEST_HAS_NO_EXCEPTIONS #endif #if TEST_HAS_FEATURE(address_sanitizer) || TEST_HAS_FEATURE(memory_sanitizer) || \ TEST_HAS_FEATURE(thread_sanitizer) #define TEST_HAS_SANITIZERS #endif #if defined(_LIBCPP_NORETURN) #define TEST_NORETURN _LIBCPP_NORETURN #else #define TEST_NORETURN [[noreturn]] #endif #if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ (!(TEST_STD_VER > 14 || \ (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L))) #define TEST_HAS_NO_ALIGNED_ALLOCATION #endif #if defined(_LIBCPP_SAFE_STATIC) #define TEST_SAFE_STATIC _LIBCPP_SAFE_STATIC #else #define TEST_SAFE_STATIC #endif // FIXME: Fix this feature check when either (A) a compiler provides a complete // implementation, or (b) a feature check macro is specified #define TEST_HAS_NO_SPACESHIP_OPERATOR #if TEST_STD_VER < 11 #define ASSERT_NOEXCEPT(...) #define ASSERT_NOT_NOEXCEPT(...) #else #define ASSERT_NOEXCEPT(...) \ static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept") #define ASSERT_NOT_NOEXCEPT(...) \ static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept") #endif /* Macros for testing libc++ specific behavior and extensions */ #if defined(_LIBCPP_VERSION) #define LIBCPP_ASSERT(...) assert(__VA_ARGS__) #define LIBCPP_STATIC_ASSERT(...) static_assert(__VA_ARGS__) #define LIBCPP_ASSERT_NOEXCEPT(...) ASSERT_NOEXCEPT(__VA_ARGS__) #define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ASSERT_NOT_NOEXCEPT(__VA_ARGS__) #define LIBCPP_ONLY(...) __VA_ARGS__ #else #define LIBCPP_ASSERT(...) ((void)0) #define LIBCPP_STATIC_ASSERT(...) ((void)0) #define LIBCPP_ASSERT_NOEXCEPT(...) ((void)0) #define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ((void)0) #define LIBCPP_ONLY(...) ((void)0) #endif #define TEST_IGNORE_NODISCARD (void) namespace test_macros_detail { template struct is_same { enum { value = 0};} ; template struct is_same { enum {value = 1}; }; } // namespace test_macros_detail #define ASSERT_SAME_TYPE(...) \ static_assert((test_macros_detail::is_same<__VA_ARGS__>::value), \ "Types differ unexpectedly") #ifndef TEST_HAS_NO_EXCEPTIONS #define TEST_THROW(...) throw __VA_ARGS__ #else #if defined(__GNUC__) #define TEST_THROW(...) __builtin_abort() #else #include #define TEST_THROW(...) ::abort() #endif #endif #if defined(__GNUC__) || defined(__clang__) template inline void DoNotOptimize(Tp const& value) { asm volatile("" : : "r,m"(value) : "memory"); } template inline void DoNotOptimize(Tp& value) { #if defined(__clang__) asm volatile("" : "+r,m"(value) : : "memory"); #else asm volatile("" : "+m,r"(value) : : "memory"); #endif } #else #include template inline void DoNotOptimize(Tp const& value) { const volatile void* volatile unused = __builtin_addressof(value); static_cast(unused); _ReadWriteBarrier(); } #endif #if defined(__GNUC__) #pragma GCC diagnostic pop #endif #endif // SUPPORT_TEST_MACROS_HPP Index: vendor/libc++/dist-release_70/utils/libcxx/test/config.py =================================================================== --- vendor/libc++/dist-release_70/utils/libcxx/test/config.py (revision 338004) +++ vendor/libc++/dist-release_70/utils/libcxx/test/config.py (revision 338005) @@ -1,1178 +1,1179 @@ #===----------------------------------------------------------------------===## # # The LLVM Compiler Infrastructure # # This file is dual licensed under the MIT and the University of Illinois Open # Source Licenses. See LICENSE.TXT for details. # #===----------------------------------------------------------------------===## import locale import os import platform import pkgutil import pipes import re import shlex import shutil import sys from libcxx.compiler import CXXCompiler from libcxx.test.target_info import make_target_info from libcxx.test.executor import * from libcxx.test.tracing import * import libcxx.util def loadSiteConfig(lit_config, config, param_name, env_name): # We haven't loaded the site specific configuration (the user is # probably trying to run on a test file directly, and either the site # configuration hasn't been created by the build system, or we are in an # out-of-tree build situation). site_cfg = lit_config.params.get(param_name, os.environ.get(env_name)) if not site_cfg: lit_config.warning('No site specific configuration file found!' ' Running the tests in the default configuration.') elif not os.path.isfile(site_cfg): lit_config.fatal( "Specified site configuration file does not exist: '%s'" % site_cfg) else: lit_config.note('using site specific configuration at %s' % site_cfg) ld_fn = lit_config.load_config # Null out the load_config function so that lit.site.cfg doesn't # recursively load a config even if it tries. # TODO: This is one hell of a hack. Fix it. def prevent_reload_fn(*args, **kwargs): pass lit_config.load_config = prevent_reload_fn ld_fn(config, site_cfg) lit_config.load_config = ld_fn # Extract the value of a numeric macro such as __cplusplus or a feature-test # macro. def intMacroValue(token): return int(token.rstrip('LlUu')) class Configuration(object): # pylint: disable=redefined-outer-name def __init__(self, lit_config, config): self.lit_config = lit_config self.config = config self.is_windows = platform.system() == 'Windows' self.cxx = None self.cxx_is_clang_cl = None self.cxx_stdlib_under_test = None self.project_obj_root = None self.libcxx_src_root = None self.libcxx_obj_root = None self.cxx_library_root = None self.cxx_runtime_root = None self.abi_library_root = None self.link_shared = self.get_lit_bool('enable_shared', default=True) self.debug_build = self.get_lit_bool('debug_build', default=False) self.exec_env = dict(os.environ) self.use_target = False self.use_system_cxx_lib = False self.use_clang_verify = False self.long_tests = None self.execute_external = False def get_lit_conf(self, name, default=None): val = self.lit_config.params.get(name, None) if val is None: val = getattr(self.config, name, None) if val is None: val = default return val def get_lit_bool(self, name, default=None, env_var=None): def check_value(value, var_name): if value is None: return default if isinstance(value, bool): return value if not isinstance(value, str): raise TypeError('expected bool or string') if value.lower() in ('1', 'true'): return True if value.lower() in ('', '0', 'false'): return False self.lit_config.fatal( "parameter '{}' should be true or false".format(var_name)) conf_val = self.get_lit_conf(name) if env_var is not None and env_var in os.environ and \ os.environ[env_var] is not None: val = os.environ[env_var] if conf_val is not None: self.lit_config.warning( 'Environment variable %s=%s is overriding explicit ' '--param=%s=%s' % (env_var, val, name, conf_val)) return check_value(val, env_var) return check_value(conf_val, name) def get_modules_enabled(self): return self.get_lit_bool('enable_modules', default=False, env_var='LIBCXX_ENABLE_MODULES') def make_static_lib_name(self, name): """Return the full filename for the specified library name""" if self.is_windows: assert name == 'c++' # Only allow libc++ to use this function for now. return 'lib' + name + '.lib' else: return 'lib' + name + '.a' def configure(self): self.configure_executor() self.configure_use_system_cxx_lib() self.configure_target_info() self.configure_cxx() self.configure_triple() self.configure_deployment() self.configure_availability() self.configure_src_root() self.configure_obj_root() self.configure_cxx_stdlib_under_test() self.configure_cxx_library_root() self.configure_use_clang_verify() self.configure_use_thread_safety() self.configure_execute_external() self.configure_ccache() self.configure_compile_flags() self.configure_filesystem_compile_flags() self.configure_link_flags() self.configure_env() self.configure_color_diagnostics() self.configure_debug_mode() self.configure_warnings() self.configure_sanitizer() self.configure_coverage() self.configure_modules() self.configure_coroutines() self.configure_substitutions() self.configure_features() def print_config_info(self): # Print the final compile and link flags. self.lit_config.note('Using compiler: %s' % self.cxx.path) self.lit_config.note('Using flags: %s' % self.cxx.flags) if self.cxx.use_modules: self.lit_config.note('Using modules flags: %s' % self.cxx.modules_flags) self.lit_config.note('Using compile flags: %s' % self.cxx.compile_flags) if len(self.cxx.warning_flags): self.lit_config.note('Using warnings: %s' % self.cxx.warning_flags) self.lit_config.note('Using link flags: %s' % self.cxx.link_flags) # Print as list to prevent "set([...])" from being printed. self.lit_config.note('Using available_features: %s' % list(self.config.available_features)) show_env_vars = {} for k,v in self.exec_env.items(): if k not in os.environ or os.environ[k] != v: show_env_vars[k] = v self.lit_config.note('Adding environment variables: %r' % show_env_vars) sys.stderr.flush() # Force flushing to avoid broken output on Windows def get_test_format(self): from libcxx.test.format import LibcxxTestFormat return LibcxxTestFormat( self.cxx, self.use_clang_verify, self.execute_external, self.executor, exec_env=self.exec_env) def configure_executor(self): exec_str = self.get_lit_conf('executor', "None") te = eval(exec_str) if te: self.lit_config.note("Using executor: %r" % exec_str) if self.lit_config.useValgrind: # We have no way of knowing where in the chain the # ValgrindExecutor is supposed to go. It is likely # that the user wants it at the end, but we have no # way of getting at that easily. selt.lit_config.fatal("Cannot infer how to create a Valgrind " " executor.") else: te = LocalExecutor() if self.lit_config.useValgrind: te = ValgrindExecutor(self.lit_config.valgrindArgs, te) self.executor = te def configure_target_info(self): self.target_info = make_target_info(self) def configure_cxx(self): # Gather various compiler parameters. cxx = self.get_lit_conf('cxx_under_test') self.cxx_is_clang_cl = cxx is not None and \ os.path.basename(cxx) == 'clang-cl.exe' # If no specific cxx_under_test was given, attempt to infer it as # clang++. if cxx is None or self.cxx_is_clang_cl: search_paths = self.config.environment['PATH'] if cxx is not None and os.path.isabs(cxx): search_paths = os.path.dirname(cxx) clangxx = libcxx.util.which('clang++', search_paths) if clangxx: cxx = clangxx self.lit_config.note( "inferred cxx_under_test as: %r" % cxx) elif self.cxx_is_clang_cl: self.lit_config.fatal('Failed to find clang++ substitution for' ' clang-cl') if not cxx: self.lit_config.fatal('must specify user parameter cxx_under_test ' '(e.g., --param=cxx_under_test=clang++)') self.cxx = CXXCompiler(cxx) if not self.cxx_is_clang_cl else \ self._configure_clang_cl(cxx) cxx_type = self.cxx.type if cxx_type is not None: assert self.cxx.version is not None maj_v, min_v, _ = self.cxx.version self.config.available_features.add(cxx_type) self.config.available_features.add('%s-%s' % (cxx_type, maj_v)) self.config.available_features.add('%s-%s.%s' % ( cxx_type, maj_v, min_v)) self.cxx.compile_env = dict(os.environ) # 'CCACHE_CPP2' prevents ccache from stripping comments while # preprocessing. This is required to prevent stripping of '-verify' # comments. self.cxx.compile_env['CCACHE_CPP2'] = '1' def _configure_clang_cl(self, clang_path): def _split_env_var(var): return [p.strip() for p in os.environ.get(var, '').split(';') if p.strip()] def _prefixed_env_list(var, prefix): from itertools import chain return list(chain.from_iterable((prefix, path) for path in _split_env_var(var))) assert self.cxx_is_clang_cl flags = [] compile_flags = _prefixed_env_list('INCLUDE', '-isystem') link_flags = _prefixed_env_list('LIB', '-L') for path in _split_env_var('LIB'): self.add_path(self.exec_env, path) return CXXCompiler(clang_path, flags=flags, compile_flags=compile_flags, link_flags=link_flags) def _dump_macros_verbose(self, *args, **kwargs): macros_or_error = self.cxx.dumpMacros(*args, **kwargs) if isinstance(macros_or_error, tuple): cmd, out, err, rc = macros_or_error report = libcxx.util.makeReport(cmd, out, err, rc) report += "Compiler failed unexpectedly when dumping macros!" self.lit_config.fatal(report) return None assert isinstance(macros_or_error, dict) return macros_or_error def configure_src_root(self): self.libcxx_src_root = self.get_lit_conf( 'libcxx_src_root', os.path.dirname(self.config.test_source_root)) def configure_obj_root(self): self.project_obj_root = self.get_lit_conf('project_obj_root') self.libcxx_obj_root = self.get_lit_conf('libcxx_obj_root') if not self.libcxx_obj_root and self.project_obj_root is not None: possible_root = os.path.join(self.project_obj_root, 'projects', 'libcxx') if os.path.isdir(possible_root): self.libcxx_obj_root = possible_root else: self.libcxx_obj_root = self.project_obj_root def configure_cxx_library_root(self): self.cxx_library_root = self.get_lit_conf('cxx_library_root', self.libcxx_obj_root) self.cxx_runtime_root = self.get_lit_conf('cxx_runtime_root', self.cxx_library_root) def configure_use_system_cxx_lib(self): # This test suite supports testing against either the system library or # the locally built one; the former mode is useful for testing ABI # compatibility between the current headers and a shipping dynamic # library. # Default to testing against the locally built libc++ library. self.use_system_cxx_lib = self.get_lit_conf('use_system_cxx_lib') if self.use_system_cxx_lib == 'true': self.use_system_cxx_lib = True elif self.use_system_cxx_lib == 'false': self.use_system_cxx_lib = False elif self.use_system_cxx_lib: assert os.path.isdir(self.use_system_cxx_lib) self.lit_config.note( "inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib) def configure_availability(self): # See http://llvm.org/docs/AvailabilityMarkup.html self.with_availability = self.get_lit_bool('with_availability', False) self.lit_config.note( "inferred with_availability as: %r" % self.with_availability) def configure_cxx_stdlib_under_test(self): self.cxx_stdlib_under_test = self.get_lit_conf( 'cxx_stdlib_under_test', 'libc++') if self.cxx_stdlib_under_test not in \ ['libc++', 'libstdc++', 'msvc', 'cxx_default']: self.lit_config.fatal( 'unsupported value for "cxx_stdlib_under_test": %s' % self.cxx_stdlib_under_test) self.config.available_features.add(self.cxx_stdlib_under_test) if self.cxx_stdlib_under_test == 'libstdc++': self.config.available_features.add('libstdc++') # Manually enable the experimental and filesystem tests for libstdc++ # if the options aren't present. # FIXME this is a hack. if self.get_lit_conf('enable_experimental') is None: self.config.enable_experimental = 'true' if self.get_lit_conf('enable_filesystem') is None: self.config.enable_filesystem = 'true' def configure_use_clang_verify(self): '''If set, run clang with -verify on failing tests.''' if self.with_availability: self.use_clang_verify = False return self.use_clang_verify = self.get_lit_bool('use_clang_verify') if self.use_clang_verify is None: # NOTE: We do not test for the -verify flag directly because # -verify will always exit with non-zero on an empty file. self.use_clang_verify = self.cxx.isVerifySupported() self.lit_config.note( "inferred use_clang_verify as: %r" % self.use_clang_verify) if self.use_clang_verify: self.config.available_features.add('verify-support') def configure_use_thread_safety(self): '''If set, run clang with -verify on failing tests.''' has_thread_safety = self.cxx.hasCompileFlag('-Werror=thread-safety') if has_thread_safety: self.cxx.compile_flags += ['-Werror=thread-safety'] self.config.available_features.add('thread-safety') self.lit_config.note("enabling thread-safety annotations") def configure_execute_external(self): # Choose between lit's internal shell pipeline runner and a real shell. # If LIT_USE_INTERNAL_SHELL is in the environment, we use that as the # default value. Otherwise we ask the target_info. use_lit_shell_default = os.environ.get('LIT_USE_INTERNAL_SHELL') if use_lit_shell_default is not None: use_lit_shell_default = use_lit_shell_default != '0' else: use_lit_shell_default = self.target_info.use_lit_shell_default() # Check for the command line parameter using the default value if it is # not present. use_lit_shell = self.get_lit_bool('use_lit_shell', use_lit_shell_default) self.execute_external = not use_lit_shell def configure_ccache(self): use_ccache_default = os.environ.get('LIBCXX_USE_CCACHE') is not None use_ccache = self.get_lit_bool('use_ccache', use_ccache_default) if use_ccache: self.cxx.use_ccache = True self.lit_config.note('enabling ccache') def add_deployment_feature(self, feature): (arch, name, version) = self.config.deployment self.config.available_features.add('%s=%s-%s' % (feature, arch, name)) self.config.available_features.add('%s=%s' % (feature, name)) self.config.available_features.add('%s=%s%s' % (feature, name, version)) def configure_features(self): additional_features = self.get_lit_conf('additional_features') if additional_features: for f in additional_features.split(','): self.config.available_features.add(f.strip()) self.target_info.add_locale_features(self.config.available_features) target_platform = self.target_info.platform() # Write an "available feature" that combines the triple when # use_system_cxx_lib is enabled. This is so that we can easily write # XFAIL markers for tests that are known to fail with versions of # libc++ as were shipped with a particular triple. if self.use_system_cxx_lib: self.config.available_features.add('with_system_cxx_lib') self.config.available_features.add( 'with_system_cxx_lib=%s' % self.config.target_triple) # Add subcomponents individually. target_components = self.config.target_triple.split('-') for component in target_components: self.config.available_features.add( 'with_system_cxx_lib=%s' % component) # Add available features for more generic versions of the target # triple attached to with_system_cxx_lib. if self.use_deployment: self.add_deployment_feature('with_system_cxx_lib') # Configure the availability markup checks features. if self.with_availability: self.config.available_features.add('availability_markup') self.add_deployment_feature('availability_markup') if self.use_system_cxx_lib or self.with_availability: self.config.available_features.add('availability') self.add_deployment_feature('availability') if platform.system() == 'Darwin': self.config.available_features.add('apple-darwin') # Insert the platform name into the available features as a lower case. self.config.available_features.add(target_platform) # Simulator testing can take a really long time for some of these tests # so add a feature check so we can REQUIRES: long_tests in them self.long_tests = self.get_lit_bool('long_tests') if self.long_tests is None: # Default to running long tests. self.long_tests = True self.lit_config.note( "inferred long_tests as: %r" % self.long_tests) if self.long_tests: self.config.available_features.add('long_tests') # Run a compile test for the -fsized-deallocation flag. This is needed # in test/std/language.support/support.dynamic/new.delete if self.cxx.hasCompileFlag('-fsized-deallocation'): self.config.available_features.add('fsized-deallocation') if self.cxx.hasCompileFlag('-faligned-allocation'): self.config.available_features.add('-faligned-allocation') else: # FIXME remove this once more than just clang-4.0 support # C++17 aligned allocation. self.config.available_features.add('no-aligned-allocation') if self.cxx.hasCompileFlag('-fdelayed-template-parsing'): self.config.available_features.add('fdelayed-template-parsing') if self.get_lit_bool('has_libatomic', False): self.config.available_features.add('libatomic') macros = self._dump_macros_verbose() if '__cpp_if_constexpr' not in macros: self.config.available_features.add('libcpp-no-if-constexpr') if '__cpp_structured_bindings' not in macros: self.config.available_features.add('libcpp-no-structured-bindings') if '__cpp_deduction_guides' not in macros or \ intMacroValue(macros['__cpp_deduction_guides']) < 201611: self.config.available_features.add('libcpp-no-deduction-guides') if self.is_windows: self.config.available_features.add('windows') if self.cxx_stdlib_under_test == 'libc++': # LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the # initial Windows failures until they can be properly diagnosed # and fixed. This allows easier detection of new test failures # and regressions. Note: New failures should not be suppressed # using this feature. (Also see llvm.org/PR32730) self.config.available_features.add('LIBCXX-WINDOWS-FIXME') # Attempt to detect the glibc version by querying for __GLIBC__ # in 'features.h'. macros = self.cxx.dumpMacros(flags=['-include', 'features.h']) if isinstance(macros, dict) and '__GLIBC__' in macros: maj_v, min_v = (macros['__GLIBC__'], macros['__GLIBC_MINOR__']) self.config.available_features.add('glibc') self.config.available_features.add('glibc-%s' % maj_v) self.config.available_features.add('glibc-%s.%s' % (maj_v, min_v)) # Support Objective-C++ only on MacOS and if the compiler supports it. if self.target_info.platform() == "darwin" and \ self.target_info.is_host_macosx() and \ self.cxx.hasCompileFlag(["-x", "objective-c++", "-fobjc-arc"]): self.config.available_features.add("objective-c++") def configure_compile_flags(self): no_default_flags = self.get_lit_bool('no_default_flags', False) if not no_default_flags: self.configure_default_compile_flags() # This include is always needed so add so add it regardless of # 'no_default_flags'. support_path = os.path.join(self.libcxx_src_root, 'test/support') self.cxx.compile_flags += ['-I' + support_path] # Configure extra flags compile_flags_str = self.get_lit_conf('compile_flags', '') self.cxx.compile_flags += shlex.split(compile_flags_str) if self.is_windows: # FIXME: Can we remove this? self.cxx.compile_flags += ['-D_CRT_SECURE_NO_WARNINGS'] # Required so that tests using min/max don't fail on Windows, # and so that those tests don't have to be changed to tolerate # this insanity. self.cxx.compile_flags += ['-DNOMINMAX'] additional_flags = self.get_lit_conf('test_compiler_flags') if additional_flags: self.cxx.compile_flags += shlex.split(additional_flags) def configure_default_compile_flags(self): # Try and get the std version from the command line. Fall back to # default given in lit.site.cfg is not present. If default is not # present then force c++11. std = self.get_lit_conf('std') if not std: # Choose the newest possible language dialect if none is given. possible_stds = ['c++2a', 'c++17', 'c++1z', 'c++14', 'c++11', 'c++03'] if self.cxx.type == 'gcc': maj_v, _, _ = self.cxx.version maj_v = int(maj_v) if maj_v < 7: possible_stds.remove('c++1z') # FIXME: How many C++14 tests actually fail under GCC 5 and 6? # Should we XFAIL them individually instead? if maj_v <= 6: possible_stds.remove('c++14') for s in possible_stds: if self.cxx.hasCompileFlag('-std=%s' % s): std = s self.lit_config.note( 'inferred language dialect as: %s' % std) break if not std: self.lit_config.fatal( 'Failed to infer a supported language dialect from one of %r' % possible_stds) self.cxx.compile_flags += ['-std={0}'.format(std)] std_feature = std.replace('gnu++', 'c++') std_feature = std.replace('1z', '17') self.config.available_features.add(std_feature) # Configure include paths self.configure_compile_flags_header_includes() self.target_info.add_cxx_compile_flags(self.cxx.compile_flags) # Configure feature flags. self.configure_compile_flags_exceptions() self.configure_compile_flags_rtti() self.configure_compile_flags_abi_version() enable_32bit = self.get_lit_bool('enable_32bit', False) if enable_32bit: self.cxx.flags += ['-m32'] # Use verbose output for better errors self.cxx.flags += ['-v'] sysroot = self.get_lit_conf('sysroot') if sysroot: self.cxx.flags += ['--sysroot', sysroot] gcc_toolchain = self.get_lit_conf('gcc_toolchain') if gcc_toolchain: self.cxx.flags += ['-gcc-toolchain', gcc_toolchain] # NOTE: the _DEBUG definition must preceed the triple check because for # the Windows build of libc++, the forced inclusion of a header requires # that _DEBUG is defined. Incorrect ordering will result in -target # being elided. if self.is_windows and self.debug_build: self.cxx.compile_flags += ['-D_DEBUG'] if self.use_target: if not self.cxx.addFlagIfSupported( ['-target', self.config.target_triple]): self.lit_config.warning('use_target is true but -target is '\ 'not supported by the compiler') if self.use_deployment: arch, name, version = self.config.deployment self.cxx.flags += ['-arch', arch] self.cxx.flags += ['-m' + name + '-version-min=' + version] # Disable availability unless explicitely requested if not self.with_availability: self.cxx.flags += ['-D_LIBCPP_DISABLE_AVAILABILITY'] # FIXME(EricWF): variant_size.pass.cpp requires a slightly larger # template depth with older Clang versions. self.cxx.addFlagIfSupported('-ftemplate-depth=270') def configure_compile_flags_header_includes(self): support_path = os.path.join(self.libcxx_src_root, 'test', 'support') self.configure_config_site_header() if self.cxx_stdlib_under_test != 'libstdc++' and \ not self.is_windows: self.cxx.compile_flags += [ '-include', os.path.join(support_path, 'nasty_macros.hpp')] if self.cxx_stdlib_under_test == 'msvc': self.cxx.compile_flags += [ '-include', os.path.join(support_path, 'msvc_stdlib_force_include.hpp')] pass if self.is_windows and self.debug_build and \ self.cxx_stdlib_under_test != 'msvc': self.cxx.compile_flags += [ '-include', os.path.join(support_path, 'set_windows_crt_report_mode.h') ] cxx_headers = self.get_lit_conf('cxx_headers') if cxx_headers == '' or (cxx_headers is None and self.cxx_stdlib_under_test != 'libc++'): self.lit_config.note('using the system cxx headers') return self.cxx.compile_flags += ['-nostdinc++'] if cxx_headers is None: cxx_headers = os.path.join(self.libcxx_src_root, 'include') if not os.path.isdir(cxx_headers): self.lit_config.fatal("cxx_headers='%s' is not a directory." % cxx_headers) self.cxx.compile_flags += ['-I' + cxx_headers] if self.libcxx_obj_root is not None: cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include', 'c++build') if os.path.isdir(cxxabi_headers): self.cxx.compile_flags += ['-I' + cxxabi_headers] def configure_config_site_header(self): # Check for a possible __config_site in the build directory. We # use this if it exists. if self.libcxx_obj_root is None: return config_site_header = os.path.join(self.libcxx_obj_root, '__config_site') if not os.path.isfile(config_site_header): return contained_macros = self.parse_config_site_and_add_features( config_site_header) self.lit_config.note('Using __config_site header %s with macros: %r' % (config_site_header, contained_macros)) # FIXME: This must come after the call to # 'parse_config_site_and_add_features(...)' in order for it to work. self.cxx.compile_flags += ['-include', config_site_header] def parse_config_site_and_add_features(self, header): """ parse_config_site_and_add_features - Deduce and add the test features that that are implied by the #define's in the __config_site header. Return a dictionary containing the macros found in the '__config_site' header. """ # Parse the macro contents of __config_site by dumping the macros # using 'c++ -dM -E' and filtering the predefines. predefines = self._dump_macros_verbose() macros = self._dump_macros_verbose(header) feature_macros_keys = set(macros.keys()) - set(predefines.keys()) feature_macros = {} for k in feature_macros_keys: feature_macros[k] = macros[k] # We expect the header guard to be one of the definitions assert '_LIBCPP_CONFIG_SITE' in feature_macros del feature_macros['_LIBCPP_CONFIG_SITE'] # The __config_site header should be non-empty. Otherwise it should # have never been emitted by CMake. assert len(feature_macros) > 0 # FIXME: This is a hack that should be fixed using module maps (or something) # If modules are enabled then we have to lift all of the definitions # in __config_site onto the command line. modules_enabled = self.get_modules_enabled() self.cxx.compile_flags += ['-Wno-macro-redefined'] # Transform each macro name into the feature name used in the tests. # Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads for m in feature_macros: if modules_enabled: define = '-D%s' % m if feature_macros[m]: define += '=%s' % (feature_macros[m]) self.cxx.compile_flags += [define] - if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS': + if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS' or \ + m == '_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT': continue if m == '_LIBCPP_ABI_VERSION': self.config.available_features.add('libcpp-abi-version-v%s' % feature_macros[m]) continue if m == '_LIBCPP_NO_VCRUNTIME': self.config.available_features.add('libcpp-no-vcruntime') continue assert m.startswith('_LIBCPP_HAS_') or m.startswith('_LIBCPP_ABI_') m = m.lower()[1:].replace('_', '-') self.config.available_features.add(m) return feature_macros def configure_compile_flags_exceptions(self): enable_exceptions = self.get_lit_bool('enable_exceptions', True) if not enable_exceptions: self.config.available_features.add('libcpp-no-exceptions') self.cxx.compile_flags += ['-fno-exceptions'] def configure_compile_flags_rtti(self): enable_rtti = self.get_lit_bool('enable_rtti', True) if not enable_rtti: self.config.available_features.add('libcpp-no-rtti') self.cxx.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI'] def configure_compile_flags_abi_version(self): abi_version = self.get_lit_conf('abi_version', '').strip() abi_unstable = self.get_lit_bool('abi_unstable') # Only add the ABI version when it is non-default. # FIXME(EricWF): Get the ABI version from the "__config_site". if abi_version and abi_version != '1': self.cxx.compile_flags += ['-D_LIBCPP_ABI_VERSION=' + abi_version] if abi_unstable: self.config.available_features.add('libcpp-abi-unstable') self.cxx.compile_flags += ['-D_LIBCPP_ABI_UNSTABLE'] def configure_filesystem_compile_flags(self): enable_fs = self.get_lit_bool('enable_filesystem', default=False) if not enable_fs: return self.config.available_features.add('c++filesystem') static_env = os.path.join(self.libcxx_src_root, 'test', 'std', 'input.output', 'filesystems', 'Inputs', 'static_test_env') static_env = os.path.realpath(static_env) assert os.path.isdir(static_env) self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="%s"' % static_env] dynamic_env = os.path.join(self.config.test_exec_root, 'filesystem', 'Output', 'dynamic_env') dynamic_env = os.path.realpath(dynamic_env) if not os.path.isdir(dynamic_env): os.makedirs(dynamic_env) self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="%s"' % dynamic_env] self.exec_env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env) dynamic_helper = os.path.join(self.libcxx_src_root, 'test', 'support', 'filesystem_dynamic_test_helper.py') assert os.path.isfile(dynamic_helper) self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="%s %s"' % (sys.executable, dynamic_helper)] def configure_link_flags(self): no_default_flags = self.get_lit_bool('no_default_flags', False) if not no_default_flags: # Configure library path self.configure_link_flags_cxx_library_path() self.configure_link_flags_abi_library_path() # Configure libraries if self.cxx_stdlib_under_test == 'libc++': self.cxx.link_flags += ['-nodefaultlibs'] # FIXME: Handle MSVCRT as part of the ABI library handling. if self.is_windows: self.cxx.link_flags += ['-nostdlib'] self.configure_link_flags_cxx_library() self.configure_link_flags_abi_library() self.configure_extra_library_flags() elif self.cxx_stdlib_under_test == 'libstdc++': enable_fs = self.get_lit_bool('enable_filesystem', default=False) if enable_fs: self.config.available_features.add('c++experimental') self.cxx.link_flags += ['-lstdc++fs'] self.cxx.link_flags += ['-lm', '-pthread'] elif self.cxx_stdlib_under_test == 'msvc': # FIXME: Correctly setup debug/release flags here. pass elif self.cxx_stdlib_under_test == 'cxx_default': self.cxx.link_flags += ['-pthread'] else: self.lit_config.fatal( 'unsupported value for "use_stdlib_type": %s' % use_stdlib_type) link_flags_str = self.get_lit_conf('link_flags', '') self.cxx.link_flags += shlex.split(link_flags_str) def configure_link_flags_cxx_library_path(self): if not self.use_system_cxx_lib: if self.cxx_library_root: self.cxx.link_flags += ['-L' + self.cxx_library_root] if self.is_windows and self.link_shared: self.add_path(self.cxx.compile_env, self.cxx_library_root) if self.cxx_runtime_root: if not self.is_windows: self.cxx.link_flags += ['-Wl,-rpath,' + self.cxx_runtime_root] elif self.is_windows and self.link_shared: self.add_path(self.exec_env, self.cxx_runtime_root) elif os.path.isdir(str(self.use_system_cxx_lib)): self.cxx.link_flags += ['-L' + self.use_system_cxx_lib] if not self.is_windows: self.cxx.link_flags += ['-Wl,-rpath,' + self.use_system_cxx_lib] if self.is_windows and self.link_shared: self.add_path(self.cxx.compile_env, self.use_system_cxx_lib) additional_flags = self.get_lit_conf('test_linker_flags') if additional_flags: self.cxx.link_flags += shlex.split(additional_flags) def configure_link_flags_abi_library_path(self): # Configure ABI library paths. self.abi_library_root = self.get_lit_conf('abi_library_path') if self.abi_library_root: self.cxx.link_flags += ['-L' + self.abi_library_root] if not self.is_windows: self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_library_root] else: self.add_path(self.exec_env, self.abi_library_root) def configure_link_flags_cxx_library(self): libcxx_experimental = self.get_lit_bool('enable_experimental', default=False) if libcxx_experimental: self.config.available_features.add('c++experimental') self.cxx.link_flags += ['-lc++experimental'] libcxx_fs = self.get_lit_bool('enable_filesystem', default=False) if libcxx_fs: self.config.available_features.add('c++fs') self.cxx.link_flags += ['-lc++fs'] if self.link_shared: self.cxx.link_flags += ['-lc++'] else: cxx_library_root = self.get_lit_conf('cxx_library_root') if cxx_library_root: libname = self.make_static_lib_name('c++') abs_path = os.path.join(cxx_library_root, libname) assert os.path.exists(abs_path) and \ "static libc++ library does not exist" self.cxx.link_flags += [abs_path] else: self.cxx.link_flags += ['-lc++'] def configure_link_flags_abi_library(self): cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi') if cxx_abi == 'libstdc++': self.cxx.link_flags += ['-lstdc++'] elif cxx_abi == 'libsupc++': self.cxx.link_flags += ['-lsupc++'] elif cxx_abi == 'libcxxabi': if self.target_info.allow_cxxabi_link(): libcxxabi_shared = self.get_lit_bool('libcxxabi_shared', default=True) if libcxxabi_shared: self.cxx.link_flags += ['-lc++abi'] else: cxxabi_library_root = self.get_lit_conf('abi_library_path') if cxxabi_library_root: libname = self.make_static_lib_name('c++abi') abs_path = os.path.join(cxxabi_library_root, libname) self.cxx.link_flags += [abs_path] else: self.cxx.link_flags += ['-lc++abi'] elif cxx_abi == 'libcxxrt': self.cxx.link_flags += ['-lcxxrt'] elif cxx_abi == 'vcruntime': debug_suffix = 'd' if self.debug_build else '' self.cxx.link_flags += ['-l%s%s' % (lib, debug_suffix) for lib in ['vcruntime', 'ucrt', 'msvcrt']] elif cxx_abi == 'none' or cxx_abi == 'default': if self.is_windows: debug_suffix = 'd' if self.debug_build else '' self.cxx.link_flags += ['-lmsvcrt%s' % debug_suffix] else: self.lit_config.fatal( 'C++ ABI setting %s unsupported for tests' % cxx_abi) def configure_extra_library_flags(self): if self.get_lit_bool('cxx_ext_threads', default=False): self.cxx.link_flags += ['-lc++external_threads'] self.target_info.add_cxx_link_flags(self.cxx.link_flags) def configure_color_diagnostics(self): use_color = self.get_lit_conf('color_diagnostics') if use_color is None: use_color = os.environ.get('LIBCXX_COLOR_DIAGNOSTICS') if use_color is None: return if use_color != '': self.lit_config.fatal('Invalid value for color_diagnostics "%s".' % use_color) color_flag = '-fdiagnostics-color=always' # Check if the compiler supports the color diagnostics flag. Issue a # warning if it does not since color diagnostics have been requested. if not self.cxx.hasCompileFlag(color_flag): self.lit_config.warning( 'color diagnostics have been requested but are not supported ' 'by the compiler') else: self.cxx.flags += [color_flag] def configure_debug_mode(self): debug_level = self.get_lit_conf('debug_level', None) if not debug_level: return if debug_level not in ['0', '1']: self.lit_config.fatal('Invalid value for debug_level "%s".' % debug_level) self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level] def configure_warnings(self): # Turn on warnings by default for Clang based compilers when C++ >= 11 default_enable_warnings = self.cxx.type in ['clang', 'apple-clang'] \ and len(self.config.available_features.intersection( ['c++11', 'c++14', 'c++17', 'c++2a'])) != 0 enable_warnings = self.get_lit_bool('enable_warnings', default_enable_warnings) self.cxx.useWarnings(enable_warnings) self.cxx.warning_flags += [ '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror' ] if self.cxx.hasWarningFlag('-Wuser-defined-warnings'): self.cxx.warning_flags += ['-Wuser-defined-warnings'] self.config.available_features.add('diagnose-if-support') self.cxx.addWarningFlagIfSupported('-Wshadow') self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument') self.cxx.addWarningFlagIfSupported('-Wno-attributes') self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move') self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions') self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals') self.cxx.addWarningFlagIfSupported('-Wno-noexcept-type') self.cxx.addWarningFlagIfSupported('-Wno-aligned-allocation-unavailable') # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. self.cxx.addWarningFlagIfSupported('-Wsign-compare') self.cxx.addWarningFlagIfSupported('-Wunused-variable') self.cxx.addWarningFlagIfSupported('-Wunused-parameter') self.cxx.addWarningFlagIfSupported('-Wunreachable-code') # FIXME: Enable the two warnings below. self.cxx.addWarningFlagIfSupported('-Wno-conversion') self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef') std = self.get_lit_conf('std', None) if std in ['c++98', 'c++03']: # The '#define static_assert' provided by libc++ in C++03 mode # causes an unused local typedef whenever it is used. self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef') def configure_sanitizer(self): san = self.get_lit_conf('use_sanitizer', '').strip() if san: self.target_info.add_sanitizer_features(san, self.config.available_features) # Search for llvm-symbolizer along the compiler path first # and then along the PATH env variable. symbolizer_search_paths = os.environ.get('PATH', '') cxx_path = libcxx.util.which(self.cxx.path) if cxx_path is not None: symbolizer_search_paths = ( os.path.dirname(cxx_path) + os.pathsep + symbolizer_search_paths) llvm_symbolizer = libcxx.util.which('llvm-symbolizer', symbolizer_search_paths) def add_ubsan(): self.cxx.flags += ['-fsanitize=undefined', '-fno-sanitize=vptr,function,float-divide-by-zero', '-fno-sanitize-recover=all'] self.exec_env['UBSAN_OPTIONS'] = 'print_stacktrace=1' self.config.available_features.add('ubsan') # Setup the sanitizer compile flags self.cxx.flags += ['-g', '-fno-omit-frame-pointer'] if san == 'Address' or san == 'Address;Undefined' or san == 'Undefined;Address': self.cxx.flags += ['-fsanitize=address'] if llvm_symbolizer is not None: self.exec_env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer # FIXME: Turn ODR violation back on after PR28391 is resolved # https://bugs.llvm.org/show_bug.cgi?id=28391 self.exec_env['ASAN_OPTIONS'] = 'detect_odr_violation=0' self.config.available_features.add('asan') self.config.available_features.add('sanitizer-new-delete') self.cxx.compile_flags += ['-O1'] if san == 'Address;Undefined' or san == 'Undefined;Address': add_ubsan() elif san == 'Memory' or san == 'MemoryWithOrigins': self.cxx.flags += ['-fsanitize=memory'] if san == 'MemoryWithOrigins': self.cxx.compile_flags += [ '-fsanitize-memory-track-origins'] if llvm_symbolizer is not None: self.exec_env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer self.config.available_features.add('msan') self.config.available_features.add('sanitizer-new-delete') self.cxx.compile_flags += ['-O1'] elif san == 'Undefined': add_ubsan() self.cxx.compile_flags += ['-O2'] elif san == 'Thread': self.cxx.flags += ['-fsanitize=thread'] self.config.available_features.add('tsan') self.config.available_features.add('sanitizer-new-delete') else: self.lit_config.fatal('unsupported value for ' 'use_sanitizer: {0}'.format(san)) san_lib = self.get_lit_conf('sanitizer_library') if san_lib: self.cxx.link_flags += [ san_lib, '-Wl,-rpath,%s' % os.path.dirname(san_lib)] def configure_coverage(self): self.generate_coverage = self.get_lit_bool('generate_coverage', False) if self.generate_coverage: self.cxx.flags += ['-g', '--coverage'] self.cxx.compile_flags += ['-O0'] def configure_coroutines(self): if self.cxx.hasCompileFlag('-fcoroutines-ts'): macros = self._dump_macros_verbose(flags=['-fcoroutines-ts']) if '__cpp_coroutines' not in macros: self.lit_config.warning('-fcoroutines-ts is supported but ' '__cpp_coroutines is not defined') # Consider coroutines supported only when the feature test macro # reflects a recent value. if intMacroValue(macros['__cpp_coroutines']) >= 201703: self.config.available_features.add('fcoroutines-ts') def configure_modules(self): modules_flags = ['-fmodules'] if platform.system() != 'Darwin': modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility'] supports_modules = self.cxx.hasCompileFlag(modules_flags) enable_modules = self.get_modules_enabled() if enable_modules and not supports_modules: self.lit_config.fatal( '-fmodules is enabled but not supported by the compiler') if not supports_modules: return self.config.available_features.add('modules-support') module_cache = os.path.join(self.config.test_exec_root, 'modules.cache') module_cache = os.path.realpath(module_cache) if os.path.isdir(module_cache): shutil.rmtree(module_cache) os.makedirs(module_cache) self.cxx.modules_flags = modules_flags + \ ['-fmodules-cache-path=' + module_cache] if enable_modules: self.config.available_features.add('-fmodules') self.cxx.useModules() def configure_substitutions(self): sub = self.config.substitutions cxx_path = pipes.quote(self.cxx.path) # Configure compiler substitutions sub.append(('%cxx', cxx_path)) sub.append(('%libcxx_src_root', self.libcxx_src_root)) # Configure flags substitutions flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags]) compile_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.compile_flags]) link_flags_str = ' '.join([pipes.quote(f) for f in self.cxx.link_flags]) all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str) sub.append(('%flags', flags_str)) sub.append(('%compile_flags', compile_flags_str)) sub.append(('%link_flags', link_flags_str)) sub.append(('%all_flags', all_flags)) if self.cxx.isVerifySupported(): verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' ' sub.append(('%verify', verify_str)) # Add compile and link shortcuts compile_str = (cxx_path + ' -o %t.o %s -c ' + flags_str + ' ' + compile_flags_str) link_str = (cxx_path + ' -o %t.exe %t.o ' + flags_str + ' ' + link_flags_str) assert type(link_str) is str build_str = cxx_path + ' -o %t.exe %s ' + all_flags if self.cxx.use_modules: sub.append(('%compile_module', compile_str)) sub.append(('%build_module', build_str)) elif self.cxx.modules_flags is not None: modules_str = ' '.join(self.cxx.modules_flags) + ' ' sub.append(('%compile_module', compile_str + ' ' + modules_str)) sub.append(('%build_module', build_str + ' ' + modules_str)) sub.append(('%compile', compile_str)) sub.append(('%link', link_str)) sub.append(('%build', build_str)) # Configure exec prefix substitutions. # Configure run env substitution. sub.append(('%run', '%t.exe')) # Configure not program substitutions not_py = os.path.join(self.libcxx_src_root, 'utils', 'not.py') not_str = '%s %s ' % (pipes.quote(sys.executable), pipes.quote(not_py)) sub.append(('not ', not_str)) def can_use_deployment(self): # Check if the host is on an Apple platform using clang. if not self.target_info.platform() == "darwin": return False if not self.target_info.is_host_macosx(): return False if not self.cxx.type.endswith('clang'): return False return True def configure_triple(self): # Get or infer the target triple. target_triple = self.get_lit_conf('target_triple') self.use_target = self.get_lit_bool('use_target', False) if self.use_target and target_triple: self.lit_config.warning('use_target is true but no triple is specified') # Use deployment if possible. self.use_deployment = not self.use_target and self.can_use_deployment() if self.use_deployment: return # Save the triple (and warn on Apple platforms). self.config.target_triple = target_triple if self.use_target and 'apple' in target_triple: self.lit_config.warning('consider using arch and platform instead' ' of target_triple on Apple platforms') # If no target triple was given, try to infer it from the compiler # under test. if not self.config.target_triple: target_triple = self.cxx.getTriple() # Drop sub-major version components from the triple, because the # current XFAIL handling expects exact matches for feature checks. # Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14 # The 5th group handles triples greater than 3 parts # (ex x86_64-pc-linux-gnu). target_triple = re.sub(r'([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)', r'\1-\2-\3\5', target_triple) # linux-gnu is needed in the triple to properly identify linuxes # that use GLIBC. Handle redhat and opensuse triples as special # cases and append the missing `-gnu` portion. if (target_triple.endswith('redhat-linux') or target_triple.endswith('suse-linux')): target_triple += '-gnu' self.config.target_triple = target_triple self.lit_config.note( "inferred target_triple as: %r" % self.config.target_triple) def configure_deployment(self): assert not self.use_deployment is None assert not self.use_target is None if not self.use_deployment: # Warn about ignored parameters. if self.get_lit_conf('arch'): self.lit_config.warning('ignoring arch, using target_triple') if self.get_lit_conf('platform'): self.lit_config.warning('ignoring platform, using target_triple') return assert not self.use_target assert self.target_info.is_host_macosx() # Always specify deployment explicitly on Apple platforms, since # otherwise a platform is picked up from the SDK. If the SDK version # doesn't match the system version, tests that use the system library # may fail spuriously. arch = self.get_lit_conf('arch') if not arch: arch = self.cxx.getTriple().split('-', 1)[0] self.lit_config.note("inferred arch as: %r" % arch) inferred_platform, name, version = self.target_info.get_platform() if inferred_platform: self.lit_config.note("inferred platform as: %r" % (name + version)) self.config.deployment = (arch, name, version) # Set the target triple for use by lit. self.config.target_triple = arch + '-apple-' + name + version self.lit_config.note( "computed target_triple as: %r" % self.config.target_triple) def configure_env(self): self.target_info.configure_env(self.exec_env) def add_path(self, dest_env, new_path): if 'PATH' not in dest_env: dest_env['PATH'] = new_path else: split_char = ';' if self.is_windows else ':' dest_env['PATH'] = '%s%s%s' % (new_path, split_char, dest_env['PATH'])