Merge to upstream r297772. am: b9e7f084bd

am: fabe890b75

Change-Id: I84b59f55a5e26cda1cb10d992f7ed0093c97df71
This commit is contained in:
Dan Albert
2017-03-20 18:45:32 +00:00
committed by android-build-merger
389 changed files with 6551 additions and 4842 deletions

View File

@@ -19,7 +19,6 @@ set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH}
) )
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(libcxx CXX C) project(libcxx CXX C)
@@ -58,9 +57,10 @@ endif()
# Setup CMake Options # Setup CMake Options
#=============================================================================== #===============================================================================
include(CMakeDependentOption) include(CMakeDependentOption)
include(HandleCompilerRT)
# Basic options --------------------------------------------------------------- # Basic options ---------------------------------------------------------------
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) 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_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON)
@@ -107,15 +107,6 @@ set(LIBCXX_CXX_ABI "default" CACHE STRING
set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++ vcruntime) set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++ vcruntime)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS}) set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
# FIXME: This is a temporary hack to force LLVM buildbots to store
# the fixed cache entry instead of the previous cache entry. This is needed
# because some LLVM buildbots don't clear their cache. It will be removed
# once all LLVM bots have been run.
if (LIBCXX_CXX_ABI STREQUAL "")
set(LIBCXX_CXX_ABI "default" CACHE STRING
"Specify the C++ ABI library to use." FORCE)
endif()
# Setup the default options if LIBCXX_CXX_ABI is not specified. # Setup the default options if LIBCXX_CXX_ABI is not specified.
if (LIBCXX_CXX_ABI STREQUAL "default") if (LIBCXX_CXX_ABI STREQUAL "default")
find_path( find_path(
@@ -134,6 +125,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
if (LIBCXX_TARGETING_MSVC) if (LIBCXX_TARGETING_MSVC)
# FIXME: Figure out how to configure the ABI library on Windows. # FIXME: Figure out how to configure the ABI library on Windows.
set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") set(LIBCXX_CXX_ABI_LIBNAME "vcruntime")
elseif(APPLE)
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
set(LIBCXX_CXX_ABI_SYSTEM 1)
else() else()
set(LIBCXX_CXX_ABI_LIBNAME "default") set(LIBCXX_CXX_ABI_LIBNAME "default")
endif() endif()
@@ -164,9 +158,25 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
"Use and install a linker script for the given ABI library" "Use and install a linker script for the given ABI library"
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE}) ${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 to due 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 # Build libc++abi with libunwind. We need this option to determine whether to
# link with libunwind or libgcc_s while running the test cases. # 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_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)
# Target options -------------------------------------------------------------- # Target options --------------------------------------------------------------
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS}) option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
@@ -439,6 +449,10 @@ add_compile_flags_if_supported(-fvisibility-inlines-hidden)
# library. # library.
add_definitions(-D_LIBCPP_BUILDING_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 =============================================================== # Warning flags ===============================================================
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
add_compile_flags_if_supported( add_compile_flags_if_supported(
@@ -501,6 +515,7 @@ endif()
# Assertion flags ============================================================= # Assertion flags =============================================================
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG) define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG) define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0)
define_if(LIBCXX_DEBUG_BUILD -D_DEBUG) define_if(LIBCXX_DEBUG_BUILD -D_DEBUG)
if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD) if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD)
# MSVC doesn't like _DEBUG on release builds. See PR 4379. # MSVC doesn't like _DEBUG on release builds. See PR 4379.
@@ -604,10 +619,15 @@ add_subdirectory(lib)
if (LIBCXX_INCLUDE_BENCHMARKS) if (LIBCXX_INCLUDE_BENCHMARKS)
add_subdirectory(benchmarks) add_subdirectory(benchmarks)
endif() 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.
add_subdirectory(test)
if (LIBCXX_INCLUDE_TESTS) if (LIBCXX_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(lib/abi) add_subdirectory(lib/abi)
endif() endif()
if (LIBCXX_INCLUDE_DOCS) if (LIBCXX_INCLUDE_DOCS)
add_subdirectory(docs) add_subdirectory(docs)
endif() endif()

View File

@@ -81,7 +81,7 @@ E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes. D: Minor patches and Linux fixes.
N: Michael Park N: Michael Park
E: mpark@apache.org E: mcypark@gmail.com
D: Implementation of <variant>. D: Implementation of <variant>.
N: Arvid Picciani N: Arvid Picciani

View File

@@ -17,6 +17,56 @@ Test Suite Tasks
* Improve the quality and portability of the locale test data. * Improve the quality and portability of the locale test data.
* Convert failure tests to use Clang Verify. * Convert failure tests to use Clang Verify.
Filesystem Tasks
================
* P0492r2 - Implement National body comments for Filesystem
* INCOMPLETE - US 25: has_filename() is equivalent to just !empty()
* INCOMPLETE - US 31: Everything is defined in terms of one implicit host system
* INCOMPLETE - US 32: Meaning of 27.10.2.1 unclear
* INCOMPLETE - US 33: Definition of canonical path problematic
* INCOMPLETE - US 34: Are there attributes of a file that are not an aspect of the file system?
* INCOMPLETE - US 35: What synchronization is required to avoid a file system race?
* INCOMPLETE - US 36: Symbolic links themselves are attached to a directory via (hard) links
* INCOMPLETE - US 37: The term “redundant current directory (dot) elements” is not defined
* INCOMPLETE - US 38: Duplicates §17.3.16
* INCOMPLETE - US 39: Remove note: Dot and dot-dot are not directories
* INCOMPLETE - US 40: Not all directories have a parent.
* INCOMPLETE - US 41: The term “parent directory” for a (non-directory) file is unusual
* INCOMPLETE - US 42: Pathname resolution does not always resolve a symlink
* INCOMPLETE - US 43: Concerns about encoded character types
* INCOMPLETE - US 44: Definition of path in terms of a string requires leaky abstraction
* INCOMPLETE - US 45: Generic format portability compromised by unspecified root-name
* INCOMPLETE - US 46: filename can be empty so productions for relative-path are redundant
* INCOMPLETE - US 47: “.” and “..” already match the name production
* INCOMPLETE - US 48: Multiple separators are often meaningful in a root-name
* INCOMPLETE - US 49: What does “method of conversion method” mean?
* INCOMPLETE - US 50: 27.10.8.1 ¶ 1.4 largely redundant with ¶ 1.3
* INCOMPLETE - US 51: Failing to add / when appending empty string prevents useful apps
* INCOMPLETE - US 52: remove_filename() postcondition is not by itself a definition
* INCOMPLETE - US 53: remove_filename()'s name does not correspond to its behavior
* INCOMPLETE - US 54: remove_filename() is broken
* INCOMPLETE - US 55: replace_extension()'s use of path as parameter is inappropriate
* INCOMPLETE - US 56: Remove replace_extension()'s conditional addition of period
* INCOMPLETE - US 57: On Windows, absolute paths will sort in among relative paths
* INCOMPLETE - US 58: parent_path() behavior for root paths is useless
* INCOMPLETE - US 59: filename() returning path for single path components is bizarre
* INCOMPLETE - US 60: path("/foo/").filename()==path(".") is surprising
* INCOMPLETE - US 61: Leading dots in filename() should not begin an extension
* INCOMPLETE - US 62: It is important that stem()+extension()==filename()
* INCOMPLETE - US 63: lexically_normal() inconsistently treats trailing "/" but not "/.." as directory
* INCOMPLETE - US 73, CA 2: root-name is effectively implementation defined
* INCOMPLETE - US 74, CA 3: The term “pathname” is ambiguous in some contexts
* INCOMPLETE - US 75, CA 4: Extra flag in path constructors is needed
* INCOMPLETE - US 76, CA 5: root-name definition is over-specified.
* INCOMPLETE - US 77, CA 6: operator/ and other appends not useful if arg has root-name
* INCOMPLETE - US 78, CA 7: Member absolute() in 27.10.4.1 is overspecified for non-POSIX-like O/S
* INCOMPLETE - US 79, CA 8: Some operation functions are overspecified for implementation-defined file types
* INCOMPLETE - US 185: Fold error_code and non-error_code signatures into one signature
* INCOMPLETE - FI 14: directory_entry comparisons are members
* INCOMPLETE - Late 36: permissions() error_code overload should be noexcept
* INCOMPLETE - Late 37: permissions() actions should be separate parameter
* INCOMPLETE - Late 42: resize_file() Postcondition missing argument
Misc Tasks Misc Tasks
========== ==========
* Find all sequences of >2 underscores and eradicate them. * Find all sequences of >2 underscores and eradicate them.

View File

@@ -3,6 +3,11 @@ if (NOT CODE_COVERAGE_LCOV)
message(FATAL_ERROR "Cannot find lcov...") message(FATAL_ERROR "Cannot find lcov...")
endif() endif()
find_program(CODE_COVERAGE_LLVM_COV llvm-cov)
if (NOT CODE_COVERAGE_LLVM_COV)
message(FATAL_ERROR "Cannot find llvm-cov...")
endif()
find_program(CODE_COVERAGE_GENHTML genhtml) find_program(CODE_COVERAGE_GENHTML genhtml)
if (NOT CODE_COVERAGE_GENHTML) if (NOT CODE_COVERAGE_GENHTML)
message(FATAL_ERROR "Cannot find genhtml...") message(FATAL_ERROR "Cannot find genhtml...")
@@ -11,6 +16,14 @@ endif()
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage") set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs) function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
if (NOT DEFINED LIBCXX_BINARY_DIR)
message(FATAL_ERROR "Variable must be set")
endif()
set(GCOV_TOOL "${LIBCXX_BINARY_DIR}/llvm-cov-wrapper")
file(GENERATE OUTPUT ${GCOV_TOOL}
CONTENT "#!/usr/bin/env bash\n${CODE_COVERAGE_LLVM_COV} gcov \"$@\"\n")
file(MAKE_DIRECTORY ${output_dir}) file(MAKE_DIRECTORY ${output_dir})
set(CAPTURE_DIRS "") set(CAPTURE_DIRS "")
@@ -27,8 +40,9 @@ function(setup_lcov_test_target_coverage target_name output_dir capture_dirs sou
message(STATUS "Extract Directories: ${EXTRACT_DIRS}") message(STATUS "Extract Directories: ${EXTRACT_DIRS}")
add_custom_target(generate-lib${target_name}-coverage add_custom_target(generate-lib${target_name}-coverage
COMMAND ${CODE_COVERAGE_LCOV} --capture ${CAPTURE_DIRS} -o test_coverage.info COMMAND chmod +x ${GCOV_TOOL}
COMMAND ${CODE_COVERAGE_LCOV} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --capture ${CAPTURE_DIRS} -o test_coverage.info
COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
WORKING_DIRECTORY ${output_dir} WORKING_DIRECTORY ${output_dir}

View File

@@ -0,0 +1,55 @@
function(find_compiler_rt_library name dest)
if (NOT DEFINED LIBCXX_COMPILE_FLAGS)
message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function")
endif()
set(dest "" PARENT_SCOPE)
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
"--rtlib=compiler-rt" "--print-libgcc-file-name")
execute_process(
COMMAND ${CLANG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE LIBRARY_FILE
)
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
set(${dest} "${LIBRARY_FILE}" PARENT_SCOPE)
else()
message(STATUS "Failed to find compiler-rt library")
endif()
endfunction()
function(find_compiler_rt_dir dest)
if (NOT DEFINED LIBCXX_COMPILE_FLAGS)
message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function")
endif()
set(dest "" PARENT_SCOPE)
if (APPLE)
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
"-print-file-name=lib")
execute_process(
COMMAND ${CLANG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE LIBRARY_DIR
)
string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
else()
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
"--rtlib=compiler-rt" "--print-libgcc-file-name")
execute_process(
COMMAND ${CLANG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE LIBRARY_FILE
)
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
endif()
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")
message(STATUS "Found compiler-rt directory: ${LIBRARY_DIR}")
set(${dest} "${LIBRARY_DIR}" PARENT_SCOPE)
else()
message(STATUS "Failed to find compiler-rt directory")
endif()
endfunction()

View File

@@ -103,9 +103,11 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
# Assume c++abi is installed in the system, rely on -lc++abi link flag. # Assume c++abi is installed in the system, rely on -lc++abi link flag.
set(CXXABI_LIBNAME "c++abi") set(CXXABI_LIBNAME "c++abi")
endif() endif()
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI" set(HEADERS "cxxabi.h;__cxxabi_config.h")
${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" "" if (LIBCXX_CXX_ABI_SYSTEM)
) set(HEADERS "")
endif()
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI" ${CXXABI_LIBNAME} "${HEADERS}" "")
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt") elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
setup_abi_lib("-DLIBCXXRT" setup_abi_lib("-DLIBCXXRT"
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" "" "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""

View File

@@ -92,6 +92,57 @@ build would look like this:
$ make check-libcxx # optional $ 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-c ^
-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/ .. _`libc++abi`: http://libcxxabi.llvm.org/

View File

@@ -3,7 +3,7 @@ Debug Mode
========== ==========
.. contents:: .. contents::
:local :local:
.. _using-debug-mode: .. _using-debug-mode:

View File

@@ -47,18 +47,17 @@ Visibility Macros
A synonym for `_LIBCPP_INLINE_VISIBILITY` A synonym for `_LIBCPP_INLINE_VISIBILITY`
**_LIBCPP_TYPE_VIS** **_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. Mark a type's typeinfo and vtable as having default visibility.
`_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the This macro has no effect on the visibility of the type's member functions.
type's member functions. This attribute cannot be used on class templates.
**GCC Behavior**: GCC does not support Clang's `type_visibility(...)` **GCC Behavior**: GCC does not support Clang's `type_visibility(...)`
attribute. With GCC the `visibility(...)` attribute is used and member attribute. With GCC the `visibility(...)` attribute is used and member
functions are affected. functions are affected.
**_LIBCPP_TEMPLATE_VIS**
The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class
templates.
**Windows Behavior**: DLLs do not support dllimport/export on class templates. **Windows Behavior**: DLLs do not support dllimport/export on class templates.
The macro has an empty definition on this platform. The macro has an empty definition on this platform.
@@ -110,6 +109,35 @@ Visibility Macros
the extern template declaration) as exported on Windows, as discussed above. the extern template declaration) as exported on Windows, as discussed above.
On all other platforms, this macro has an empty definition. 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 <https://github.com/smeenai/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** **_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY**
Mark a member function of a class template as visible and always inline. This 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 macro should only be applied to member functions of class templates that are

View File

@@ -180,3 +180,15 @@ thread safety annotations.
* Giving `set`, `map`, `multiset`, `multimap` a comparator which is not * Giving `set`, `map`, `multiset`, `multimap` a comparator which is not
const callable. const callable.
C++17 Specific Configuration Macros
-----------------------------------
**_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES**:
This macro is used to re-enable all the features removed in C++17. The effect
is equivalent to manually defining each macro listed below.
**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**:
This macro is used to re-enable the `set_unexpected`, `get_unexpected`, and
`unexpected` functions, which were removed in C++17.
**_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR**:
This macro is used to re-enable `std::auto_ptr` in C++17.

View File

@@ -120,7 +120,7 @@ This list contains known issues with libc++
A full list of currently open libc++ bugs can be `found here`__. A full list of currently open libc++ bugs can be `found here`__.
.. __: https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184 .. __: https://bugs.llvm.org/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
Design Documents Design Documents
---------------- ----------------
@@ -180,7 +180,7 @@ Quick Links
=========== ===========
* `LLVM Homepage <http://llvm.org/>`_ * `LLVM Homepage <http://llvm.org/>`_
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_ * `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
* `LLVM Bugzilla <http://llvm.org/bugs/>`_ * `LLVM Bugzilla <https://bugs.llvm.org/>`_
* `cfe-commits Mailing List`_ * `cfe-commits Mailing List`_
* `cfe-dev Mailing List`_ * `cfe-dev Mailing List`_
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_ * `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_

View File

@@ -12,8 +12,10 @@
#define _LIBCPP_CONFIG #define _LIBCPP_CONFIG
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#endif #endif
#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header #pragma GCC system_header
@@ -480,14 +482,13 @@ namespace std {
#endif // __GXX_EXPERIMENTAL_CXX0X__ #endif // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } } #define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE #define _VSTD std::_LIBCPP_NAMESPACE
namespace std { namespace std {
namespace _LIBCPP_NAMESPACE { inline namespace _LIBCPP_NAMESPACE {
} }
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
} }
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
@@ -590,6 +591,7 @@ namespace std {
#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS #define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
#define _LIBCPP_HIDDEN #define _LIBCPP_HIDDEN
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
#define _LIBCPP_TEMPLATE_VIS #define _LIBCPP_TEMPLATE_VIS
#define _LIBCPP_FUNC_VIS_ONLY #define _LIBCPP_FUNC_VIS_ONLY
#define _LIBCPP_ENUM_VIS #define _LIBCPP_ENUM_VIS
@@ -613,6 +615,15 @@ namespace std {
#endif #endif
#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 #ifndef _LIBCPP_FUNC_VIS
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
@@ -623,18 +634,22 @@ namespace std {
#ifndef _LIBCPP_TYPE_VIS #ifndef _LIBCPP_TYPE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
# if __has_attribute(__type_visibility__)
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
# else
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
# endif
# else # else
# define _LIBCPP_TYPE_VIS # define _LIBCPP_TYPE_VIS
# endif # endif
#endif #endif
#ifndef _LIBCPP_TEMPLATE_VIS #ifndef _LIBCPP_TEMPLATE_VIS
# define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_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 #endif
#ifndef _LIBCPP_FUNC_VIS_ONLY #ifndef _LIBCPP_FUNC_VIS_ONLY
@@ -667,7 +682,7 @@ namespace std {
#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default"))) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
# else # else
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
# endif # endif
@@ -815,7 +830,9 @@ template <unsigned> struct __static_assert_check {};
# else # else
# error Supported values for _LIBCPP_DEBUG are 0 and 1 # error Supported values for _LIBCPP_DEBUG are 0 and 1
# endif # endif
# if !defined(_LIBCPP_BUILDING_LIBRARY)
# define _LIBCPP_EXTERN_TEMPLATE(...) # define _LIBCPP_EXTERN_TEMPLATE(...)
# endif
#endif #endif
#ifndef _LIBCPP_EXTERN_TEMPLATE #ifndef _LIBCPP_EXTERN_TEMPLATE
@@ -925,7 +942,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI # define _LIBCPP_NO_RTTI
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI) # elif defined(_LIBCPP_MSVC) && !defined(_CPPRTTI)
# define _LIBCPP_NO_RTTI # define _LIBCPP_NO_RTTI
# endif # endif
#endif #endif
@@ -936,7 +953,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
// Thread API // Thread API
#if !defined(_LIBCPP_HAS_NO_THREADS) && \ #if !defined(_LIBCPP_HAS_NO_THREADS) && \
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD) !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
# if defined(__FreeBSD__) || \ # if defined(__FreeBSD__) || \
defined(__Fuchsia__) || \ defined(__Fuchsia__) || \
defined(__NetBSD__) || \ defined(__NetBSD__) || \
@@ -958,7 +976,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#endif #endif
#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
# error _LIBCPP_HAS_EXTERNAL_THREAD_API may not be defined when \ # error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
_LIBCPP_HAS_NO_THREADS is defined. _LIBCPP_HAS_NO_THREADS is defined.
#endif #endif
@@ -1008,10 +1026,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#endif #endif
#if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \ #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
&& __has_attribute(acquire_capability)) #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 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
#endif #endif
#endif
#endif
#if __has_attribute(require_constant_initialization) #if __has_attribute(require_constant_initialization)
#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
@@ -1046,6 +1070,11 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_DECLSPEC_EMPTY_BASES # define _LIBCPP_DECLSPEC_EMPTY_BASES
#endif #endif
#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#endif // __cplusplus #endif // __cplusplus
#endif // _LIBCPP_CONFIG #endif // _LIBCPP_CONFIG

View File

@@ -871,11 +871,19 @@ public:
template <class _Key, class _Hash, class _Equal, class _Alloc> template <class _Key, class _Hash, class _Equal, class _Alloc>
struct __diagnose_hash_table_helper { struct __diagnose_hash_table_helper {
static constexpr bool __trigger_diagnostics() static constexpr bool __trigger_diagnostics()
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value, _LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key, _Hash>::value
&& !__invokable<_Hash const&, _Key const&>::value,
"the specified hash functor does not provide a const call operator") "the specified hash functor does not provide a const call operator")
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value, _LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
&& !__invokable<_Equal const&, _Key const&, _Key const&>::value,
"the specified comparator type does not provide a const call operator") "the specified comparator type does not provide a const call operator")
{ return true; } {
static_assert(__check_hash_requirements<_Key, _Hash>::value,
"the specified hash does not meet the Hash requirements");
static_assert(is_copy_constructible<_Equal>::value,
"the specified comparator is required to be copy constructible");
return true;
}
}; };
template <class _Key, class _Value, class _Hash, class _Equal, class _Alloc> template <class _Key, class _Value, class _Hash, class _Equal, class _Alloc>
@@ -951,6 +959,10 @@ private:
typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits; typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
typedef typename __bucket_list_deleter::pointer __node_pointer_pointer; typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
#ifndef _LIBCPP_CXX03_LANG
static_assert(__diagnose_hash_table_helper<_Tp, _Hash, _Equal, _Alloc>::__trigger_diagnostics(), "");
#endif
// --- Member data begin --- // --- Member data begin ---
__bucket_list __bucket_list_; __bucket_list __bucket_list_;
__compressed_pair<__first_node, __node_allocator> __p1_; __compressed_pair<__first_node, __node_allocator> __p1_;
@@ -1482,13 +1494,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
{ {
#if defined(_LIBCPP_CXX03_LANG)
static_assert((is_copy_constructible<key_equal>::value), static_assert((is_copy_constructible<key_equal>::value),
"Predicate must be copy-constructible."); "Predicate must be copy-constructible.");
static_assert((is_copy_constructible<hasher>::value), static_assert((is_copy_constructible<hasher>::value),
"Hasher must be copy-constructible."); "Hasher must be copy-constructible.");
#ifndef _LIBCPP_CXX03_LANG
static_assert(__diagnose_hash_table_helper<_Tp, _Hash, _Equal, _Alloc>::__trigger_diagnostics(), "");
#endif #endif
__deallocate_node(__p1_.first().__next_); __deallocate_node(__p1_.first().__next_);
#if _LIBCPP_DEBUG_LEVEL >= 2 #if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__erase_c(this); __get_db()->__erase_c(this);

View File

@@ -92,13 +92,16 @@ public:
const locale& operator=(const locale&) _NOEXCEPT; const locale& operator=(const locale&) _NOEXCEPT;
template <class _Facet> locale combine(const locale&) const; template <class _Facet>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
locale combine(const locale&) const;
// locale operations: // locale operations:
string name() const; string name() const;
bool operator==(const locale&) const; bool operator==(const locale&) const;
bool operator!=(const locale& __y) const {return !(*this == __y);} bool operator!=(const locale& __y) const {return !(*this == __y);}
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
const basic_string<_CharT, _Traits, _Allocator>&) const; const basic_string<_CharT, _Traits, _Allocator>&) const;

View File

@@ -316,20 +316,24 @@ public:
void wait(unique_lock<mutex>& __lk) _NOEXCEPT; void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
template <class _Predicate> template <class _Predicate>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
void wait(unique_lock<mutex>& __lk, _Predicate __pred); void wait(unique_lock<mutex>& __lk, _Predicate __pred);
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status cv_status
wait_until(unique_lock<mutex>& __lk, wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t); const chrono::time_point<_Clock, _Duration>& __t);
template <class _Clock, class _Duration, class _Predicate> template <class _Clock, class _Duration, class _Predicate>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool bool
wait_until(unique_lock<mutex>& __lk, wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t, const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred); _Predicate __pred);
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status cv_status
wait_for(unique_lock<mutex>& __lk, wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d); const chrono::duration<_Rep, _Period>& __d);

View File

@@ -12,6 +12,8 @@
#define _LIBCPP_THREADING_SUPPORT #define _LIBCPP_THREADING_SUPPORT
#include <__config> #include <__config>
#include <chrono>
#include <errno.h>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header #pragma GCC system_header
@@ -25,12 +27,9 @@
# include <pthread.h> # include <pthread.h>
# include <sched.h> # include <sched.h>
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32) #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
#include <assert.h>
#include <Windows.h> #include <Windows.h>
#include <process.h> #include <process.h>
#include <fibersapi.h> #include <fibersapi.h>
#include <chrono>
#endif #endif
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
@@ -184,6 +183,9 @@ int __libcpp_thread_detach(__libcpp_thread_t *__t);
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_THREAD_ABI_VISIBILITY
void __libcpp_thread_yield(); void __libcpp_thread_yield();
_LIBCPP_THREAD_ABI_VISIBILITY
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
// Thread local storage // Thread local storage
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_tls_create(__libcpp_tls_key* __key, int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -346,6 +348,28 @@ void __libcpp_thread_yield()
sched_yield(); sched_yield();
} }
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
{
using namespace chrono;
seconds __s = duration_cast<seconds>(__ns);
timespec __ts;
typedef decltype(__ts.tv_sec) ts_sec;
_LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
if (__s.count() < __ts_sec_max)
{
__ts.tv_sec = static_cast<ts_sec>(__s.count());
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
}
else
{
__ts.tv_sec = __ts_sec_max;
__ts.tv_nsec = 999999999; // (10^9 - 1)
}
while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
}
// Thread local storage // Thread local storage
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *)) int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
{ {
@@ -563,6 +587,16 @@ void __libcpp_thread_yield()
SwitchToThread(); SwitchToThread();
} }
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
{
using namespace chrono;
// round-up to the nearest milisecond
milliseconds __ms =
duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
// FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx)
Sleep(__ms.count());
}
// Thread Local Storage // Thread Local Storage
int __libcpp_tls_create(__libcpp_tls_key* __key, int __libcpp_tls_create(__libcpp_tls_key* __key,
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)) void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))

View File

@@ -17,6 +17,8 @@
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif

View File

@@ -10,7 +10,7 @@
#ifdef min #ifdef min
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
#if defined(_MSC_VER) && ! defined(__clang__) #if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing min") "before any Windows header. #undefing min")
#else #else
@@ -22,7 +22,7 @@ _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
#ifdef max #ifdef max
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
#if defined(_MSC_VER) && ! defined(__clang__) #if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " _LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing max") "before any Windows header. #undefing max")
#else #else

View File

@@ -398,7 +398,7 @@ using ::cbrtf;
using ::copysign; using ::copysign;
using ::copysignf; using ::copysignf;
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
using ::erf; using ::erf;
using ::erff; using ::erff;
using ::erfc; using ::erfc;
@@ -435,12 +435,12 @@ using ::lrint;
using ::lrintf; using ::lrintf;
using ::lround; using ::lround;
using ::lroundf; using ::lroundf;
#endif // _LIBCPP_MSVCRT #endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
using ::nan; using ::nan;
using ::nanf; using ::nanf;
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
using ::nearbyint; using ::nearbyint;
using ::nearbyintf; using ::nearbyintf;
using ::nextafter; using ::nextafter;
@@ -463,7 +463,7 @@ using ::tgamma;
using ::tgammaf; using ::tgammaf;
using ::trunc; using ::trunc;
using ::truncf; using ::truncf;
#endif // !_LIBCPP_MSVCRT #endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
using ::acosl; using ::acosl;
using ::asinl; using ::asinl;
@@ -495,7 +495,7 @@ using ::cbrtl;
using ::copysignl; using ::copysignl;
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
using ::erfl; using ::erfl;
using ::erfcl; using ::erfcl;
using ::exp2l; using ::exp2l;
@@ -526,7 +526,7 @@ using ::scalblnl;
using ::scalbnl; using ::scalbnl;
using ::tgammal; using ::tgammal;
using ::truncl; using ::truncl;
#endif // !_LIBCPP_MSVCRT #endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
#if _LIBCPP_STD_VER > 14 #if _LIBCPP_STD_VER > 14
inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); } inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); }

View File

@@ -133,12 +133,14 @@ public:
void notify_all() _NOEXCEPT; void notify_all() _NOEXCEPT;
template <class _Lock> template <class _Lock>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
void wait(_Lock& __lock); void wait(_Lock& __lock);
template <class _Lock, class _Predicate> template <class _Lock, class _Predicate>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void wait(_Lock& __lock, _Predicate __pred); void wait(_Lock& __lock, _Predicate __pred);
template <class _Lock, class _Clock, class _Duration> template <class _Lock, class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status cv_status
wait_until(_Lock& __lock, wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t); const chrono::time_point<_Clock, _Duration>& __t);

View File

@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t; using ::ptrdiff_t;
using ::size_t; using ::size_t;
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
defined(__DEFINED_max_align_t)
// Re-use the compiler's <stddef.h> max_align_t where possible. // Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t; using ::max_align_t;
#else #else

View File

@@ -82,6 +82,10 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstdlib> #include <cstdlib>
#include <type_traits> #include <type_traits>
#if defined(_LIBCPP_ABI_MICROSOFT)
#include <vcruntime_exception.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif
@@ -89,6 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
#if !defined(_LIBCPP_ABI_MICROSOFT)
class _LIBCPP_EXCEPTION_ABI exception class _LIBCPP_EXCEPTION_ABI exception
{ {
public: public:
@@ -105,11 +110,16 @@ public:
virtual ~bad_exception() _NOEXCEPT; virtual ~bad_exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT; virtual const char* what() const _NOEXCEPT;
}; };
#endif // !_LIBCPP_ABI_MICROSOFT
#if _LIBCPP_STD_VER <= 14 \
|| defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
|| defined(_LIBCPP_BUILDING_LIBRARY)
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT; _LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected(); _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
#endif
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT; _LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
@@ -238,12 +248,17 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif #endif
} }
template <class _From, class _To>
struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT(
is_polymorphic<_From>::value &&
(!is_base_of<_To, _From>::value ||
is_convertible<const _From*, const _To*>::value)) {};
template <class _Ep> template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep& __e, typename enable_if< rethrow_if_nested(const _Ep& __e,
is_polymorphic<_Ep>::value typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
>::type* = 0)
{ {
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e)); const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep) if (__nep)
@@ -253,9 +268,8 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
template <class _Ep> template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep&, typename enable_if< rethrow_if_nested(const _Ep&,
!is_polymorphic<_Ep>::value typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
>::type* = 0)
{ {
} }

View File

@@ -408,7 +408,9 @@ class _LIBCPP_TYPE_VIS file_status
public: public:
// constructors // constructors
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit file_status(file_type __ft = file_type::none, file_status() _NOEXCEPT : file_status(file_type::none) {}
_LIBCPP_INLINE_VISIBILITY
explicit file_status(file_type __ft,
perms __prms = perms::unknown) _NOEXCEPT perms __prms = perms::unknown) _NOEXCEPT
: __ft_(__ft), __prms_(__prms) : __ft_(__ft), __prms_(__prms)
{} {}
@@ -942,15 +944,15 @@ public:
std::u32string generic_u32string() const { return string<char32_t>(); } std::u32string generic_u32string() const { return string<char32_t>(); }
private: private:
_LIBCPP_FUNC_VIS int __compare(__string_view) const; int __compare(__string_view) const;
_LIBCPP_FUNC_VIS __string_view __root_name() const; __string_view __root_name() const;
_LIBCPP_FUNC_VIS __string_view __root_directory() const; __string_view __root_directory() const;
_LIBCPP_FUNC_VIS __string_view __root_path_raw() const; __string_view __root_path_raw() const;
_LIBCPP_FUNC_VIS __string_view __relative_path() const; __string_view __relative_path() const;
_LIBCPP_FUNC_VIS __string_view __parent_path() const; __string_view __parent_path() const;
_LIBCPP_FUNC_VIS __string_view __filename() const; __string_view __filename() const;
_LIBCPP_FUNC_VIS __string_view __stem() const; __string_view __stem() const;
_LIBCPP_FUNC_VIS __string_view __extension() const; __string_view __extension() const;
public: public:
// compare // compare
@@ -988,8 +990,8 @@ public:
class _LIBCPP_TYPE_VIS iterator; class _LIBCPP_TYPE_VIS iterator;
typedef iterator const_iterator; typedef iterator const_iterator;
_LIBCPP_FUNC_VIS iterator begin() const; iterator begin() const;
_LIBCPP_FUNC_VIS iterator end() const; iterator end() const;
private: private:
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1154,8 +1156,8 @@ private:
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
friend bool operator==(const iterator&, const iterator&); friend bool operator==(const iterator&, const iterator&);
_LIBCPP_FUNC_VIS iterator& __increment(); iterator& __increment();
_LIBCPP_FUNC_VIS iterator& __decrement(); iterator& __decrement();
path __stashed_elem_; path __stashed_elem_;
const path* __path_ptr_; const path* __path_ptr_;
@@ -1206,7 +1208,6 @@ public:
return __paths_->second; return __paths_->second;
} }
_LIBCPP_FUNC_VIS
~filesystem_error() override; // key function ~filesystem_error() override; // key function
// TODO(ericwf): Create a custom error message. // TODO(ericwf): Create a custom error message.
@@ -1924,7 +1925,7 @@ public:
const directory_entry& operator*() const { const directory_entry& operator*() const {
_LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced"); _LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced");
return __deref(); return __dereference();
} }
const directory_entry* operator->() const const directory_entry* operator->() const
@@ -1949,11 +1950,14 @@ private:
// construct the dir_stream // construct the dir_stream
_LIBCPP_FUNC_VIS _LIBCPP_FUNC_VIS
directory_iterator(const path&, error_code *, directory_options = directory_options::none); directory_iterator(const path&, error_code *,
directory_options = directory_options::none);
_LIBCPP_FUNC_VIS _LIBCPP_FUNC_VIS
directory_iterator& __increment(error_code * __ec = nullptr); directory_iterator& __increment(error_code * __ec = nullptr);
_LIBCPP_FUNC_VIS _LIBCPP_FUNC_VIS
const directory_entry& __deref() const; const directory_entry& __dereference() const;
private: private:
shared_ptr<__dir_stream> __imp_; shared_ptr<__dir_stream> __imp_;
@@ -2036,11 +2040,11 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const directory_entry& operator*() const const directory_entry& operator*() const
{ return __deref(); } { return __dereference(); }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const directory_entry* operator->() const const directory_entry* operator->() const
{ return &__deref(); } { return &__dereference(); }
recursive_directory_iterator& operator++() recursive_directory_iterator& operator++()
{ return __increment(); } { return __increment(); }
@@ -2079,7 +2083,7 @@ private:
error_code *__ec); error_code *__ec);
_LIBCPP_FUNC_VIS _LIBCPP_FUNC_VIS
const directory_entry& __deref() const; const directory_entry& __dereference() const;
_LIBCPP_FUNC_VIS _LIBCPP_FUNC_VIS
bool __try_recursion(error_code* __ec); bool __try_recursion(error_code* __ec);

View File

@@ -181,7 +181,7 @@ public:
// 8.6.3, memory.polymorphic.allocator.mem // 8.6.3, memory.polymorphic.allocator.mem
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_ValueType* allocate(size_t __n) { _ValueType* allocate(size_t __n) {
if (__n > max_size()) { if (__n > __max_size()) {
__throw_length_error( __throw_length_error(
"std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)" "std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)"
" 'n' exceeds maximum supported size"); " 'n' exceeds maximum supported size");
@@ -193,7 +193,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT { void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT {
_LIBCPP_ASSERT(__n <= max_size(), _LIBCPP_ASSERT(__n <= __max_size(),
"deallocate called for size which exceeds max_size()"); "deallocate called for size which exceeds max_size()");
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType)); __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
} }
@@ -265,10 +265,6 @@ public:
void destroy(_Tp * __p) _NOEXCEPT void destroy(_Tp * __p) _NOEXCEPT
{ __p->~_Tp(); } { __p->~_Tp(); }
_LIBCPP_INLINE_VISIBILITY
size_t max_size() const _NOEXCEPT
{ return numeric_limits<size_t>::max() / sizeof(value_type); }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
polymorphic_allocator polymorphic_allocator
select_on_container_copy_construction() const _NOEXCEPT select_on_container_copy_construction() const _NOEXCEPT
@@ -309,6 +305,10 @@ private:
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource()); return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource());
} }
_LIBCPP_INLINE_VISIBILITY
size_t __max_size() const _NOEXCEPT
{ return numeric_limits<size_t>::max() / sizeof(value_type); }
memory_resource * __res_; memory_resource * __res_;
}; };

View File

@@ -45,18 +45,23 @@ inline namespace fundamentals_v2 {
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_LFTS_V2
template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs; template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
template <typename _Tp> template <typename _Result, typename _Source>
struct __abs<_Tp, true> { struct __abs<_Result, _Source, true> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; } _Result operator()(_Source __t) const noexcept
{
if (__t >= 0) return __t;
if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
return -__t;
}
}; };
template <typename _Tp> template <typename _Result, typename _Source>
struct __abs<_Tp, false> { struct __abs<_Result, _Source, false> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_Tp operator()(_Tp __t) const noexcept { return __t; } _Result operator()(_Source __t) const noexcept { return __t; }
}; };
@@ -79,8 +84,8 @@ gcd(_Tp __m, _Up __n)
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" ); static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" );
using _Rp = common_type_t<_Tp,_Up>; using _Rp = common_type_t<_Tp,_Up>;
using _Wp = make_unsigned_t<_Rp>; using _Wp = make_unsigned_t<_Rp>;
return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)), return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
static_cast<_Wp>(__abs<_Up>()(__n)))); static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -95,8 +100,8 @@ lcm(_Tp __m, _Up __n)
return 0; return 0;
using _Rp = common_type_t<_Tp,_Up>; using _Rp = common_type_t<_Tp,_Up>;
_Rp __val1 = __abs<_Tp>()(__m) / gcd(__m,__n); _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n);
_Up __val2 = __abs<_Up>()(__n); _Rp __val2 = __abs<_Rp, _Up>()(__n);
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
return __val1 * __val2; return __val1 * __val2;
} }

View File

@@ -207,7 +207,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <ext/__hash> #include <ext/__hash>
#if __DEPRECATED #if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__) #if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>") _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
#else #else
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map> # warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>

View File

@@ -199,7 +199,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <ext/__hash> #include <ext/__hash>
#if __DEPRECATED #if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__) #if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>") _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
#else #else
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set> # warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>

View File

@@ -582,6 +582,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const; wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
future_status future_status
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const; wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
@@ -1674,6 +1675,7 @@ class _LIBCPP_TYPE_VIS promise<void>
public: public:
promise(); promise();
template <class _Allocator> template <class _Allocator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
promise(allocator_arg_t, const _Allocator& __a); promise(allocator_arg_t, const _Allocator& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY

View File

@@ -623,16 +623,19 @@ protected:
~num_get() {} ~num_get() {}
template <class _Fp> template <class _Fp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_floating_point iter_type __do_get_floating_point
(iter_type __b, iter_type __e, ios_base& __iob, (iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Fp& __v) const; ios_base::iostate& __err, _Fp& __v) const;
template <class _Signed> template <class _Signed>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_signed iter_type __do_get_signed
(iter_type __b, iter_type __e, ios_base& __iob, (iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Signed& __v) const; ios_base::iostate& __err, _Signed& __v) const;
template <class _Unsigned> template <class _Unsigned>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_unsigned iter_type __do_get_unsigned
(iter_type __b, iter_type __e, ios_base& __iob, (iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Unsigned& __v) const; ios_base::iostate& __err, _Unsigned& __v) const;

View File

@@ -293,6 +293,9 @@ long double truncl(long double x);
*/ */
#include <__config> #include <__config>
#if defined(_LIBCPP_MSVCRT)
#include <crtversion.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
@@ -330,6 +333,16 @@ signbit(_A1 __lcpp_x) _NOEXCEPT
return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
} }
#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
template <typename _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
signbit(_A1 __lcpp_x) _NOEXCEPT
{
return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
}
#endif // signbit #endif // signbit
// fpclassify // fpclassify
@@ -354,6 +367,16 @@ fpclassify(_A1 __lcpp_x) _NOEXCEPT
return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
} }
#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
template <typename _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
fpclassify(_A1 __lcpp_x) _NOEXCEPT
{
return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
}
#endif // fpclassify #endif // fpclassify
// isfinite // isfinite
@@ -637,58 +660,58 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
#if !(defined(_AIX) || defined(__sun__)) #if !(defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
float float
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
double double
abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);} abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
long double long double
abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
#endif // !(defined(_AIX) || defined(__sun__)) #endif // !(defined(_AIX) || defined(__sun__))
// acos // acos
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);} acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
// asin // asin
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);} asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
// atan // atan
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);} atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
// atan2 // atan2
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
#endif #endif
template <class _A1, class _A2> template <class _A1, class _A2>
@@ -704,86 +727,86 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
} }
// ceil // ceil
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);} ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
// cos // cos
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return cosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);} cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
// cosh // cosh
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return coshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);} cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
// exp // exp
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return expf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);} exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
// fabs // fabs
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);} fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
// floor // floor
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return floorf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);} floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
// fmod // fmod
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmodf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
#endif #endif
template <class _A1, class _A2> template <class _A1, class _A2>
@@ -799,69 +822,69 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// frexp // frexp
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);} frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
// ldexp // ldexp
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);} ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
// log // log
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return logf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);} log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
// log10 // log10
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return log10f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);} log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
// modf // modf
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
#endif #endif
// pow // pow
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return powf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
#endif #endif
template <class _A1, class _A2> template <class _A1, class _A2>
@@ -877,115 +900,115 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// sin // sin
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return sinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);} sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
// sinh // sinh
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return sinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);} sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
// sqrt // sqrt
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);} sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
// tan // tan
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return tanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);} tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
// tanh // tanh
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) #if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return tanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
#endif #endif
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);} tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
// acosh // acosh
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);} acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
#endif #endif
// asinh // asinh
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);} asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
#endif #endif
// atanh // atanh
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);} atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
#endif #endif
// cbrt // cbrt
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);} cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
#endif #endif
// copysign // copysign
@@ -993,11 +1016,11 @@ cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12) #if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
float __lcpp_y) _NOEXCEPT { float __lcpp_y) _NOEXCEPT {
return copysignf(__lcpp_x, __lcpp_y); return ::copysignf(__lcpp_x, __lcpp_y);
} }
inline _LIBCPP_INLINE_VISIBILITY long double inline _LIBCPP_INLINE_VISIBILITY long double
copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
return copysignl(__lcpp_x, __lcpp_y); return ::copysignl(__lcpp_x, __lcpp_y);
} }
#endif #endif
@@ -1014,55 +1037,55 @@ copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
#ifndef _LIBCPP_MSVCRT #if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
// erf // erf
inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);} erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
// erfc // erfc
inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return erfcf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);} erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
// exp2 // exp2
inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return exp2f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);} exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
// expm1 // expm1
inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return expm1f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);} expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
// fdim // fdim
inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fdimf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1077,13 +1100,13 @@ fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// fma // fma
inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);} inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);} inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
template <class _A1, class _A2, class _A3> template <class _A1, class _A2, class _A3>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1100,13 +1123,13 @@ fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value && std::is_same<_A2, __result_type>::value &&
std::is_same<_A3, __result_type>::value)), ""); std::is_same<_A3, __result_type>::value)), "");
return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
} }
// fmax // fmax
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmaxf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1121,13 +1144,13 @@ fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// fmin // fmin
inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fminf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1142,13 +1165,13 @@ fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// hypot // hypot
inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return hypotf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1163,115 +1186,115 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// ilogb // ilogb
inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ilogbf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, int>::type typename std::enable_if<std::is_integral<_A1>::value, int>::type
ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);} ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
// lgamma // lgamma
inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return lgammaf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);} lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
// llrint // llrint
inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return llrintf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long long>::type typename std::enable_if<std::is_integral<_A1>::value, long long>::type
llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);} llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
// llround // llround
inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return llroundf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long long>::type typename std::enable_if<std::is_integral<_A1>::value, long long>::type
llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);} llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
// log1p // log1p
inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return log1pf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);} log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
// log2 // log2
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return log2f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);} log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
// logb // logb
inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return logbf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);} logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
// lrint // lrint
inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return lrintf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long>::type typename std::enable_if<std::is_integral<_A1>::value, long>::type
lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);} lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
// lround // lround
inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return lroundf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long>::type typename std::enable_if<std::is_integral<_A1>::value, long>::type
lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);} lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
// nan // nan
// nearbyint // nearbyint
inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return nearbyintf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);} nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
// nextafter // nextafter
inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return nextafterf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1286,23 +1309,23 @@ nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// nexttoward // nexttoward
inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);} nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
// remainder // remainder
inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return remainderf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1317,13 +1340,13 @@ remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
} }
// remquo // remquo
inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);} inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);} inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
template <class _A1, class _A2> template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -1338,70 +1361,70 @@ remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type; typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value && static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), ""); std::is_same<_A2, __result_type>::value)), "");
return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
} }
// rint // rint
inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return rintf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);} rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
// round // round
inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);} round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
// scalbln // scalbln
inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);} scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
// scalbn // scalbn
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);} scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
// tgamma // tgamma
inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return tgammaf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);} tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
// trunc // trunc
inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return truncf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
template <class _A1> template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type typename std::enable_if<std::is_integral<_A1>::value, double>::type
trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);} trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
#endif // !_LIBCPP_MSVCRT #endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
} // extern "C++" } // extern "C++"

View File

@@ -3341,7 +3341,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {
// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively) // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
// should be sufficient for thread safety. // should be sufficient for thread safety.
// See https://llvm.org/bugs/show_bug.cgi?id=22803 // See https://bugs.llvm.org/show_bug.cgi?id=22803
#if defined(__clang__) && __has_builtin(__atomic_add_fetch) \ #if defined(__clang__) && __has_builtin(__atomic_add_fetch) \
&& defined(__ATOMIC_RELAXED) \ && defined(__ATOMIC_RELAXED) \
&& defined(__ATOMIC_ACQ_REL) && defined(__ATOMIC_ACQ_REL)

View File

@@ -248,6 +248,7 @@ public:
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock() _NOEXCEPT;
}; };
@@ -291,6 +292,7 @@ public:
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock() _NOEXCEPT;
}; };
@@ -559,7 +561,6 @@ public:
#endif #endif
template <class _Fp> template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
void void
__call_once_proxy(void* __vp) __call_once_proxy(void* __vp)
{ {

View File

@@ -92,6 +92,10 @@ void operator delete[](void* ptr, void*) noexcept;
#include <cstdlib> #include <cstdlib>
#endif #endif
#if defined(_LIBCPP_ABI_MICROSOFT)
#include <new.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif
@@ -110,6 +114,10 @@ void operator delete[](void* ptr, void*) noexcept;
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
#if !defined(_LIBCPP_ABI_MICROSOFT)
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
class _LIBCPP_EXCEPTION_ABI bad_alloc class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception : public exception
{ {
@@ -128,9 +136,15 @@ public:
virtual const char* what() const _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_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) #if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11)
class _LIBCPP_EXCEPTION_ABI bad_array_length class _LIBCPP_EXCEPTION_ABI bad_array_length
: public bad_alloc : public bad_alloc
@@ -153,12 +167,6 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
#endif #endif
#endif #endif
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
} // std } // std
#if defined(_LIBCPP_CXX03_LANG) #if defined(_LIBCPP_CXX03_LANG)
@@ -167,6 +175,8 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
#define _THROW_BAD_ALLOC #define _THROW_BAD_ALLOC
#endif #endif
#if !defined(_LIBCPP_ABI_MICROSOFT)
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _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) _NOEXCEPT;
@@ -206,6 +216,8 @@ inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _N
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
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_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {

View File

@@ -65,6 +65,7 @@ template <class M, class N>
#include <__config> #include <__config>
#include <iterator> #include <iterator>
#include <limits> // for numeric_limits
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
@@ -200,18 +201,23 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
#if _LIBCPP_STD_VER > 14 #if _LIBCPP_STD_VER > 14
template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs; template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
template <typename _Tp> template <typename _Result, typename _Source>
struct __abs<_Tp, true> { struct __abs<_Result, _Source, true> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; } _Result operator()(_Source __t) const noexcept
{
if (__t >= 0) return __t;
if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
return -__t;
}
}; };
template <typename _Tp> template <typename _Result, typename _Source>
struct __abs<_Tp, false> { struct __abs<_Result, _Source, false> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_Tp operator()(_Tp __t) const noexcept { return __t; } _Result operator()(_Source __t) const noexcept { return __t; }
}; };
@@ -219,7 +225,7 @@ template<class _Tp>
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_Tp __gcd(_Tp __m, _Tp __n) _Tp __gcd(_Tp __m, _Tp __n)
{ {
static_assert((!is_signed<_Tp>::value), "" ); static_assert((!is_signed<_Tp>::value), "");
return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n); return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n);
} }
@@ -234,8 +240,8 @@ gcd(_Tp __m, _Up __n)
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" ); static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" );
using _Rp = common_type_t<_Tp,_Up>; using _Rp = common_type_t<_Tp,_Up>;
using _Wp = make_unsigned_t<_Rp>; using _Wp = make_unsigned_t<_Rp>;
return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)), return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
static_cast<_Wp>(__abs<_Up>()(__n)))); static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -250,8 +256,8 @@ lcm(_Tp __m, _Up __n)
return 0; return 0;
using _Rp = common_type_t<_Tp,_Up>; using _Rp = common_type_t<_Tp,_Up>;
_Rp __val1 = __abs<_Tp>()(__m) / gcd(__m,__n); _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n);
_Up __val2 = __abs<_Up>()(__n); _Rp __val2 = __abs<_Rp, _Up>()(__n);
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
return __val1 * __val2; return __val1 * __val2;
} }

View File

@@ -160,14 +160,12 @@ namespace std // purposefully not using versioning namespace
{ {
class _LIBCPP_EXCEPTION_ABI bad_optional_access class _LIBCPP_EXCEPTION_ABI bad_optional_access
: public logic_error : public exception
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY
bad_optional_access() : logic_error("bad optional access") {}
// Get the key function ~bad_optional_access() into the dylib // Get the key function ~bad_optional_access() into the dylib
virtual ~bad_optional_access() _NOEXCEPT; virtual ~bad_optional_access() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
}; };
} // std } // std

View File

@@ -220,6 +220,7 @@ public:
return try_lock_until(chrono::steady_clock::now() + __rel_time); return try_lock_until(chrono::steady_clock::now() + __rel_time);
} }
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time); try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock(); void unlock();
@@ -235,6 +236,7 @@ public:
return try_lock_shared_until(chrono::steady_clock::now() + __rel_time); return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
} }
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool bool
try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time); try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock_shared(); void unlock_shared();

View File

@@ -53,7 +53,8 @@ using std::nullptr_t;
} }
// Re-use the compiler's <stddef.h> max_align_t where possible. // Re-use the compiler's <stddef.h> max_align_t where possible.
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) #if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
!defined(__DEFINED_max_align_t)
typedef long double max_align_t; typedef long double max_align_t;
#endif #endif

View File

@@ -775,30 +775,31 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a); basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s); _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(const value_type* __s, const allocator_type& __a); basic_string(const _CharT* __s, const _Allocator& __a);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(const value_type* __s, size_type __n); basic_string(const _CharT* __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(const value_type* __s, size_type __n, const allocator_type& __a); basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c); basic_string(size_type __n, _CharT __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c, const allocator_type& __a); basic_string(size_type __n, _CharT __c, const _Allocator& __a);
basic_string(const basic_string& __str, size_type __pos, size_type __n, basic_string(const basic_string& __str, size_type __pos, size_type __n,
const allocator_type& __a = allocator_type()); const _Allocator& __a = _Allocator());
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(const basic_string& __str, size_type __pos, basic_string(const basic_string& __str, size_type __pos,
const allocator_type& __a = allocator_type()); const _Allocator& __a = _Allocator());
template<class _Tp> template<class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
basic_string(const _Tp& __t, size_type __pos, size_type __n, basic_string(const _Tp& __t, size_type __pos, size_type __n,
const allocator_type& __a = allocator_type(), const allocator_type& __a = allocator_type(),
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0); typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
_LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_INLINE_VISIBILITY explicit
basic_string(__self_view __sv); basic_string(__self_view __sv);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(__self_view __sv, const allocator_type& __a); basic_string(__self_view __sv, const _Allocator& __a);
template<class _InputIterator> template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last); basic_string(_InputIterator __first, _InputIterator __last);
@@ -807,9 +808,9 @@ public:
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il); basic_string(initializer_list<_CharT> __il);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il, const allocator_type& __a); basic_string(initializer_list<_CharT> __il, const _Allocator& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
inline ~basic_string(); inline ~basic_string();
@@ -927,6 +928,7 @@ public:
basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); } basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); }
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp> template <class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -937,8 +939,10 @@ public:
basic_string& append(const value_type* __s); basic_string& append(const value_type* __s);
basic_string& append(size_type __n, value_type __c); basic_string& append(size_type __n, value_type __c);
template <class _ForwardIterator> template <class _ForwardIterator>
inline basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator); _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
template<class _InputIterator> template<class _InputIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_exactly_input_iterator<_InputIterator>::value __is_exactly_input_iterator<_InputIterator>::value
@@ -952,6 +956,7 @@ public:
return *this; return *this;
} }
template<class _ForwardIterator> template<class _ForwardIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_forward_iterator<_ForwardIterator>::value __is_forward_iterator<_ForwardIterator>::value
@@ -988,6 +993,7 @@ public:
#endif #endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp> template <class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -998,6 +1004,7 @@ public:
basic_string& assign(const value_type* __s); basic_string& assign(const value_type* __s);
basic_string& assign(size_type __n, value_type __c); basic_string& assign(size_type __n, value_type __c);
template<class _InputIterator> template<class _InputIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_exactly_input_iterator<_InputIterator>::value __is_exactly_input_iterator<_InputIterator>::value
@@ -1006,6 +1013,7 @@ public:
>::type >::type
assign(_InputIterator __first, _InputIterator __last); assign(_InputIterator __first, _InputIterator __last);
template<class _ForwardIterator> template<class _ForwardIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_forward_iterator<_ForwardIterator>::value __is_forward_iterator<_ForwardIterator>::value
@@ -1023,6 +1031,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); } basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
template <class _Tp> template <class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1037,6 +1046,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, size_type __n, value_type __c); iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator> template<class _InputIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_exactly_input_iterator<_InputIterator>::value __is_exactly_input_iterator<_InputIterator>::value
@@ -1045,6 +1055,7 @@ public:
>::type >::type
insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
template<class _ForwardIterator> template<class _ForwardIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_forward_iterator<_ForwardIterator>::value __is_forward_iterator<_ForwardIterator>::value
@@ -1070,6 +1081,7 @@ public:
basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); } basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); }
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos); basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
template <class _Tp> template <class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1090,6 +1102,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator> template<class _InputIterator>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
typename enable_if typename enable_if
< <
__is_input_iterator<_InputIterator>::value, __is_input_iterator<_InputIterator>::value,
@@ -1367,13 +1380,29 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, true_type) void __copy_assign_alloc(const basic_string& __str, true_type)
{ {
if (__alloc() != __str.__alloc()) if (__alloc() == __str.__alloc())
__alloc() = __str.__alloc();
else
{
if (!__str.__is_long())
{ {
clear(); clear();
shrink_to_fit(); shrink_to_fit();
}
__alloc() = __str.__alloc(); __alloc() = __str.__alloc();
} }
else
{
allocator_type __a = __str.__alloc();
pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap());
clear();
shrink_to_fit();
__alloc() = _VSTD::move(__a);
__set_long_pointer(__p);
__set_long_cap(__str.__get_long_cap());
__set_long_size(__str.size());
}
}
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
@@ -1541,7 +1570,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s) basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
{ {
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
__init(__s, traits_type::length(__s)); __init(__s, traits_type::length(__s));
@@ -1552,7 +1581,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
@@ -1564,7 +1593,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, c
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n) basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
{ {
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
__init(__s, __n); __init(__s, __n);
@@ -1575,7 +1604,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, s
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
@@ -1599,7 +1628,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(
const basic_string& __str, const allocator_type& __a)
: __r_(__a) : __r_(__a)
{ {
if (!__str.__is_long()) if (!__str.__is_long())
@@ -1678,7 +1708,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c) basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
{ {
__init(__n, __c); __init(__n, __c);
#if _LIBCPP_DEBUG_LEVEL >= 2 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1688,7 +1718,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
__init(__n, __c); __init(__n, __c);
@@ -1698,8 +1728,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n, basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
const allocator_type& __a) size_type __pos, size_type __n,
const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
size_type __str_sz = __str.size(); size_type __str_sz = __str.size();
@@ -1714,7 +1745,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
const allocator_type& __a) const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
size_type __str_sz = __str.size(); size_type __str_sz = __str.size();
@@ -1752,7 +1783,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
__init(__sv.data(), __sv.size()); __init(__sv.data(), __sv.size());
@@ -1847,7 +1878,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il) basic_string<_CharT, _Traits, _Allocator>::basic_string(
initializer_list<_CharT> __il)
{ {
__init(__il.begin(), __il.end()); __init(__il.begin(), __il.end());
#if _LIBCPP_DEBUG_LEVEL >= 2 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1857,7 +1889,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il, const allocator_type& __a) basic_string<_CharT, _Traits, _Allocator>::basic_string(
initializer_list<_CharT> __il, const _Allocator& __a)
: __r_(__a) : __r_(__a)
{ {
__init(__il.begin(), __il.end()); __init(__il.begin(), __il.end());
@@ -2526,6 +2560,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{ {
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
size_type __sz = size(); size_type __sz = size();
@@ -2565,6 +2600,8 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
} }
traits_type::move(__p + __pos, __s, __n2); traits_type::move(__p + __pos, __s, __n2);
__finish: __finish:
// __sz += __n2 - __n1; in this and the below function below can cause unsigned integer overflow,
// but this is a safe operation, so we disable the check.
__sz += __n2 - __n1; __sz += __n2 - __n1;
__set_size(__sz); __set_size(__sz);
__invalidate_iterators_past(__sz); __invalidate_iterators_past(__sz);
@@ -2578,6 +2615,7 @@ __finish:
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{ {
size_type __sz = size(); size_type __sz = size();
if (__pos > __sz) if (__pos > __sz)

View File

@@ -298,9 +298,12 @@ public:
!is_same<typename decay<_Fp>::type, thread>::value !is_same<typename decay<_Fp>::type, thread>::value
>::type >::type
> >
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
explicit thread(_Fp&& __f, _Args&&... __args); explicit thread(_Fp&& __f, _Args&&... __args);
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
template <class _Fp> explicit thread(_Fp __f); template <class _Fp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
explicit thread(_Fp __f);
#endif #endif
~thread(); ~thread();
@@ -424,7 +427,7 @@ void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
namespace this_thread namespace this_thread
{ {
_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns); _LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
template <class _Rep, class _Period> template <class _Rep, class _Period>
void void

View File

@@ -751,7 +751,7 @@ public:
_CheckArgsConstructor< _CheckArgsConstructor<
!_EnableImplicitReducedArityExtension !_EnableImplicitReducedArityExtension
&& sizeof...(_Up) < sizeof...(_Tp) && sizeof...(_Up) < sizeof...(_Tp)
&& !_PackExpandsToThisTuple<_Up...>() && !_PackExpandsToThisTuple<_Up...>::value
>::template __enable_implicit<_Up...>(), >::template __enable_implicit<_Up...>(),
bool bool
>::type = false >::type = false
@@ -1064,11 +1064,13 @@ template <class _Up>
struct __ignore_t struct __ignore_t
{ {
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const __ignore_t& operator=(_Tp&&) const {return *this;} const __ignore_t& operator=(_Tp&&) const {return *this;}
}; };
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); } namespace {
constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
}
template <class _Tp> template <class _Tp>
struct __make_tuple_return_impl struct __make_tuple_return_impl

View File

@@ -1297,18 +1297,8 @@ template <class _Tp> using decay_t = typename decay<_Tp>::type;
// is_abstract // is_abstract
namespace __is_abstract_imp template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
{ : public integral_constant<bool, __is_abstract(_Tp)> {};
template <class _Tp> char __test(_Tp (*)[1]);
template <class _Tp> __two __test(...);
}
template <class _Tp, bool = is_class<_Tp>::value>
struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v

View File

@@ -69,7 +69,9 @@ public:
#pragma GCC system_header #pragma GCC system_header
#endif #endif
#if defined(_LIBCPP_NONUNIQUE_RTTI_BIT) #if defined(_LIBCPP_ABI_MICROSOFT)
#include <vcruntime_typeinfo.h>
#elif defined(_LIBCPP_NONUNIQUE_RTTI_BIT)
#define _LIBCPP_HAS_NONUNIQUE_TYPEINFO #define _LIBCPP_HAS_NONUNIQUE_TYPEINFO
#else #else
#define _LIBCPP_HAS_UNIQUE_TYPEINFO #define _LIBCPP_HAS_UNIQUE_TYPEINFO
@@ -78,6 +80,7 @@ public:
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
#if !defined(_LIBCPP_ABI_MICROSOFT)
class _LIBCPP_EXCEPTION_ABI type_info class _LIBCPP_EXCEPTION_ABI type_info
{ {
type_info& operator=(const type_info&); type_info& operator=(const type_info&);
@@ -187,6 +190,8 @@ public:
virtual const char* what() const _NOEXCEPT; virtual const char* what() const _NOEXCEPT;
}; };
#endif // !_LIBCPP_ABI_MICROSOFT
} // std } // std
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -959,13 +959,14 @@ struct __murmur2_or_cityhash;
template <class _Size> template <class _Size>
struct __murmur2_or_cityhash<_Size, 32> struct __murmur2_or_cityhash<_Size, 32>
{ {
_Size operator()(const void* __key, _Size __len); inline _Size operator()(const void* __key, _Size __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
}; };
// murmur2 // murmur2
template <class _Size> template <class _Size>
_Size _Size
__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
{ {
const _Size __m = 0x5bd1e995; const _Size __m = 0x5bd1e995;
const _Size __r = 24; const _Size __r = 24;
@@ -999,7 +1000,7 @@ __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) _LI
template <class _Size> template <class _Size>
struct __murmur2_or_cityhash<_Size, 64> struct __murmur2_or_cityhash<_Size, 64>
{ {
_Size operator()(const void* __key, _Size __len); inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
private: private:
// Some primes between 2^63 and 2^64. // Some primes between 2^63 and 2^64.
@@ -1020,7 +1021,9 @@ struct __murmur2_or_cityhash<_Size, 64>
return __val ^ (__val >> 47); return __val ^ (__val >> 47);
} }
static _Size __hash_len_16(_Size __u, _Size __v) { static _Size __hash_len_16(_Size __u, _Size __v)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
const _Size __mul = 0x9ddfea08eb382d69ULL; const _Size __mul = 0x9ddfea08eb382d69ULL;
_Size __a = (__u ^ __v) * __mul; _Size __a = (__u ^ __v) * __mul;
__a ^= (__a >> 47); __a ^= (__a >> 47);
@@ -1030,7 +1033,9 @@ struct __murmur2_or_cityhash<_Size, 64>
return __b; return __b;
} }
static _Size __hash_len_0_to_16(const char* __s, _Size __len) { static _Size __hash_len_0_to_16(const char* __s, _Size __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
if (__len > 8) { if (__len > 8) {
const _Size __a = __loadword<_Size>(__s); const _Size __a = __loadword<_Size>(__s);
const _Size __b = __loadword<_Size>(__s + __len - 8); const _Size __b = __loadword<_Size>(__s + __len - 8);
@@ -1053,7 +1058,9 @@ struct __murmur2_or_cityhash<_Size, 64>
return __k2; return __k2;
} }
static _Size __hash_len_17_to_32(const char *__s, _Size __len) { static _Size __hash_len_17_to_32(const char *__s, _Size __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
const _Size __a = __loadword<_Size>(__s) * __k1; const _Size __a = __loadword<_Size>(__s) * __k1;
const _Size __b = __loadword<_Size>(__s + 8); const _Size __b = __loadword<_Size>(__s + 8);
const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2; const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
@@ -1065,7 +1072,9 @@ struct __murmur2_or_cityhash<_Size, 64>
// Return a 16-byte hash for 48 bytes. Quick and dirty. // Return a 16-byte hash for 48 bytes. Quick and dirty.
// Callers do best to use "random-looking" values for a and b. // Callers do best to use "random-looking" values for a and b.
static pair<_Size, _Size> __weak_hash_len_32_with_seeds( static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) { _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
__a += __w; __a += __w;
__b = __rotate(__b + __a + __z, 21); __b = __rotate(__b + __a + __z, 21);
const _Size __c = __a; const _Size __c = __a;
@@ -1077,7 +1086,9 @@ struct __murmur2_or_cityhash<_Size, 64>
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
static pair<_Size, _Size> __weak_hash_len_32_with_seeds( static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
const char* __s, _Size __a, _Size __b) { const char* __s, _Size __a, _Size __b)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s), return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
__loadword<_Size>(__s + 8), __loadword<_Size>(__s + 8),
__loadword<_Size>(__s + 16), __loadword<_Size>(__s + 16),
@@ -1087,7 +1098,9 @@ struct __murmur2_or_cityhash<_Size, 64>
} }
// Return an 8-byte hash for 33 to 64 bytes. // Return an 8-byte hash for 33 to 64 bytes.
static _Size __hash_len_33_to_64(const char *__s, size_t __len) { static _Size __hash_len_33_to_64(const char *__s, size_t __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
_Size __z = __loadword<_Size>(__s + 24); _Size __z = __loadword<_Size>(__s + 24);
_Size __a = __loadword<_Size>(__s) + _Size __a = __loadword<_Size>(__s) +
(__len + __loadword<_Size>(__s + __len - 16)) * __k0; (__len + __loadword<_Size>(__s + __len - 16)) * __k0;
@@ -1115,7 +1128,7 @@ struct __murmur2_or_cityhash<_Size, 64>
// cityhash64 // cityhash64
template <class _Size> template <class _Size>
_Size _Size
__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
{ {
const char* __s = static_cast<const char*>(__key); const char* __s = static_cast<const char*>(__key);
if (__len <= 32) { if (__len <= 32) {
@@ -1547,14 +1560,19 @@ struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
#endif #endif
#ifndef _LIBCPP_CXX03_LANG #ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Hash = std::hash<_Key> > template <class _Key, class _Hash>
using __has_enabled_hash = integral_constant<bool, using __check_hash_requirements = integral_constant<bool,
is_default_constructible<_Hash>::value &&
is_copy_constructible<_Hash>::value && is_copy_constructible<_Hash>::value &&
is_move_constructible<_Hash>::value && is_move_constructible<_Hash>::value &&
__invokable_r<size_t, _Hash, _Key const&>::value __invokable_r<size_t, _Hash, _Key const&>::value
>; >;
template <class _Key, class _Hash = std::hash<_Key> >
using __has_enabled_hash = integral_constant<bool,
__check_hash_requirements<_Key, _Hash>::value &&
is_default_constructible<_Hash>::value
>;
#if _LIBCPP_STD_VER > 14 #if _LIBCPP_STD_VER > 14
template <class _Type, class> template <class _Type, class>
using __enable_hash_helper_imp = _Type; using __enable_hash_helper_imp = _Type;

View File

@@ -480,8 +480,7 @@ private:
template <class _Fp, class... _Vs, size_t... _Is> template <class _Fp, class... _Vs, size_t... _Is>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
static constexpr auto __make_dispatch(index_sequence<_Is...>) { static constexpr auto __make_dispatch(index_sequence<_Is...>) {
return _VSTD::addressof( return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
__dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>);
} }
template <size_t _Ip, class _Fp, class... _Vs> template <size_t _Ip, class _Fp, class... _Vs>
@@ -579,7 +578,7 @@ private:
constexpr decltype(auto) operator()(_Alts&&... __alts) const { constexpr decltype(auto) operator()(_Alts&&... __alts) const {
__std_visit_exhaustive_visitor_check< __std_visit_exhaustive_visitor_check<
_Visitor, _Visitor,
decltype(_VSTD::forward<_Alts>(__alts).__value)...>(); decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor), return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
_VSTD::forward<_Alts>(__alts).__value...); _VSTD::forward<_Alts>(__alts).__value...);
} }

View File

@@ -32,6 +32,10 @@ endif()
add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH
"${CMAKE_LIBRARY_PATH_FLAG}${LIBCXX_CXX_ABI_LIBRARY_PATH}") "${CMAKE_LIBRARY_PATH_FLAG}${LIBCXX_CXX_ABI_LIBRARY_PATH}")
if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
endif()
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
@@ -62,12 +66,7 @@ if (APPLE AND LLVM_USE_SANITIZER)
message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X") message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
endif() endif()
if (LIBFILE) if (LIBFILE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=lib OUTPUT_VARIABLE LIBDIR RESULT_VARIABLE Result) find_compiler_rt_dir(LIBDIR)
if (NOT ${Result} EQUAL "0")
message(FATAL "Failed to find library resource directory")
endif()
string(STRIP "${LIBDIR}" LIBDIR)
set(LIBDIR "${LIBDIR}/darwin/")
if (NOT IS_DIRECTORY "${LIBDIR}") if (NOT IS_DIRECTORY "${LIBDIR}")
message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER") message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
endif() endif()
@@ -89,9 +88,9 @@ add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
# Add the unwinder library. # Add the unwinder library.
if (LIBCXXABI_USE_LLVM_UNWINDER) if (LIBCXXABI_USE_LLVM_UNWINDER)
if (TARGET unwind_shared) if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
add_interface_library(unwind_shared) add_interface_library(unwind_shared)
elseif (TARGET unwind_static) elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
add_interface_library(unwind_static) add_interface_library(unwind_static)
else() else()
add_interface_library(unwind) add_interface_library(unwind)
@@ -332,7 +331,7 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
# after cxx builds. # after cxx builds.
add_custom_command(TARGET cxx_shared POST_BUILD add_custom_command(TARGET cxx_shared POST_BUILD
COMMAND COMMAND
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py
ARGS ARGS
"$<TARGET_LINKER_FILE:cxx_shared>" "$<TARGET_LINKER_FILE:cxx_shared>"
${LIBCXX_INTERFACE_LIBRARY_NAMES} ${LIBCXX_INTERFACE_LIBRARY_NAMES}

View File

@@ -12,6 +12,7 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'} {'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt19bad_optional_access4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt20bad_array_new_length4whatEv'} {'type': 'U', 'is_defined': False, 'name': '__ZNKSt20bad_array_new_length4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt20bad_array_new_length4whatEv'} {'type': 'I', 'is_defined': True, 'name': '__ZNKSt20bad_array_new_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc'}

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,42 @@ Afterwards the ABI list should be updated to include the new changes.
New entries should be added directly below the "Version" header. New entries should be added directly below the "Version" header.
-----------
Version 5.0
-----------
* r296729 - Remove std::num_get template methods which should be inline
These functions should never have had visible definitions in the dylib but
since they were previously not specified with 'inline' they accidentally
got emitted. This change is non-ABI breaking because every "linkage unit"
must contain its own definition.
x86_64-linux-gnu
----------------
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE15__do_get_signedIlEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE15__do_get_signedIxEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedIjEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedImEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedItEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedIyEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIdEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIeEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIfEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE15__do_get_signedIlEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE15__do_get_signedIxEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedIjEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedImEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedItEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedIyEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIdEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIeEES4_S4_S4_RNS_8ios_baseERjRT_
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIfEES4_S4_S4_RNS_8ios_baseERjRT_
x86_64-apple-darwin16.0
-----------------------
No changes
----------- -----------
Version 4.0 Version 4.0
----------- -----------
@@ -47,7 +83,7 @@ Version 4.0
Symbol added: _ZTSSt18bad_variant_access Symbol added: _ZTSSt18bad_variant_access
Symbol added: _ZNKSt18bad_variant_access4whatEv Symbol added: _ZNKSt18bad_variant_access4whatEv
* rTBD - Remove std::string::append template methods which should be inline * r285537 - Remove std::string::append template methods which should be inline
These functions should never have had visible definitions in the dylib but These functions should never have had visible definitions in the dylib but
since they were previously not specified with 'inline' they accidentally since they were previously not specified with 'inline' they accidentally
@@ -133,3 +169,18 @@ Version 4.0
Symbol added: _ZTISt12bad_any_cast Symbol added: _ZTISt12bad_any_cast
Symbol added: _ZTSSt12bad_any_cast Symbol added: _ZTSSt12bad_any_cast
Symbol added: _ZTVSt12bad_any_cast Symbol added: _ZTVSt12bad_any_cast
* r295398 - Remove basic_string::insert and basic_string::replace template methods
which should be inline.
These functions should never have had visible definitions in the dylib but
since they were previously not specified with 'inline' they accidentally
got emitted. This change is non-ABI breaking because every "linkage unit"
must contain its own definition.
x86_64-linux-gnu
----------------
SYMBOL REMOVED: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertIPKcEENS_9enable_ifIXaasr21__is_forward_iteratorIT_EE5valuesr38__libcpp_string_gets_noexcept_iteratorISA_EE5valueENS_11__wrap_iterIPcEEE4typeENSB_IS8_EESA_SA_
SYMBOL REMOVED: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceIPKcEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_
SYMBOL REMOVED: _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertIPKwEENS_9enable_ifIXaasr21__is_forward_iteratorIT_EE5valuesr38__libcpp_string_gets_noexcept_iteratorISA_EE5valueENS_11__wrap_iterIPwEEE4typeENSB_IS8_EESA_SA_
SYMBOL REMOVED: _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceIPKwEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_

View File

@@ -27,7 +27,7 @@ endif()
if (LIBCXX_HAS_ABILIST_CONFIGURATION) if (LIBCXX_HAS_ABILIST_CONFIGURATION)
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.abilist") set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.abilist")
set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_check/sym_diff.py") set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py")
add_custom_target(check-cxx-abilist add_custom_target(check-cxx-abilist
${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE} ${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE}
$<TARGET_SONAME_FILE:cxx_shared> $<TARGET_SONAME_FILE:cxx_shared>

View File

@@ -12,6 +12,7 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'} {'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt19bad_optional_access4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt20bad_array_new_length4whatEv'} {'type': 'U', 'is_defined': False, 'name': '__ZNKSt20bad_array_new_length4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt20bad_array_new_length4whatEv'} {'type': 'I', 'is_defined': True, 'name': '__ZNKSt20bad_array_new_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc'}

File diff suppressed because it is too large Load Diff

View File

@@ -1,189 +0,0 @@
#! /bin/sh
#
# Set the $TRIPLE environment variable to your system's triple before
# running this script. If you set $CXX, that will be used to compile
# the library. Otherwise we'll use clang++.
set -e
echo "---------- WARNING ----------"
echo "buildit is no longer supported and will be removed in the next week!"
echo "please contact the libc++ maintainers if you have any concerns"
echo ""
if [ `basename $(pwd)` != "lib" ]
then
echo "current directory must be lib"
exit 1
fi
if [ -z "$CXX" ]
then
CXX=clang++
fi
if [ -z "$CXX_LANG" ]
then
CXX_LANG=c++11
fi
if [ -z "$CC" ]
then
CC=clang
fi
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]
then
if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ]
then
MACOSX_DEPLOYMENT_TARGET=10.7
fi
fi
if [ -z "$RC_ProjectSourceVersion" ]
then
RC_ProjectSourceVersion=1
fi
EXTRA_FLAGS="-nostdinc++ -std=${CXX_LANG} -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
-Wstrict-aliasing=2 -Wstrict-overflow=4 -D_LIBCPP_BUILDING_LIBRARY "
case $TRIPLE in
*-apple-*)
if [ -z $RC_XBS ]
then
RC_CFLAGS="-arch i386 -arch x86_64"
fi
SOEXT=dylib
if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ]
then
EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs -current_version 1 \
-compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
-Wl,-unexported_symbols_list,libc++unexp.exp \
/usr/lib/libSystem.B.dylib"
else
if [ -n "$SDKROOT" ]
then
EXTRA_FLAGS+="-isysroot ${SDKROOT} "
if echo "${RC_ARCHS}" | grep -q "armv7"
then
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
else
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
fi
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
CC=`xcrun -sdk "${SDKROOT}" -find clang`
else
# Check if we have _LIBCPPABI_VERSION, to determine the reexport list to use.
if (echo "#include <cxxabi.h>" | $CXX -E -dM -x c++ - | \
grep _LIBCPPABI_VERSION > /dev/null)
then
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi2.exp"
else
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
fi
fi
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} \
-compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
${RE_EXPORT_LINE} \
-Wl,-force_symbols_not_weak_list,notweak.exp \
-Wl,-force_symbols_weak_list,weak.exp"
fi
;;
*-*-mingw*)
# FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
SOEXT=dll
LDSHARED_FLAGS="-o libc++.dll \
-shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
-lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
;;
*-ibm-*)
hostOS=`uname`
hostOS=`echo $hostOS | sed -e "s/\s+$//"`
hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'`
if [ $hostOS = "linux" ]
then
LDSHARED_FLAGS="-o libc++.so.1 \
-qmkshrobj -Wl,-soname,libc++.so.1 \
-lpthread -lrt -lc -lstdc++"
EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1"
else
LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet"
EXTRA_FLAGS="-qlanglvl=extended0x"
fi
RC_CFLAGS="-qpic=large"
;;
*)
RC_CFLAGS="-fPIC"
SOEXT=so
LDSHARED_FLAGS="-o libc++.so.1.0 \
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
-lpthread -lrt -lc -lstdc++"
;;
esac
if [ -z "$RC_XBS" ]
then
rm -f libc++.1.$SOEXT*
fi
set -x
for FILE in ../src/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
done
case $TRIPLE in
*-*-mingw*)
for FILE in ../src/support/win32/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
done
;;
esac
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
#libtool -static -o libc++.a *.o
# Create the link for the final library name, so that we can use this directory
# as a link target for the tests.
case $TRIPLE in
*-apple-*)
rm -f libc++.dylib
ln -s libc++.1.dylib libc++.dylib
;;
*-*-mingw*)
;;
*-ibm-*)
if [ $hostOS = "linux" ]
then
rm -f libc++.so
ln -s libc++.so.1 libc++.so
else #AIX
rm -f libc++.a
ar r libc++.a shr.o
fi
;;
*)
rm -f libc++.so
ln -s libc++.so.1 libc++.so
;;
esac
if [ -z "$RC_XBS" ]
then
rm *.o
fi
echo "---------- WARNING ----------"
echo "buildit is no longer supported and will be removed in the next week!"
echo "please contact the libc++ maintainers if you have any concerns"
echo ""

View File

@@ -14,7 +14,6 @@
#include "condition_variable" #include "condition_variable"
#include "thread" #include "thread"
#include "system_error" #include "system_error"
#include "cassert"
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -6,328 +6,31 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdio.h>
#include "exception" #include "exception"
#include "new" #include "new"
#include "typeinfo"
#if defined(_LIBCPP_ABI_MICROSOFT) #if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || \
#include <eh.h> (defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY))
#include <corecrt_terminate.h>
#elif defined(__APPLE__) && !defined(LIBCXXRT) && \
!defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
#include <cxxabi.h>
using namespace __cxxabiv1;
#define HAVE_DEPENDENT_EH_ABI 1
#ifndef _LIBCPPABI_VERSION
using namespace __cxxabiapple;
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared library. The globals holding the current terminate handler and
// current unexpected handler are in the ABI library.
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#endif // _LIBCPPABI_VERSION
#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h> #include <cxxabi.h>
using namespace __cxxabiv1; using namespace __cxxabiv1;
#if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
#define HAVE_DEPENDENT_EH_ABI 1 #define HAVE_DEPENDENT_EH_ABI 1
#endif #endif
#elif !defined(__GLIBCXX__) // defined(LIBCXX_BUILDING_LIBCXXABI)
_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
namespace std
{
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
// libcxxrt provides implementations of these functions itself.
unexpected_handler
set_unexpected(unexpected_handler func) _NOEXCEPT
{
#if defined(_LIBCPP_ABI_MICROSOFT) #if defined(_LIBCPP_ABI_MICROSOFT)
return ::set_unexpected(func); #include "support/runtime/exception_msvc.ipp"
#else #include "support/runtime/exception_pointer_unimplemented.ipp"
return __sync_lock_test_and_set(&__unexpected_handler, func); #elif defined(_LIBCPPABI_VERSION)
#endif #include "support/runtime/exception_libcxxabi.ipp"
} #include "support/runtime/exception_pointer_cxxabi.ipp"
#elif defined(LIBCXXRT)
unexpected_handler #include "support/runtime/exception_libcxxrt.ipp"
get_unexpected() _NOEXCEPT #include "support/runtime/exception_pointer_cxxabi.ipp"
{
#if defined(_LIBCPP_ABI_MICROSOFT)
return ::_get_unexpected();
#else
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
#endif
}
_LIBCPP_NORETURN
void
unexpected()
{
(*get_unexpected())();
// unexpected handler should not return
terminate();
}
terminate_handler
set_terminate(terminate_handler func) _NOEXCEPT
{
#if defined(_LIBCPP_ABI_MICROSOFT)
return ::set_terminate(func);
#else
return __sync_lock_test_and_set(&__terminate_handler, func);
#endif
}
terminate_handler
get_terminate() _NOEXCEPT
{
#if defined(_LIBCPP_ABI_MICROSOFT)
return ::_get_terminate();
#else
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
#endif
}
#ifndef __EMSCRIPTEN__ // We provide this in JS
_LIBCPP_NORETURN
void
terminate() _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
(*get_terminate())();
// handler should not return
fprintf(stderr, "terminate_handler unexpectedly returned\n");
::abort();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
// handler should not throw exception
fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
::abort();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
#endif // !__EMSCRIPTEN__
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT
{
#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
(defined(__APPLE__) || defined(_LIBCPPABI_VERSION))
// on Darwin, there is a helper function so __cxa_get_globals is private
# if _LIBCPPABI_VERSION > 1101
return __cxa_uncaught_exceptions();
# else
return __cxa_uncaught_exception() ? 1 : 0;
# endif
#elif defined(_LIBCPP_ABI_MICROSOFT)
return __uncaught_exceptions();
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("uncaught_exceptions not yet implemented")
# else
# warning uncaught_exception not yet implemented
# endif
fprintf(stderr, "uncaught_exceptions not yet implemented\n");
::abort();
#endif // __APPLE__
}
#ifndef _LIBCPPABI_VERSION
exception::~exception() _NOEXCEPT
{
}
const char* exception::what() const _NOEXCEPT
{
return "std::exception";
}
#endif // _LIBCPPABI_VERSION
#endif //LIBCXXRT
#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
bad_exception::~bad_exception() _NOEXCEPT
{
}
const char* bad_exception::what() const _NOEXCEPT
{
return "std::bad_exception";
}
#endif
#if defined(__GLIBCXX__)
// libsupc++ does not implement the dependent EH ABI and the functionality
// it uses to implement std::exception_ptr (which it declares as an alias of
// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
// we have little choice but to hijack std::__exception_ptr::exception_ptr's
// (which fortunately has the same layout as our std::exception_ptr) copy
// constructor, assignment operator and destructor (which are part of its
// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
// function.
namespace __exception_ptr
{
struct exception_ptr
{
void* __ptr_;
exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
};
}
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
#endif
exception_ptr::~exception_ptr() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_decrement_exception_refcount(__ptr_);
#elif defined(__GLIBCXX__) #elif defined(__GLIBCXX__)
reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr(); #include "support/runtime/exception_glibcxx.ipp"
#include "support/runtime/exception_pointer_glibcxx.ipp"
#else #else
# if defined(_MSC_VER) && ! defined(__clang__) #include "support/runtime/exception_fallback.ipp"
_LIBCPP_WARNING("exception_ptr not yet implemented") #include "support/runtime/exception_pointer_unimplemented.ipp"
# else
# warning exception_ptr not yet implemented
# endif
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#endif #endif
}
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_increment_exception_refcount(__ptr_);
#elif defined(__GLIBCXX__)
new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#endif
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
if (__ptr_ != other.__ptr_)
{
__cxa_increment_exception_refcount(other.__ptr_);
__cxa_decrement_exception_refcount(__ptr_);
__ptr_ = other.__ptr_;
}
return *this;
#elif defined(__GLIBCXX__)
*reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
return *this;
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#endif
}
nested_exception::nested_exception() _NOEXCEPT
: __ptr_(current_exception())
{
}
#if !defined(__GLIBCXX__)
nested_exception::~nested_exception() _NOEXCEPT
{
}
#endif
_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
{
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
}
#if !defined(__GLIBCXX__)
exception_ptr current_exception() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
// be nicer if there was a constructor that took a ptr, then
// this whole function would be just:
// return exception_ptr(__cxa_current_primary_exception());
exception_ptr ptr;
ptr.__ptr_ = __cxa_current_primary_exception();
return ptr;
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING( "exception_ptr not yet implemented" )
# else
# warning exception_ptr not yet implemented
# endif
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#endif
}
#endif // !__GLIBCXX__
_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
#elif defined(__GLIBCXX__)
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#endif
}
} // std

View File

@@ -1,28 +1,32 @@
//===------------------ directory_iterator.cpp ----------------------------===//
//
// 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 "experimental/filesystem" #include "experimental/filesystem"
#include "__config"
#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#else
#include <dirent.h> #include <dirent.h>
#endif
#include <errno.h> #include <errno.h>
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
namespace { namespace detail { namespace { namespace detail {
#if !defined(_LIBCPP_WIN32API)
inline error_code capture_errno() { inline error_code capture_errno() {
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero"); _LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
return error_code{errno, std::generic_category()}; return error_code{errno, std::generic_category()};
} }
#endif
template <class ...Args>
inline bool capture_error_or_throw(std::error_code* user_ec,
const char* msg, Args&&... args)
{
std::error_code my_ec = capture_errno();
if (user_ec) {
*user_ec = my_ec;
return true;
}
__throw_filesystem_error(msg, std::forward<Args>(args)..., my_ec);
return false;
}
template <class ...Args> template <class ...Args>
inline bool set_or_throw(std::error_code& my_ec, inline bool set_or_throw(std::error_code& my_ec,
@@ -37,25 +41,87 @@ inline bool set_or_throw(std::error_code& my_ec,
return false; return false;
} }
typedef path::string_type string_type; #if !defined(_LIBCPP_WIN32API)
inline path::string_type posix_readdir(DIR *dir_stream, error_code& ec) {
inline string_type posix_readdir(DIR *dir_stream, error_code& ec) {
struct dirent* dir_entry_ptr = nullptr; struct dirent* dir_entry_ptr = nullptr;
errno = 0; // zero errno in order to detect errors errno = 0; // zero errno in order to detect errors
ec.clear();
if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) { if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
if (errno)
ec = capture_errno(); ec = capture_errno();
return {}; return {};
} else { } else {
ec.clear();
return dir_entry_ptr->d_name; return dir_entry_ptr->d_name;
} }
} }
#endif
}} // namespace detail }} // namespace detail
using detail::set_or_throw; using detail::set_or_throw;
#if defined(_LIBCPP_WIN32API)
class __dir_stream {
public:
__dir_stream() = delete;
__dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& __ds) noexcept
: __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)),
__entry_(std::move(__ds.__entry_)) {
__ds.__stream_ = INVALID_HANDLE_VALUE;
}
__dir_stream(const path& root, directory_options opts, error_code& ec)
: __stream_(INVALID_HANDLE_VALUE), __root_(root) {
__stream_ = ::FindFirstFile(root.c_str(), &__data_);
if (__stream_ == INVALID_HANDLE_VALUE) {
ec = error_code(::GetLastError(), std::generic_category());
const bool ignore_permission_denied =
bool(opts & directory_options::skip_permission_denied);
if (ignore_permission_denied && ec.value() == ERROR_ACCESS_DENIED)
ec.clear();
return;
}
}
~__dir_stream() noexcept {
if (__stream_ == INVALID_HANDLE_VALUE)
return;
close();
}
bool good() const noexcept { return __stream_ != INVALID_HANDLE_VALUE; }
bool advance(error_code& ec) {
while (::FindNextFile(__stream_, &__data_)) {
if (!strcmp(__data_.cFileName, ".") || strcmp(__data_.cFileName, ".."))
continue;
__entry_.assign(__root_ / __data_.cFileName);
return true;
}
ec = error_code(::GetLastError(), std::generic_category());
close();
return false;
}
private:
std::error_code close() noexcept {
std::error_code ec;
if (!::FindClose(__stream_))
ec = error_code(::GetLastError(), std::generic_category());
__stream_ = INVALID_HANDLE_VALUE;
return ec;
}
HANDLE __stream_{INVALID_HANDLE_VALUE};
WIN32_FIND_DATA __data_;
public:
path __root_;
directory_entry __entry_;
};
#else
class __dir_stream { class __dir_stream {
public: public:
__dir_stream() = delete; __dir_stream() = delete;
@@ -117,6 +183,7 @@ public:
path __root_; path __root_;
directory_entry __entry_; directory_entry __entry_;
}; };
#endif
// directory_iterator // directory_iterator
@@ -149,7 +216,7 @@ directory_iterator& directory_iterator::__increment(error_code *ec)
} }
directory_entry const& directory_iterator::__deref() const { directory_entry const& directory_iterator::__dereference() const {
_LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator"); _LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator");
return __imp_->__entry_; return __imp_->__entry_;
} }
@@ -195,7 +262,7 @@ int recursive_directory_iterator::depth() const {
return __imp_->__stack_.size() - 1; return __imp_->__stack_.size() - 1;
} }
const directory_entry& recursive_directory_iterator::__deref() const { const directory_entry& recursive_directory_iterator::__dereference() const {
return __imp_->__stack_.top().__entry_; return __imp_->__stack_.top().__entry_;
} }

View File

@@ -35,12 +35,9 @@ namespace detail { namespace {
using value_type = path::value_type; using value_type = path::value_type;
using string_type = path::string_type; using string_type = path::string_type;
inline std::error_code capture_errno() { inline std::error_code capture_errno() {
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero"); _LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
std::error_code m_ec(errno, std::generic_category()); return std::error_code(errno, std::generic_category());
return m_ec;
} }
void set_or_throw(std::error_code const& m_ec, std::error_code* ec, void set_or_throw(std::error_code const& m_ec, std::error_code* ec,
@@ -886,23 +883,28 @@ path __system_complete(const path& p, std::error_code *ec) {
return absolute(p, current_path()); return absolute(p, current_path());
} }
path __temp_directory_path(std::error_code *ec) { path __temp_directory_path(std::error_code* ec) {
const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"}; const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
const char* ret = nullptr; const char* ret = nullptr;
for (auto & ep : env_paths) {
for (auto& ep : env_paths)
if ((ret = std::getenv(ep))) if ((ret = std::getenv(ep)))
break; break;
} if (ret == nullptr)
path p(ret ? ret : "/tmp"); ret = "/tmp";
path p(ret);
std::error_code m_ec; std::error_code m_ec;
if (is_directory(p, m_ec)) { if (!exists(p, m_ec) || !is_directory(p, m_ec)) {
if (ec) ec->clear();
return p;
}
if (!m_ec || m_ec == make_error_code(errc::no_such_file_or_directory)) if (!m_ec || m_ec == make_error_code(errc::no_such_file_or_directory))
m_ec = make_error_code(errc::not_a_directory); m_ec = make_error_code(errc::not_a_directory);
set_or_throw(m_ec, ec, "temp_directory_path"); set_or_throw(m_ec, ec, "temp_directory_path");
return {}; return {};
}
if (ec)
ec->clear();
return p;
} }
// An absolute path is composed according to the table in [fs.op.absolute]. // An absolute path is composed according to the table in [fs.op.absolute].

View File

@@ -6,11 +6,9 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#undef NDEBUG
#include "experimental/filesystem" #include "experimental/filesystem"
#include "string_view" #include "string_view"
#include "utility" #include "utility"
#include "cassert"
namespace { namespace parser namespace { namespace parser
{ {
@@ -58,13 +56,13 @@ public:
} }
PosPtr peek() const noexcept { PosPtr peek() const noexcept {
auto End = &Path.back() + 1;
auto TkEnd = getNextTokenStartPos(); auto TkEnd = getNextTokenStartPos();
auto End = getAfterBack();
return TkEnd == End ? nullptr : TkEnd; return TkEnd == End ? nullptr : TkEnd;
} }
void increment() noexcept { void increment() noexcept {
const PosPtr End = &Path.back() + 1; const PosPtr End = getAfterBack();
const PosPtr Start = getNextTokenStartPos(); const PosPtr Start = getNextTokenStartPos();
if (Start == End) if (Start == End)
return makeState(PS_AtEnd); return makeState(PS_AtEnd);
@@ -111,9 +109,8 @@ public:
} }
void decrement() noexcept { void decrement() noexcept {
const PosPtr REnd = &Path.front() - 1; const PosPtr REnd = getBeforeFront();
const PosPtr RStart = getCurrentTokenStartPos() - 1; const PosPtr RStart = getCurrentTokenStartPos() - 1;
assert(RStart != REnd);
switch (State) { switch (State) {
case PS_AtEnd: { case PS_AtEnd: {
@@ -198,19 +195,27 @@ private:
RawEntry = {}; RawEntry = {};
} }
PosPtr getAfterBack() const noexcept {
return Path.data() + Path.size();
}
PosPtr getBeforeFront() const noexcept {
return Path.data() - 1;
}
/// \brief Return a pointer to the first character after the currently /// \brief Return a pointer to the first character after the currently
/// lexed element. /// lexed element.
PosPtr getNextTokenStartPos() const noexcept { PosPtr getNextTokenStartPos() const noexcept {
switch (State) { switch (State) {
case PS_BeforeBegin: case PS_BeforeBegin:
return &Path.front(); return Path.data();
case PS_InRootName: case PS_InRootName:
case PS_InRootDir: case PS_InRootDir:
case PS_InFilenames: case PS_InFilenames:
return &RawEntry.back() + 1; return &RawEntry.back() + 1;
case PS_InTrailingSep: case PS_InTrailingSep:
case PS_AtEnd: case PS_AtEnd:
return &Path.back() + 1; return getAfterBack();
} }
_LIBCPP_UNREACHABLE(); _LIBCPP_UNREACHABLE();
} }
@@ -322,7 +327,6 @@ string_view_t path::__root_path_raw() const
auto NextCh = PP.peek(); auto NextCh = PP.peek();
if (NextCh && *NextCh == '/') { if (NextCh && *NextCh == '/') {
++PP; ++PP;
assert(PP.State == PathParser::PS_InRootDir);
return createView(__pn_.data(), &PP.RawEntry.back()); return createView(__pn_.data(), &PP.RawEntry.back());
} }
return PP.RawEntry; return PP.RawEntry;

View File

@@ -29,7 +29,7 @@
#endif #endif
#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
# if defined(_MSC_VER) && !defined(__clang__) # if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
# else # else
# warning Building libc++ without __atomic builtins is unsupported # warning Building libc++ without __atomic builtins is unsupported

View File

@@ -582,10 +582,8 @@ locale::global(const locale& loc)
locale& g = __global(); locale& g = __global();
locale r = g; locale r = g;
g = loc; g = loc;
#ifndef __CloudABI__
if (g.name() != "*") if (g.name() != "*")
setlocale(LC_ALL, g.name().c_str()); setlocale(LC_ALL, g.name().c_str());
#endif
return r; return r;
} }

View File

@@ -11,7 +11,6 @@
#include "mutex" #include "mutex"
#include "limits" #include "limits"
#include "system_error" #include "system_error"
#include "cassert"
#include "include/atomic_support.h" #include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -45,7 +44,7 @@ mutex::unlock() _NOEXCEPT
{ {
int ec = __libcpp_mutex_unlock(&__m_); int ec = __libcpp_mutex_unlock(&__m_);
(void)ec; (void)ec;
assert(ec == 0); _LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed");
} }
// recursive_mutex // recursive_mutex
@@ -61,7 +60,7 @@ recursive_mutex::~recursive_mutex()
{ {
int e = __libcpp_recursive_mutex_destroy(&__m_); int e = __libcpp_recursive_mutex_destroy(&__m_);
(void)e; (void)e;
assert(e == 0); _LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed");
} }
void void
@@ -77,7 +76,7 @@ recursive_mutex::unlock() _NOEXCEPT
{ {
int e = __libcpp_recursive_mutex_unlock(&__m_); int e = __libcpp_recursive_mutex_unlock(&__m_);
(void)e; (void)e;
assert(e == 0); _LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed");
} }
bool bool

View File

@@ -13,27 +13,48 @@
#include "new" #include "new"
#if defined(__APPLE__) && !defined(LIBCXXRT) && \ #if defined(_LIBCPP_ABI_MICROSOFT)
!defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) // nothing todo
#include <cxxabi.h> #elif defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h>
#ifndef _LIBCPPABI_VERSION #elif defined(LIBCXXRT)
// On Darwin, there are two STL shared libraries and a lower level ABI #include <cxxabi.h>
// shared library. The global holding the current new handler is #include "support/runtime/new_handler_fallback.ipp"
// in the ABI library and named __cxa_new_handler. #elif defined(__GLIBCXX__)
#define __new_handler __cxxabiapple::__cxa_new_handler // nothing todo
#endif #else
#else // __APPLE__ # if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) # include <cxxabi.h> // FIXME: remove this once buildit is gone.
#include <cxxabi.h> # else
#endif // defined(LIBCXX_BUILDING_LIBCXXABI) # include "support/runtime/new_handler_fallback.ipp"
#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \ # endif
(!defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__))
static std::new_handler __new_handler;
#endif // _LIBCPPABI_VERSION
#endif #endif
namespace std
{
#ifndef __GLIBCXX__ #ifndef __GLIBCXX__
const nothrow_t nothrow = {};
#endif
#ifndef LIBSTDCXX
void
__throw_bad_alloc()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_alloc();
#else
_VSTD::abort();
#endif
}
#endif // !LIBSTDCXX
} // std
#if !defined(__GLIBCXX__) && !defined(_LIBCPP_ABI_MICROSOFT) && \
!defined(_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS)
// Implement all new and delete operators as weak definitions // Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overridden by programs // in this shared library, so that they can be overridden by programs
@@ -277,107 +298,5 @@ operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
::operator delete[](ptr, alignment); ::operator delete[](ptr, alignment);
} }
#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) #endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif // !__GLIBCXX__ && !_LIBCPP_ABI_MICROSOFT && !_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
#endif // !__GLIBCXX__
namespace std
{
#ifndef __GLIBCXX__
const nothrow_t nothrow = {};
#endif
#ifndef _LIBCPPABI_VERSION
#ifndef __GLIBCXX__
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
return __sync_lock_test_and_set(&__new_handler, handler);
}
new_handler
get_new_handler() _NOEXCEPT
{
return __sync_fetch_and_add(&__new_handler, nullptr);
}
#endif // !__GLIBCXX__
#ifndef LIBCXXRT
bad_alloc::bad_alloc() _NOEXCEPT
{
}
#ifndef __GLIBCXX__
bad_alloc::~bad_alloc() _NOEXCEPT
{
}
const char*
bad_alloc::what() const _NOEXCEPT
{
return "std::bad_alloc";
}
#endif // !__GLIBCXX__
bad_array_new_length::bad_array_new_length() _NOEXCEPT
{
}
#ifndef __GLIBCXX__
bad_array_new_length::~bad_array_new_length() _NOEXCEPT
{
}
const char*
bad_array_new_length::what() const _NOEXCEPT
{
return "bad_array_new_length";
}
#endif // !__GLIBCXX__
#endif //LIBCXXRT
bad_array_length::bad_array_length() _NOEXCEPT
{
}
#ifndef __GLIBCXX__
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
#endif // !__GLIBCXX__
#endif // _LIBCPPABI_VERSION
#ifndef LIBSTDCXX
void
__throw_bad_alloc()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_alloc();
#else
_VSTD::abort();
#endif
}
#endif // !LIBSTDCXX
} // std

View File

@@ -15,6 +15,10 @@ namespace std
bad_optional_access::~bad_optional_access() _NOEXCEPT = default; bad_optional_access::~bad_optional_access() _NOEXCEPT = default;
const char* bad_optional_access::what() const _NOEXCEPT {
return "bad_optional_access";
}
} // std } // std
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL

View File

@@ -0,0 +1,182 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#include <cstdio>
namespace std {
_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
// libcxxrt provides implementations of these functions itself.
unexpected_handler
set_unexpected(unexpected_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__unexpected_handler, func);
}
unexpected_handler
get_unexpected() _NOEXCEPT
{
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
}
_LIBCPP_NORETURN
void unexpected()
{
(*get_unexpected())();
// unexpected handler should not return
terminate();
}
terminate_handler
set_terminate(terminate_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__terminate_handler, func);
}
terminate_handler
get_terminate() _NOEXCEPT
{
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
}
#ifndef __EMSCRIPTEN__ // We provide this in JS
_LIBCPP_NORETURN
void
terminate() _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
(*get_terminate())();
// handler should not return
fprintf(stderr, "terminate_handler unexpectedly returned\n");
::abort();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
// handler should not throw exception
fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
::abort();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
#endif // !__EMSCRIPTEN__
#if !defined(__EMSCRIPTEN__)
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT
{
#warning uncaught_exception not yet implemented
fprintf(stderr, "uncaught_exceptions not yet implemented\n");
::abort();
}
#endif // !__EMSCRIPTEN__
exception::~exception() _NOEXCEPT
{
}
const char* exception::what() const _NOEXCEPT
{
return "std::exception";
}
bad_exception::~bad_exception() _NOEXCEPT
{
}
const char* bad_exception::what() const _NOEXCEPT
{
return "std::bad_exception";
}
bad_alloc::bad_alloc() _NOEXCEPT
{
}
bad_alloc::~bad_alloc() _NOEXCEPT
{
}
const char*
bad_alloc::what() const _NOEXCEPT
{
return "std::bad_alloc";
}
bad_array_new_length::bad_array_new_length() _NOEXCEPT
{
}
bad_array_new_length::~bad_array_new_length() _NOEXCEPT
{
}
const char*
bad_array_new_length::what() const _NOEXCEPT
{
return "bad_array_new_length";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
bad_cast::bad_cast() _NOEXCEPT
{
}
bad_typeid::bad_typeid() _NOEXCEPT
{
}
bad_cast::~bad_cast() _NOEXCEPT
{
}
const char*
bad_cast::what() const _NOEXCEPT
{
return "std::bad_cast";
}
bad_typeid::~bad_typeid() _NOEXCEPT
{
}
const char*
bad_typeid::what() const _NOEXCEPT
{
return "std::bad_typeid";
}
} // namespace std

View File

@@ -0,0 +1,38 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#ifndef __GLIBCXX__
#error header can only be used when targeting libstdc++ or libsupc++
#endif
namespace std {
bad_alloc::bad_alloc() _NOEXCEPT
{
}
bad_array_new_length::bad_array_new_length() _NOEXCEPT
{
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_cast::bad_cast() _NOEXCEPT
{
}
bad_typeid::bad_typeid() _NOEXCEPT
{
}
} // namespace std

View File

@@ -0,0 +1,28 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPPABI_VERSION
#error this header can only be used with libc++abi
#endif
namespace std {
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT
{
# if _LIBCPPABI_VERSION > 1101
return __cxa_uncaught_exceptions();
# else
return __cxa_uncaught_exception() ? 1 : 0;
# endif
}
} // namespace std

View File

@@ -0,0 +1,41 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#ifndef LIBCXXRT
#error this header may only be used when targeting libcxxrt
#endif
namespace std {
bad_exception::~bad_exception() _NOEXCEPT
{
}
const char* bad_exception::what() const _NOEXCEPT
{
return "std::bad_exception";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
} // namespace std

View File

@@ -0,0 +1,89 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_ABI_MICROSOFT
#error this header can only be used when targeting the MSVC ABI
#endif
#include <stdio.h>
#include <stdlib.h>
#include <eh.h>
#include <corecrt_terminate.h>
namespace std {
// libcxxrt provides implementations of these functions itself.
unexpected_handler
set_unexpected(unexpected_handler func) _NOEXCEPT {
return ::set_unexpected(func);
}
unexpected_handler get_unexpected() _NOEXCEPT {
return ::_get_unexpected();
}
_LIBCPP_NORETURN
void unexpected() {
(*get_unexpected())();
// unexpected handler should not return
terminate();
}
terminate_handler set_terminate(terminate_handler func) _NOEXCEPT {
return ::set_terminate(func);
}
terminate_handler get_terminate() _NOEXCEPT {
return ::_get_terminate();
}
_LIBCPP_NORETURN
void terminate() _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
(*get_terminate())();
// handler should not return
fprintf(stderr, "terminate_handler unexpectedly returned\n");
::abort();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
// handler should not throw exception
fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
::abort();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT {
return __uncaught_exceptions();
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
} // namespace std

View File

@@ -0,0 +1,74 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#ifndef HAVE_DEPENDENT_EH_ABI
#error this header may only be used with libc++abi or libcxxrt
#endif
namespace std {
exception_ptr::~exception_ptr() _NOEXCEPT {
__cxa_decrement_exception_refcount(__ptr_);
}
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
__cxa_increment_exception_refcount(__ptr_);
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
if (__ptr_ != other.__ptr_)
{
__cxa_increment_exception_refcount(other.__ptr_);
__cxa_decrement_exception_refcount(__ptr_);
__ptr_ = other.__ptr_;
}
return *this;
}
nested_exception::nested_exception() _NOEXCEPT
: __ptr_(current_exception())
{
}
nested_exception::~nested_exception() _NOEXCEPT
{
}
_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
{
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
}
exception_ptr current_exception() _NOEXCEPT
{
// be nicer if there was a constructor that took a ptr, then
// this whole function would be just:
// return exception_ptr(__cxa_current_primary_exception());
exception_ptr ptr;
ptr.__ptr_ = __cxa_current_primary_exception();
return ptr;
}
_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
}
} // namespace std

View File

@@ -0,0 +1,78 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
// libsupc++ does not implement the dependent EH ABI and the functionality
// it uses to implement std::exception_ptr (which it declares as an alias of
// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
// we have little choice but to hijack std::__exception_ptr::exception_ptr's
// (which fortunately has the same layout as our std::exception_ptr) copy
// constructor, assignment operator and destructor (which are part of its
// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
// function.
namespace std {
namespace __exception_ptr
{
struct exception_ptr
{
void* __ptr_;
exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
};
}
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
exception_ptr::~exception_ptr() _NOEXCEPT
{
reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
}
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
*reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
return *this;
}
nested_exception::nested_exception() _NOEXCEPT
: __ptr_(current_exception())
{
}
_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
{
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
}
_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
}
} // namespace std

View File

@@ -0,0 +1,80 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
#include <stdlib.h>
namespace std {
exception_ptr::~exception_ptr() _NOEXCEPT
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
nested_exception::nested_exception() _NOEXCEPT
: __ptr_(current_exception())
{
}
#if !defined(__GLIBCXX__)
nested_exception::~nested_exception() _NOEXCEPT
{
}
#endif
_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#if 0
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
#endif // FIXME
}
exception_ptr current_exception() _NOEXCEPT
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
# warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
} // namespace std

View File

@@ -0,0 +1,27 @@
// -*- 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.
//
//===----------------------------------------------------------------------===//
namespace std {
_LIBCPP_SAFE_STATIC static std::new_handler __new_handler;
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
return __sync_lock_test_and_set(&__new_handler, handler);
}
new_handler
get_new_handler() _NOEXCEPT
{
return __sync_fetch_and_add(&__new_handler, nullptr);
}
} // namespace std

View File

@@ -17,9 +17,9 @@
#include "cstring" #include "cstring"
#include "cstdio" #include "cstdio"
#include "cstdlib" #include "cstdlib"
#include "cassert"
#include "string" #include "string"
#include "string.h" #include "string.h"
#include "__debug"
#if defined(__ANDROID__) #if defined(__ANDROID__)
#include <android/api-level.h> #include <android/api-level.h>
@@ -96,7 +96,7 @@ string do_strerror_r(int ev) {
std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev); std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev);
return string(buffer); return string(buffer);
} else { } else {
assert(new_errno == ERANGE); _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerr_r");
// FIXME maybe? 'strerror_buff_size' is likely to exceed the // FIXME maybe? 'strerror_buff_size' is likely to exceed the
// maximum error size so ERANGE shouldn't be returned. // maximum error size so ERANGE shouldn't be returned.
std::abort(); std::abort();

View File

@@ -24,9 +24,9 @@
# endif // defined(BSD) # endif // defined(BSD)
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__)
# include <unistd.h> # include <unistd.h>
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__)
#if defined(__NetBSD__) #if defined(__NetBSD__)
#pragma weak pthread_create // Do not create libpthread dependency #pragma weak pthread_create // Do not create libpthread dependency
@@ -99,7 +99,7 @@ thread::hardware_concurrency() _NOEXCEPT
#else // defined(CTL_HW) && defined(HW_NCPU) #else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar // TODO: grovel through /proc or check cpuid on x86 and similar
// instructions on other architectures. // instructions on other architectures.
# if defined(_MSC_VER) && ! defined(__clang__) # if defined(_LIBCPP_MSVC)
_LIBCPP_WARNING("hardware_concurrency not yet implemented") _LIBCPP_WARNING("hardware_concurrency not yet implemented")
# else # else
# warning hardware_concurrency not yet implemented # warning hardware_concurrency not yet implemented
@@ -114,33 +114,9 @@ namespace this_thread
void void
sleep_for(const chrono::nanoseconds& ns) sleep_for(const chrono::nanoseconds& ns)
{ {
using namespace chrono; if (ns > chrono::nanoseconds::zero())
if (ns > nanoseconds::zero())
{ {
#if defined(_LIBCPP_WIN32API) __libcpp_thread_sleep_for(ns);
milliseconds ms = duration_cast<milliseconds>(ns);
if (ms.count() == 0 || ns > duration_cast<nanoseconds>(ms))
++ms;
Sleep(ms.count());
#else
seconds s = duration_cast<seconds>(ns);
timespec ts;
typedef decltype(ts.tv_sec) ts_sec;
_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
if (s.count() < ts_sec_max)
{
ts.tv_sec = static_cast<ts_sec>(s.count());
ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((ns-s).count());
}
else
{
ts.tv_sec = ts_sec_max;
ts.tv_nsec = giga::num - 1;
}
while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
;
#endif
} }
} }

View File

@@ -6,74 +6,15 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include <stdlib.h>
#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
(defined(__APPLE__) || defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI))
#include <cxxabi.h>
#endif
#include "typeinfo" #include "typeinfo"
#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \ // FIXME: Remove __APPLE__ default here once buildit is gone.
defined(_LIBCPP_ABI_MICROSOFT) // FIXME: This is a temporary workaround #if (!defined(_LIBCPP_ABI_MICROSOFT) && !defined(LIBCXX_BUILDING_LIBCXXABI) && \
!defined(LIBCXXRT) && !defined(__GLIBCXX__) && \
!defined(__APPLE__)) || \
defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) // FIXME: remove this configuration.
std::type_info::~type_info() std::type_info::~type_info()
{ {
} }
#endif #endif
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
std::bad_cast::bad_cast() _NOEXCEPT
{
}
std::bad_typeid::bad_typeid() _NOEXCEPT
{
}
#ifndef __GLIBCXX__
std::bad_cast::~bad_cast() _NOEXCEPT
{
}
const char*
std::bad_cast::what() const _NOEXCEPT
{
return "std::bad_cast";
}
std::bad_typeid::~bad_typeid() _NOEXCEPT
{
}
const char*
std::bad_typeid::what() const _NOEXCEPT
{
return "std::bad_typeid";
}
#if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
// On Darwin, the cxa_bad_* functions cannot be in the lower level library
// because bad_cast and bad_typeid are defined in his higher level library
void __cxxabiv1::__cxa_bad_typeid()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_typeid();
#else
_VSTD::abort();
#endif
}
void __cxxabiv1::__cxa_bad_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_cast();
#else
_VSTD::abort();
#endif
}
#endif
#endif // !__GLIBCXX__
#endif // !LIBCXXRT && !_LIBCPPABI_VERSION

View File

@@ -1,5 +1,3 @@
include(AddLLVM) # for add_lit_testsuite
macro(pythonize_bool var) macro(pythonize_bool var)
if (${var}) if (${var})
set(${var} True) set(${var} True)
@@ -62,21 +60,28 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
set(LIBCXX_TEST_DEPS cxx_experimental) set(LIBCXX_TEST_DEPS cxx_experimental)
endif() endif()
if (LIBCXX_HAS_EXTERNAL_THREAD_API) if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
list(APPEND LIBCXX_TEST_DEPS cxx_external_threads) list(APPEND LIBCXX_TEST_DEPS cxx_external_threads)
endif() endif()
add_lit_testsuite(check-cxx if (LIBCXX_INCLUDE_TESTS)
include(AddLLVM) # for add_lit_testsuite
add_lit_testsuite(check-cxx
"Running libcxx tests" "Running libcxx tests"
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS cxx ${LIBCXX_TEST_DEPS}) DEPENDS cxx ${LIBCXX_TEST_DEPS})
add_custom_target(check-libcxx DEPENDS check-cxx) add_custom_target(check-libcxx DEPENDS check-cxx)
endif()
if (LIBCXX_GENERATE_COVERAGE) if (LIBCXX_GENERATE_COVERAGE)
include(CodeCoverage) include(CodeCoverage)
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage") set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")
set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${LIBCXX_LIB_CMAKEFILES_DIR}/cxx_experimental.dir/;${CMAKE_CURRENT_BINARY_DIR}") set(capture_dirs
"${LIBCXX_LIB_CMAKEFILES_DIR}/cxx_objects.dir/"
"${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/"
"${LIBCXX_LIB_CMAKEFILES_DIR}/cxx_experimental.dir/"
"${CMAKE_CURRENT_BINARY_DIR}")
set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src") set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}") setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
endif() endif()

View File

@@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic ignored "-W#warnings"
#endif
#define min THIS IS A NASTY MACRO!
#define max THIS IS A NASTY MACRO!
#include <map>
int main() {
std::map<int, int> m;
((void)m);
}

View File

@@ -0,0 +1,70 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// REQUIRES: diagnose-if-support
// UNSUPPORTED: c++98, c++03
// Libc++ only provides a defined primary template for std::hash in C++14 and
// newer.
// UNSUPPORTED: c++11
// <unordered_set>
// Test that we generate a reasonable diagnostic when the specified hash is
// not enabled.
#include <unordered_set>
#include <utility>
using VT = std::pair<int, int>;
struct BadHashNoCopy {
BadHashNoCopy() = default;
BadHashNoCopy(BadHashNoCopy const&) = delete;
template <class T>
size_t operator()(T const&) const { return 0; }
};
struct BadHashNoCall {
};
struct GoodHashNoDefault {
explicit GoodHashNoDefault(void*) {}
template <class T>
size_t operator()(T const&) const { return 0; }
};
int main() {
{
using Set = std::unordered_set<VT>;
Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}}
// FIXME: It would be great to suppress the below diagnostic all together.
// but for now it's sufficient that it appears last. However there is
// currently no way to test the order diagnostics are issued.
// expected-error@memory:* {{call to implicitly-deleted default constructor of 'std::__1::hash<std::__1::pair<int, int> >'}}
}
{
using Set = std::unordered_set<int, BadHashNoCopy>;
Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}}
}
{
using Set = std::unordered_set<int, BadHashNoCall>;
Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}}
}
{
using Set = std::unordered_set<int, GoodHashNoDefault>;
Set s(/*bucketcount*/42, GoodHashNoDefault(nullptr));
}
}

View File

@@ -9,11 +9,14 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr // UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
// MODULES_DEFINES: _LIBCPP_DEBUG=1
// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS
// test container debugging // test container debugging
#define _LIBCPP_DEBUG 1 #define _LIBCPP_DEBUG 1
#define _LIBCPP_DEBUG_USE_EXCEPTIONS #define _LIBCPP_DEBUG_USE_EXCEPTIONS
#include <map> #include <map>
#include <set> #include <set>
#include <utility> #include <utility>

View File

@@ -9,6 +9,8 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr // UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
// MODULES_DEFINES: _LIBCPP_DEBUG=1
// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS
// test container debugging // test container debugging

View File

@@ -9,6 +9,8 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr // UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
// MODULES_DEFINES: _LIBCPP_DEBUG=1
// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS
// test container debugging // test container debugging

View File

@@ -9,6 +9,8 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr // UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
// MODULES_DEFINES: _LIBCPP_DEBUG=1
// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS
// test container debugging // test container debugging

View File

@@ -7,6 +7,9 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// MODULES_DEFINES: _LIBCPP_DEBUG=0
// Test that the default debug handler aborts the program. // Test that the default debug handler aborts the program.
#define _LIBCPP_DEBUG 0 #define _LIBCPP_DEBUG 0

View File

@@ -7,7 +7,9 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-no-exceptions
// MODULES_DEFINES: _LIBCPP_DEBUG=0
// Test that the default debug handler can be overridden and test the // Test that the default debug handler can be overridden and test the
// throwing debug handler. // throwing debug handler.

View File

@@ -7,7 +7,10 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-no-exceptions
// MODULES_DEFINES: _LIBCPP_DEBUG=1
// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS
// Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT // Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT
// to throw on failure. // to throw on failure.

View File

@@ -16,6 +16,8 @@
// However, for backwards compatibility, if _LIBCPP_NO_REMOVE_AUTOPTR // However, for backwards compatibility, if _LIBCPP_NO_REMOVE_AUTOPTR
// is defined before including <memory>, then auto_ptr will be restored. // is defined before including <memory>, then auto_ptr will be restored.
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
#include <memory> #include <memory>

View File

@@ -0,0 +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.
//
//===----------------------------------------------------------------------===//
// Test that defining _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES correctly defines
// _LIBCPP_ENABLE_CXX17_REMOVED_FOO for each individual component macro.
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#define _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
#include <__config>
#ifndef _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#error _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS must be defined
#endif
#ifndef _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
#error _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR must be defined
#endif
int main() {
}

View File

@@ -0,0 +1,42 @@
//===----------------------------------------------------------------------===//
//
// 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 get_unexpected
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#include <exception>
#include <cassert>
#include <cstdlib>
void f1() {}
void f2() {}
void f3()
{
std::exit(0);
}
int main()
{
std::unexpected_handler old = std::get_unexpected();
// verify there is a previous unexpected handler
assert(old);
std::set_unexpected(f1);
assert(std::get_unexpected() == f1);
// verify f1 was replace with f2
std::set_unexpected(f2);
assert(std::get_unexpected() == f2);
// verify calling original unexpected handler calls terminate
std::set_terminate(f3);
(*old)();
assert(0);
}

View File

@@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// 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 set_unexpected
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#include <exception>
#include <cassert>
#include <cstdlib>
void f1() {}
void f2() {}
void f3()
{
std::exit(0);
}
int main()
{
std::unexpected_handler old = std::set_unexpected(f1);
// verify there is a previous unexpected handler
assert(old);
// verify f1 was replace with f2
assert(std::set_unexpected(f2) == f1);
// verify calling original unexpected handler calls terminate
std::set_terminate(f3);
(*old)();
assert(0);
}

View File

@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===//
//
// 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 unexpected
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#include <exception>
#include <cstdlib>
#include <cassert>
void fexit()
{
std::exit(0);
}
int main()
{
std::set_unexpected(fexit);
std::unexpected();
assert(false);
}

View File

@@ -0,0 +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, c++11, c++14
// test unexpected
#include <exception>
void f() {}
int main() {
using T = std::unexpected_handler; // expected-error {{no type named 'unexpected_handler' in namespace 'std'}}
std::unexpected(); // expected-error {{no member named 'unexpected' in namespace 'std'}}
std::get_unexpected(); // expected-error {{no member named 'get_unexpected' in namespace 'std'}}
std::set_unexpected(f); // expected-error {{no type named 'set_unexpected' in namespace 'std'}}
}

View File

@@ -1,65 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++experimental
// UNSUPPORTED: c++98, c++03
// <experimental/memory_resource>
// template <class T> class polymorphic_allocator
// EXTENSION
// std::size_t polymorphic_allocator<T>::max_size() const noexcept
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
#include "test_memory_resource.hpp"
namespace ex = std::experimental::pmr;
template <std::size_t S>
std::size_t getMaxSize() {
using T = typename std::aligned_storage<S>::type;
static_assert(sizeof(T) == S, "Required for test");
return ex::polymorphic_allocator<T>{}.max_size();
}
template <std::size_t S, std::size_t A>
std::size_t getMaxSize() {
using T = typename std::aligned_storage<S, A>::type;
static_assert(sizeof(T) == S, "Required for test");
return ex::polymorphic_allocator<T>{}.max_size();
}
int main()
{
{
using Alloc = ex::polymorphic_allocator<int>;
using Traits = std::allocator_traits<Alloc>;
const Alloc a;
static_assert(std::is_same<decltype(a.max_size()), Traits::size_type>::value, "");
static_assert(noexcept(a.max_size()), "");
}
{
constexpr std::size_t Max = std::numeric_limits<std::size_t>::max();
assert(getMaxSize<1>() == Max);
assert(getMaxSize<2>() == Max / 2);
assert(getMaxSize<4>() == Max / 4);
assert(getMaxSize<8>() == Max / 8);
assert(getMaxSize<16>() == Max / 16);
assert(getMaxSize<32>() == Max / 32);
assert(getMaxSize<64>() == Max / 64);
assert(getMaxSize<1024>() == Max / 1024);
assert((getMaxSize<6, 2>() == Max / 6));
assert((getMaxSize<12, 4>() == Max / 12));
}
}

View File

@@ -12,6 +12,7 @@
// TODO(EricWF) Investigate why typeid(...).name() returns a different string // TODO(EricWF) Investigate why typeid(...).name() returns a different string
// on GCC 4.9 but not newer GCCs. // on GCC 4.9 but not newer GCCs.
// XFAIL: gcc-4.9 // XFAIL: gcc-4.9
// XFAIL: windows
// THIS TESTS C++03 EXTENSIONS. // THIS TESTS C++03 EXTENSIONS.

View File

@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external // UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// REQUIRES: libcpp-has-thread-api-pthread
// <thread> // <thread>

View File

@@ -76,7 +76,7 @@ void check_enum_types()
enum enum1 { zero = 0, one = 1 }; enum enum1 { zero = 0, one = 1 };
enum enum2 { enum enum2 : unsigned long {
value = std::numeric_limits<unsigned long>::max() value = std::numeric_limits<unsigned long>::max()
}; };

View File

@@ -1,55 +0,0 @@
#===----------------------------------------------------------------------===##
#
# 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.
#
#===----------------------------------------------------------------------===##
from contextlib import contextmanager
import os
import tempfile
def cleanFile(filename):
try:
os.remove(filename)
except OSError:
pass
@contextmanager
def guardedTempFilename(suffix='', prefix='', dir=None):
# Creates and yeilds a temporary filename within a with statement. The file
# is removed upon scope exit.
handle, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)
os.close(handle)
yield name
cleanFile(name)
@contextmanager
def guardedFilename(name):
# yeilds a filename within a with statement. The file is removed upon scope
# exit.
yield name
cleanFile(name)
@contextmanager
def nullContext(value):
# yeilds a variable within a with statement. No action is taken upon scope
# exit.
yield value
def makeReport(cmd, out, err, rc):
report = "Command: %s\n" % cmd
report += "Exit Code: %d\n" % rc
if out:
report += "Standard Output:\n--\n%s--\n" % out
if err:
report += "Standard Error:\n--\n%s--\n" % err
report += '\n'
return report

View File

@@ -129,7 +129,7 @@ private:
}; };
//============================================================================== //==============================================================================
// DerivedFromBase - A type that derives from it's template argument 'Base' // DerivedFromBase - A type that derives from its template argument 'Base'
template <class Base> template <class Base>
struct DerivedFromType : public Base { struct DerivedFromType : public Base {
DerivedFromType() : Base() {} DerivedFromType() : Base() {}
@@ -138,7 +138,7 @@ struct DerivedFromType : public Base {
}; };
//============================================================================== //==============================================================================
// DerefToType - A type that dereferences to it's template argument 'To'. // DerefToType - A type that dereferences to its template argument 'To'.
// The cv-ref qualifiers of the 'DerefToType' object do not propagate // The cv-ref qualifiers of the 'DerefToType' object do not propagate
// to the resulting 'To' object. // to the resulting 'To' object.
template <class To> template <class To>
@@ -154,7 +154,7 @@ struct DerefToType {
}; };
//============================================================================== //==============================================================================
// DerefPropToType - A type that dereferences to it's template argument 'To'. // DerefPropToType - A type that dereferences to its template argument 'To'.
// The cv-ref qualifiers of the 'DerefPropToType' object propagate // The cv-ref qualifiers of the 'DerefPropToType' object propagate
// to the resulting 'To' object. // to the resulting 'To' object.
template <class To> template <class To>

View File

@@ -0,0 +1,41 @@
//===----------------------------------------------------------------------===//
//
// 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 that UBSAN doesn't generate unsigned integer overflow diagnostics
// from within the hashing internals.
#include <utility>
#include <cstdint>
#include <limits>
#include <string>
#include "test_macros.h"
typedef std::__murmur2_or_cityhash<uint32_t> Hash32;
typedef std::__murmur2_or_cityhash<uint64_t> Hash64;
void test(const void* key, int len) {
for (int i=1; i <= len; ++i) {
Hash32 h1;
Hash64 h2;
DoNotOptimize(h1(key, i));
DoNotOptimize(h2(key, i));
}
}
int main() {
const std::string TestCases[] = {
"abcdaoeuaoeclaoeoaeuaoeuaousaotehu]+}sthoasuthaoesutahoesutaohesutaoeusaoetuhasoetuhaoseutaoseuthaoesutaohes"
"00000000000000000000000000000000000000000000000000000000000000000000000",
"1237546895+54+4554985416849484213464984765465464654564565645645646546456546546"
};
const size_t NumCases = sizeof(TestCases)/sizeof(TestCases[0]);
for (size_t i=0; i < NumCases; ++i)
test(TestCases[i].data(), TestCases[i].length());
}

View File

@@ -12,7 +12,7 @@
// The following compilers don't generate constexpr special members correctly. // The following compilers don't generate constexpr special members correctly.
// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 // XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8 // XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
// <variant> // <variant>

View File

@@ -12,7 +12,7 @@
// The following compilers don't generate constexpr special members correctly. // The following compilers don't generate constexpr special members correctly.
// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 // XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8 // XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
// <variant> // <variant>

Some files were not shown because too many files have changed in this diff Show More