1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

Vendor import of libc++ trunk r256633:

https://llvm.org/svn/llvm-project/libcxx/trunk@256633
This commit is contained in:
Dimitry Andric 2015-12-30 11:54:09 +00:00
parent 61b9a7258a
commit b4c64ad90b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/libc++/dist/; revision=292928
svn path=/vendor/libc++/r256633/; revision=292930; tag=vendor/libc++/r256633
809 changed files with 24752 additions and 10143 deletions

View File

@ -3,13 +3,16 @@
#===============================================================================
# Setup Project
#===============================================================================
project(libcxx CXX C)
cmake_minimum_required(VERSION 2.8)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
endif()
if(POLICY CMP0022)
cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
endif()
project(libcxx CXX C)
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION trunk-svn)
@ -30,61 +33,40 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXX_LIBDIR_SUFFIX "" CACHE STRING
"Define suffix of library directory name (32/64)")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(LIBCXX_BUILT_STANDALONE 1)
else()
set(LIBCXX_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
# Find the LLVM sources and simulate LLVM CMake options.
include(HandleOutOfTreeLLVM)
if (LIBCXX_BUILT_STANDALONE AND NOT LLVM_FOUND)
message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
"llvm-config not found and LLVM_PATH not defined.\n"
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
"or -DLLVM_PATH=path/to/llvm-source-root.")
endif()
#===============================================================================
# Setup CMake Options
#===============================================================================
# Define options.
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
# Basic options ---------------------------------------------------------------
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++" OFF)
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
"Build libc++ with support for a monotonic clock.
This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
"The Profile-rt library used to build with code coverage")
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
if (LIBCXX_BUILT_STANDALONE)
set(LLVM_USE_SANITIZER "" CACHE STRING
"Define the sanitizer used to build the library and tests")
endif()
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
if (APPLE)
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
else()
message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
endif()
endif()
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
# ABI Library options ---------------------------------------------------------
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
"Specify C++ ABI library to use." FORCE)
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
# Setup the default options if LIBCXX_CXX_ABI is not specified.
if (NOT LIBCXX_CXX_ABI)
if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
@ -97,14 +79,139 @@ if (NOT LIBCXX_CXX_ABI)
else ()
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
endif ()
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
"Specify C++ ABI library to use." FORCE)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
# Use a static copy of the ABI library when linking libc++. This option
# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
# Generate and install a linker script inplace of libc++.so. The linker script
# will link libc++ to the correct ABI library. This option is on by default
# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY'
# is on. This option is also disabled when the ABI library is not specified
# or is specified to be "none".
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
AND PYTHONINTERP_FOUND)
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)
endif()
option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
"Use and install a linker script for the given ABI library"
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})
# Build libc++abi with libunwind. We need this option to determine whether to
# link with libunwind or libgcc_s while running the test cases.
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
# Target options --------------------------------------------------------------
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
# Feature options -------------------------------------------------------------
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
"Build libc++ with support for a monotonic clock.
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
# Misc options ----------------------------------------------------------------
# FIXME: Turn -pedantic back ON. It is currently off because it warns
# about #include_next which is used everywhere.
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
"The Profile-rt library used to build with code coverage")
# Don't allow a user to accidentally overwrite the system libc++ installation on Darwin.
# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++
# will not be generated and a warning will be issued.
option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF)
mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default.
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL)
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
message(WARNING "Disabling libc++ install rules because installation would "
"overwrite the systems installation. Configure with "
"-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.")
mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option.
set(LIBCXX_INSTALL_HEADERS OFF)
set(LIBCXX_INSTALL_LIBRARY OFF)
endif()
endif()
set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF)
if (XCODE OR MSVC_IDE)
set(LIBCXX_CONFIGURE_IDE_DEFAULT ON)
endif()
option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE"
${LIBCXX_CONFIGURE_IDE_DEFAULT})
#===============================================================================
# Check option configurations
#===============================================================================
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when
# LIBCXX_ENABLE_THREADS is on.
if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
" when LIBCXX_ENABLE_THREADS is also set to OFF.")
endif()
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
# is ON.
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
endif()
# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
# and check that we can build with 32 bits if requested.
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
message(STATUS "Building 32 bits executables and libraries.")
endif()
elseif(LIBCXX_BUILD_32_BITS)
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
endif()
# Check that this option is not enabled on Apple and emit a usage warning.
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
if (APPLE)
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
else()
message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
endif()
endif()
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
if (APPLE)
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets")
endif()
if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.")
endif()
endif()
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
message(FATAL_ERROR "Conflicting options given.
LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
endif()
if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off"
"when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
endif()
#===============================================================================
# Configure System
#===============================================================================
@ -114,232 +221,183 @@ set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
# Declare libc++ configuration variables.
# They are intended for use as follows:
# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
# LIBCXX_COMPILE_FLAGS: Compile only flags.
# LIBCXX_LINK_FLAGS: Linker only flags.
set(LIBCXX_CXX_FLAGS "")
set(LIBCXX_COMPILE_FLAGS "")
set(LIBCXX_LINK_FLAGS "")
set(LIBCXX_LIBRARIES "")
# Configure compiler.
include(config-ix)
# Configure ABI library
include(HandleLibCXXABI)
# Configure coverage options.
if (LIBCXX_GENERATE_COVERAGE)
include(CodeCoverage)
set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
#===============================================================================
# Setup Compiler Flags
#===============================================================================
# Get required flags.
include(HandleLibCXXABI) # Steup the ABI library flags
# Include macros for adding and removing libc++ flags.
include(HandleLibcxxFlags)
# Remove flags that may have snuck in.
remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
-stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
# so they don't get transformed into -Wno and -errors respectivly.
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
# Required flags ==============================================================
add_compile_flags_if_supported(-std=c++11)
if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
message(FATAL_ERROR "C++11 is required but the compiler does not support -std=c++11")
endif()
# On all systems the system c++ standard library headers need to be excluded.
if (MSVC)
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++
# headers.
else()
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
list(APPEND LIBCXX_COMPILE_FLAGS -nostdinc++)
string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
# If c++1y has been enabled then attempt to use it. Fail if it is no supported
# by the compiler. Otherwise choose c++11 and ensure the compiler supports it.
if (LIBCXX_ENABLE_CXX1Y)
if (LIBCXX_HAS_STDCXX1Y_FLAG)
set(LIBCXX_STD_VERSION c++1y)
else()
message(FATAL_ERROR "c++1y was enabled but the compiler does not support it.")
endif()
else()
if (LIBCXX_HAS_STDCXX11_FLAG)
set(LIBCXX_STD_VERSION c++11)
else()
message(FATAL_ERROR "c++11 is required by libc++ but is not supported by the compiler")
endif()
endif()
# LIBCXX_STD_VERSION should always be set at this point.
list(APPEND LIBCXX_CXX_FLAGS "-std=${LIBCXX_STD_VERSION}")
endif()
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++
# headers
add_compile_flags_if_supported(-nostdinc++)
macro(append_if list condition var)
if (${condition})
list(APPEND ${list} ${var})
endif()
endmacro()
# Target flags ================================================================
add_flags_if(LIBCXX_BUILD_32_BITS -m32)
add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
# Get warning flags
if (NOT MSVC)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
list(APPEND LIBCXX_COMPILE_FLAGS -Werror=return-type)
endif()
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
# Warning flags ===============================================================
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
add_compile_flags_if_supported(
-Wall -W -Wwrite-strings
-Wno-unused-parameter -Wno-long-long
-Werror=return-type)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WX_FLAG -WX)
add_compile_flags_if_supported(-Werror)
add_compile_flags_if_supported(-WX)
else()
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
# TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
# added elsewhere.
add_compile_flags_if_supported(-Wno-error)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
add_compile_flags_if_supported(-pedantic)
endif()
# Get feature flags.
# Exceptions
# Exception flags =============================================================
if (LIBCXX_ENABLE_EXCEPTIONS)
# Catches C++ exceptions only and tells the compiler to assume that extern C
# functions never throw a C++ exception.
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
add_compile_flags_if_supported(-EHsc)
else()
list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
add_definitions(-D_LIBCPP_NO_EXCEPTIONS)
add_compile_flags_if_supported(-EHs- -EHa-)
add_compile_flags_if_supported(-fno-exceptions)
endif()
# RTTI
# RTTI flags ==================================================================
if (NOT LIBCXX_ENABLE_RTTI)
list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_RTTI)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
add_definitions(-D_LIBCPP_NO_RTTI)
add_compile_flags_if_supported(-GR-)
add_compile_flags_if_supported(-fno-rtti)
endif()
# Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
# Assertion flags =============================================================
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
if (LIBCXX_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
list(APPEND LIBCXX_COMPILE_FLAGS -D_DEBUG)
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_COMPILE_FLAGS -UNDEBUG)
endif()
else()
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_COMPILE_FLAGS -DNDEBUG)
endif()
endif()
# Static library
if (NOT LIBCXX_ENABLE_SHARED)
list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
define_if_not(MSVC -D_DEBUG)
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
if (LIBCXX_BUILD_32_BITS)
message(STATUS "Building 32 bits executables and libraries.")
list(APPEND LIBCXX_CXX_FLAGS "-m32")
endif()
elseif(LIBCXX_BUILD_32_BITS)
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
endif()
# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
# Feature flags ===============================================================
define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
# LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE configuration
if (NOT LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
add_definitions(-D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
endif()
# LIBCXX_ENABLE_STDIN configuration
if (NOT LIBCXX_ENABLE_STDIN)
add_definitions(-D_LIBCPP_HAS_NO_STDIN)
endif()
# LIBCXX_ENABLE_STDOUT configuration
if (NOT LIBCXX_ENABLE_STDOUT)
add_definitions(-D_LIBCPP_HAS_NO_STDOUT)
endif()
# LIBCXX_ENABLE_THREADS configuration
if (NOT LIBCXX_ENABLE_THREADS)
add_definitions(-D_LIBCPP_HAS_NO_THREADS)
if (NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
add_definitions(-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
endif()
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON.
elseif(NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
" when LIBCXX_ENABLE_THREADS is also set to OFF.")
endif()
# LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS configuration
if (NOT LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS)
add_definitions(-D_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
endif()
# Sanitizer flags =============================================================
# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
if (LIBCXX_BUILT_STANDALONE)
set(LLVM_USE_SANITIZER "" CACHE STRING
"Define the sanitizer used to build the library and tests")
# NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
# But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
if (LLVM_USE_SANITIZER AND NOT MSVC)
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG
"-fno-omit-frame-pointer")
add_flags_if_supported("-fno-omit-frame-pointer")
add_flags_if_supported("-gline-tables-only")
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG
"-gline-tables-only")
add_flags_if_supported("-gline-tables-only")
endif()
if (LLVM_USE_SANITIZER STREQUAL "Address")
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=address")
add_flags("-fsanitize=address")
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=memory")
add_flags(-fsanitize=memory)
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize-memory-track-origins")
add_flags("-fsanitize-memory-track-origins")
endif()
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
list(APPEND LIBCXX_CXX_FLAGS
"-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover")
add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=thread")
add_flags(-fsanitize=thread)
else()
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
endif()
elseif(MSVC)
message(WARNING "LLVM_USE_SANITIZER is not supported with MSVC")
elseif(LLVM_USE_SANITIZER AND MSVC)
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
endif()
endif()
append_if(LIBCXX_CXX_FLAGS LIBCXX_TARGET_TRIPLE
"-target ${LIBCXX_TARGET_TRIPLE}")
# Configuration file flags =====================================================
if (NOT LIBCXX_ABI_VERSION EQUAL "1")
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
endif()
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
append_if(LIBCXX_CXX_FLAGS LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
append_if(LIBCXX_CXX_FLAGS LIBCXX_GCC_TOOLCHAIN
"-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
if (LIBCXX_NEEDS_SITE_CONFIG)
configure_file(
include/__config_site.in
${LIBCXX_BINARY_DIR}/__config_site
@ONLY)
# Provide the config definitions by included the generated __config_site
# file at compile time.
add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
endif()
string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FLAGS}")
#===============================================================================
# Setup Source Code
# Setup Source Code And Tests
#===============================================================================
include_directories(include)
add_subdirectory(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(lib)
#===============================================================================
# Setup Tests
#===============================================================================
add_subdirectory(test)
if (LIBCXX_INCLUDE_TESTS)
add_subdirectory(test)
endif()
if (LIBCXX_INCLUDE_DOCS)
add_subdirectory(docs)
endif()

View File

@ -1,5 +1,15 @@
This is meant to be a general place to list things that should be done "someday"
3.8 Release Goals
=================
* LFTS v1 (EricWF, MClow)
* Filesystem TS (EricWF)
* ASIO TS (MClow)
* <regex> Improvements (MClow)
* Setup ABI Versioning policy (EricWF)
* Fix PR19302 - Fix UB in list and __tree.
ABI Related Tasks
=================
* Explicitly manage and verify symbols exported from the dylib.
@ -21,18 +31,18 @@ CXX Runtime Library Tasks
Atomic Related Tasks
====================
* Support <atomic> in C++03 (needed for internal use).
* Enable mixing of clang and GCC atomics internally. Currently some
parts of libc++ use atomics only when clang provides them.
(see memory@5380 for an example)
* Audit use of libatomic builtins in <atomic> with GCC.
* future should use <atomic> for synchronization.
* call_once should use <atomic> for synchronization.
* Audit shared_ptr use of <atomic>
Test Suite Tasks
================
* Get test suite passing in C++03.
* Move all libc++ specific tests from test/std into test/libcxx.
* Improve how LIT handles compiler warnings.
* Improve the quality and portability of the locale test data.
* Convert failure tests to use Clang Verify.
Misc Tasks
==========
@ -42,8 +52,5 @@ Misc Tasks
* Look at basic_string's move assignment operator, re LWG 2063 and POCMA
* libc++ is missing try_emplace
* Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
* Investigate the effect of using __decltype instead of __typeof__ to provide
decltype in C++03. What code could be broken by this change?
* Convert failure tests to use Clang Verify.
* Document support (or lack of) for C++11 libraries in C++03.
* Document supported compilers.

View File

@ -41,10 +41,13 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
file(COPY "${incpath}/${fpath}"
DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
)
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
DESTINATION include/c++/v1/${dstdir}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
if (LIBCXX_INSTALL_HEADERS)
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
DESTINATION include/c++/v1/${dstdir}
COMPONENT libcxx
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
endif()
endforeach()
@ -58,6 +61,8 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
endmacro()
# Configure based on the selected ABI library.
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
"${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
set(_LIBSUPCXX_INCLUDE_FILES

View File

@ -0,0 +1,169 @@
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
# and link libc++. These macros add flags to the following CMake variables.
# - LIBCXX_COMPILE_FLAGS: flags used to compile libc++
# - LIBCXX_LINK_FLAGS: flags used to link libc++
# - LIBCXX_LIBRARIES: libraries to link libc++ to.
include(CheckCXXCompilerFlag)
unset(add_flag_if_supported)
# Mangle the name of a compiler flag into a valid CMake identifier.
# Ex: --std=c++11 -> STD_EQ_CXX11
macro(mangle_name str output)
string(STRIP "${str}" strippedStr)
string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
string(REPLACE "-" "_" strippedStr "${strippedStr}")
string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
string(REPLACE "+" "X" strippedStr "${strippedStr}")
string(TOUPPER "${strippedStr}" ${output})
endmacro()
# Remove a list of flags from all CMake variables that affect compile flags.
# This can be used to remove unwanted flags specified on the command line
# or added in other parts of LLVM's cmake configuration.
macro(remove_flags)
foreach(var ${ARGN})
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
remove_definitions(${var})
endforeach()
endmacro(remove_flags)
# Add a macro definition if condition is true.
macro(define_if condition def)
if (${condition})
add_definitions(${def})
endif()
endmacro()
# Add a macro definition if condition is not true.
macro(define_if_not condition def)
if (NOT ${condition})
add_definitions(${def})
endif()
endmacro()
# Add a macro definition to the __config_site file if the specified condition
# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
# the build include the '__config_site' header.
macro(config_define_if condition def)
if (${condition})
set(${def} ON)
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endif()
endmacro()
macro(config_define_if_not condition def)
if (NOT ${condition})
set(${def} ON)
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endif()
endmacro()
macro(config_define value def)
set(${def} ${value})
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endmacro()
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
# 'LIBCXX_LINK_FLAGS'.
macro(add_flags)
foreach(value ${ARGN})
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
list(APPEND LIBCXX_LINK_FLAGS ${value})
endforeach()
endmacro()
# If the specified 'condition' is true then add a list of flags to both
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
macro(add_flags_if condition)
if (${condition})
add_flags(${ARGN})
endif()
endmacro()
# Add each flag in the list to LIBCXX_COMPILE_FLAGS and LIBCXX_LINK_FLAGS
# if that flag is supported by the current compiler.
macro(add_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
add_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
# Add a list of flags to 'LIBCXX_COMPILE_FLAGS'.
macro(add_compile_flags)
foreach(f ${ARGN})
list(APPEND LIBCXX_COMPILE_FLAGS ${f})
endforeach()
endmacro()
# If 'condition' is true then add the specified list of flags to
# 'LIBCXX_COMPILE_FLAGS'
macro(add_compile_flags_if condition)
if (${condition})
add_compile_flags(${ARGN})
endif()
endmacro()
# For each specified flag, add that flag to 'LIBCXX_COMPILE_FLAGS' if the
# flag is supported by the C++ compiler.
macro(add_compile_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
add_compile_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
# Add a list of flags to 'LIBCXX_LINK_FLAGS'.
macro(add_link_flags)
foreach(f ${ARGN})
list(APPEND LIBCXX_LINK_FLAGS ${f})
endforeach()
endmacro()
# If 'condition' is true then add the specified list of flags to
# 'LIBCXX_LINK_FLAGS'
macro(add_link_flags_if condition)
if (${condition})
add_link_flags(${ARGN})
endif()
endmacro()
# For each specified flag, add that flag to 'LIBCXX_LINK_FLAGS' if the
# flag is supported by the C++ compiler.
macro(add_link_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
add_link_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
# Add a list of libraries or link flags to 'LIBCXX_LIBRARIES'.
macro(add_library_flags)
foreach(lib ${ARGN})
list(APPEND LIBCXX_LIBRARIES ${lib})
endforeach()
endmacro()
# if 'condition' is true then add the specified list of libraries and flags
# to 'LIBCXX_LIBRARIES'.
macro(add_library_flags_if condition)
if(${condition})
add_library_flags(${ARGN})
endif()
endmacro()
# Turn a comma separated CMake list into a space separated string.
macro(split_list listname)
string(REPLACE ";" " " ${listname} "${${listname}}")
endmacro()

View File

@ -0,0 +1,138 @@
macro(find_llvm_parts)
# Rely on llvm-config.
set(CONFIG_OUTPUT)
find_program(LLVM_CONFIG "llvm-config")
if(DEFINED LLVM_PATH)
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
elseif(LLVM_CONFIG)
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
set(CONFIG_COMMAND ${LLVM_CONFIG}
"--includedir"
"--prefix"
"--src-root")
execute_process(
COMMAND ${CONFIG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT
)
if(NOT HAD_ERROR)
string(REGEX REPLACE
"[ \t]*[\r\n]+[ \t]*" ";"
CONFIG_OUTPUT ${CONFIG_OUTPUT})
else()
string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
message(STATUS "${CONFIG_COMMAND_STR}")
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
endif()
list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
else()
set(LLVM_FOUND OFF)
return()
endif()
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
set(LLVM_FOUND OFF)
message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}")
return()
endif()
if(NOT EXISTS ${LLVM_CMAKE_PATH})
set(LLVM_FOUND OFF)
message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
return()
endif()
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
set(LLVM_FOUND ON)
endmacro(find_llvm_parts)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXX_BUILT_STANDALONE 1)
message(STATUS "Configuring for standalone build.")
find_llvm_parts()
# LLVM Options --------------------------------------------------------------
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(WARNING "Failed to find python interpreter. "
"The libc++ test suite will be disabled.")
set(LLVM_INCLUDE_TESTS OFF)
endif()
if (NOT DEFINED LLVM_INCLUDE_TESTS)
set(LLVM_INCLUDE_TESTS ${LLVM_FOUND})
endif()
if (NOT DEFINED LLVM_INCLUDE_DOCS)
set(LLVM_INCLUDE_DOCS ${LLVM_FOUND})
endif()
if (NOT DEFINED LLVM_ENABLE_SPHINX)
set(LLVM_ENABLE_SPHINX OFF)
endif()
# Required LIT Configuration ------------------------------------------------
# Define the default arguments to use with 'lit', and an option for the user
# to override.
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
if (MSVC OR XCODE)
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
endif()
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# Make sure we can use the console pool for recent cmake and ninja > 1.5
# Needed for add_lit_testsuite
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
set(cmake_3_2_USES_TERMINAL)
else()
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
endif()
# Required doc configuration
if (LLVM_ENABLE_SPHINX)
message(STATUS "Sphinx enabled.")
find_package(Sphinx REQUIRED)
else()
message(STATUS "Sphinx disabled.")
endif()
# FIXME - This is cribbed from HandleLLVMOptions.cmake.
if(WIN32)
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
if(CYGWIN)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
else(CYGWIN)
set(LLVM_ON_WIN32 1)
set(LLVM_ON_UNIX 0)
endif(CYGWIN)
else(WIN32)
if(UNIX)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
if(APPLE)
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
else(APPLE)
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
endif(APPLE)
else(UNIX)
MESSAGE(SEND_ERROR "Unable to determine platform")
endif(UNIX)
endif(WIN32)
# Add LLVM Functions --------------------------------------------------------
include(AddLLVM OPTIONAL)
endif()

View File

@ -2,23 +2,7 @@ include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
# Check compiler flags
check_cxx_compiler_flag(-std=c++11 LIBCXX_HAS_STDCXX11_FLAG)
check_cxx_compiler_flag(-std=c++1y LIBCXX_HAS_STDCXX1Y_FLAG)
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fno-omit-frame-pointer LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-Wno-error LIBCXX_HAS_WNO_ERROR_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(-gline-tables-only LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG)
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
@ -26,10 +10,10 @@ check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
# Check libraries
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)

306
docs/BuildingLibcxx.rst Normal file
View File

@ -0,0 +1,306 @@
===============
Building libc++
===============
.. contents::
:local:
Getting Started
===============
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
(getting the bleeding edge), read on.
The basic steps needed to build libc++ are:
#. Checkout LLVM:
* ``cd where-you-want-llvm-to-live``
* ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
#. Checkout libc++:
* ``cd where-you-want-llvm-to-live``
* ``cd llvm/projects``
* ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
#. Checkout libc++abi:
* ``cd where-you-want-llvm-to-live``
* ``cd llvm/projects``
* ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
#. Configure and build libc++ with libc++abi:
CMake is the only supported configuration system. Unlike other LLVM
projects autotools is not supported for either libc++ or libc++abi.
Clang is the preferred compiler when building and using libc++.
* ``cd where you want to build llvm``
* ``mkdir build``
* ``cd build``
* ``cmake -G <generator> [options] <path to llvm sources>``
For more information about configuring libc++ see :ref:`CMake Options`.
* ``make cxx`` --- will build libc++ and libc++abi.
* ``make check-libcxx check-libcxxabi`` --- will run the test suites.
Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib.
See :ref:`using an alternate libc++ installation <alternate libcxx>`
#. **Optional**: Install libc++ and libc++abi
If your system already provides a libc++ installation it is important to be
careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
select a safe place to install libc++.
* ``make install-libcxx install-libcxxabi`` --- Will install the libraries and the headers
.. warning::
* Replacing your systems libc++ installation could render the system non-functional.
* Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
The instructions are for building libc++ on
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree
build would look like this:
.. code-block:: bash
$ cd where-you-want-libcxx-to-live
$ # Check out llvm, libc++ and libc++abi.
$ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
$ ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
$ ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
$ cd where-you-want-to-build
$ mkdir build && cd build
$ export CC=clang CXX=clang++
$ cmake -DLLVM_PATH=path/to/llvm \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include \
path/to/libcxx
$ make
$ make check-libcxx # optional
.. _`libc++abi`: http://libcxxabi.llvm.org/
.. _CMake Options:
CMake Options
=============
Here are some of the CMake variables that are used often, along with a
brief explanation and LLVM-specific notes. For full documentation, check the
CMake docs or execute ``cmake --help-variable VARIABLE_NAME``.
**CMAKE_BUILD_TYPE**:STRING
Sets the build type for ``make`` based generators. Possible values are
Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
the user sets the build type with the IDE settings.
**CMAKE_INSTALL_PREFIX**:PATH
Path where LLVM will be installed if "make install" is invoked or the
"INSTALL" target is built.
**CMAKE_CXX_COMPILER**:STRING
The C++ compiler to use when building and testing libc++.
.. _libcxx-specific options:
libc++ specific options
-----------------------
.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL
**Default**: ``ON``
Build libc++ with assertions enabled.
.. option:: LIBCXX_BUILD_32_BITS:BOOL
**Default**: ``OFF``
Build libc++ as a 32 bit library. Also see :option:`LLVM_BUILD_32_BITS`.
.. option:: LIBCXX_ENABLE_SHARED:BOOL
**Default**: ``ON``
Build libc++ as a shared library. If ``OFF`` is specified then libc++ is
built as a static library.
.. option:: LIBCXX_LIBDIR_SUFFIX:STRING
Extra suffix to append to the directory where libraries are to be installed.
This option overrides :option:`LLVM_LIBDIR_SUFFIX`.
.. _ABI Library Specific Options:
ABI Library Specific Options
----------------------------
.. option:: LIBCXX_CXX_ABI:STRING
**Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``, ``libsupc++``.
Select the ABI library to build libc++ against.
.. option:: LIBCXX_CXX_ABI_INCLUDE_PATHS:PATHS
Provide additional search paths for the ABI library headers.
.. option:: LIBCXX_CXX_ABI_LIBRARY_PATH:PATH
Provide the path to the ABI library that libc++ should link against.
.. option:: LIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL
**Default**: ``OFF``
If this option is enabled, libc++ will try and link the selected ABI library
statically.
.. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL
**Default**: ``ON`` by default on UNIX platforms other than Apple unless
'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``.
This option generate and installs a linker script as ``libc++.so`` which
links the correct ABI library.
.. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL
**Default**: ``OFF``
Build and use the LLVM unwinder. Note: This option can only be used when
libc++abi is the C++ ABI library used.
libc++ Feature options
----------------------
.. option:: LIBCXX_ENABLE_EXCEPTIONS:BOOL
**Default**: ``ON``
Build libc++ with exception support.
.. option:: LIBCXX_ENABLE_RTTI:BOOL
**Default**: ``ON``
Build libc++ with run time type information.
libc++ Feature options
----------------------
The following options allow building libc++ for a different ABI version.
.. option:: LIBCXX_ABI_VERSION:STRING
**Default**: ``1``
Defines the target ABI version of libc++.
.. option:: LIBCXX_ABI_UNSTABLE:BOOL
**Default**: ``OFF``
Build the "unstable" ABI version of libc++. Includes all ABI changing features
on top of the current stable version.
.. _LLVM-specific variables:
LLVM-specific options
---------------------
.. option:: LLVM_LIBDIR_SUFFIX:STRING
Extra suffix to append to the directory where libraries are to be
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
to install libraries to ``/usr/lib64``.
.. option:: LLVM_BUILD_32_BITS:BOOL
Build 32-bits executables and libraries on 64-bits systems. This option is
available only on some 64-bits unix systems. Defaults to OFF.
.. option:: LLVM_LIT_ARGS:STRING
Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
others.
Using Alternate ABI libraries
=============================
.. _libsupcxx:
Using libsupc++ on Linux
------------------------
You will need libstdc++ in order to provide libsupc++.
Figure out where the libsupc++ headers are on your system. On Ubuntu this
is ``/usr/include/c++/<version>`` and ``/usr/include/c++/<version>/<target-triple>``
You can also figure this out by running
.. code-block:: bash
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include &lt;...&gt; search starts here:
/usr/include/c++/4.7
/usr/include/c++/4.7/x86_64-linux-gnu
/usr/include/c++/4.7/backward
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
Note that the first two entries happen to be what we are looking for. This
may not be correct on other platforms.
We can now run CMake:
.. code-block:: bash
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
-DLIBCXX_CXX_ABI=libstdc++ \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
<libc++-source-dir>
You can also substitute ``-DLIBCXX_CXX_ABI=libsupc++``
above, which will cause the library to be linked to libsupc++ instead
of libstdc++, but this is only recommended if you know that you will
never need to link against libstdc++ in the same executable as libc++.
GCC ships libsupc++ separately but only as a static library. If a
program also needs to link against libstdc++, it will provide its
own copy of libsupc++ and this can lead to subtle problems.
.. code-block:: bash
$ make cxx
$ make install
You can now run clang with -stdlib=libc++.

9
docs/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
if (LLVM_ENABLE_SPHINX)
if (SPHINX_FOUND)
include(AddSphinxTarget)
if (${SPHINX_OUTPUT_HTML})
add_sphinx_target(html libcxx)
endif()
endif()
endif()

View File

@ -0,0 +1,17 @@
====================
Libc++ ABI stability
====================
Libc++ aims to preserve stable ABI to avoid subtle bugs when code built to the old ABI
is linked with the code build to the new ABI. At the same time, libc++ allows ABI-breaking
improvements and bugfixes for the scenarios when ABI change is not a issue.
To support both cases, libc++ allows specifying the ABI version at the
build time. The version is defined with a cmake option
LIBCXX_ABI_VERSION. Another option LIBCXX_ABI_UNSTABLE can be used to
include all present ABI breaking features. These options translate
into C++ macro definitions _LIBCPP_ABI_VERSION, _LIBCPP_ABI_UNSTABLE.
Any ABI-changing feature is placed under it's own macro, _LIBCPP_ABI_XXX, which is enabled
based on the value of _LIBCPP_ABI_VERSION. _LIBCPP_ABI_UNSTABLE, if set, enables all features at once.

View File

@ -0,0 +1,88 @@
=======================================================
Capturing configuration information during installation
=======================================================
.. contents::
:local:
The Problem
===========
Currently the libc++ supports building the library with a number of different
configuration options. Unfortunately all of that configuration information is
lost when libc++ is installed. In order to support "persistent"
configurations libc++ needs a mechanism to capture the configuration options
in the INSTALLED headers.
Design Goals
============
* The solution should not INSTALL any additional headers. We don't want an extra
#include slowing everybody down.
* The solution should not unduly affect libc++ developers. The problem is limited
to installed versions of libc++ and the solution should be as well.
* The solution should not modify any existing headers EXCEPT during installation.
It makes developers lives harder if they have to regenerate the libc++ headers
every time they are modified.
* The solution should not make any of the libc++ headers dependant on
files generated by the build system. The headers should be able to compile
out of the box without any modification.
* The solution should not have ANY effect on users who don't need special
configuration options. The vast majority of users will never need this so it
shouldn't cost them.
The Solution
============
When you first configure libc++ using CMake we check to see if we need to
capture any options. If we haven't been given any "persistent" options then
we do NOTHING.
Otherwise we create a custom installation rule that modifies the installed __config
header. The rule first generates a dummy "__config_site" header containing the required
#defines. The contents of the dummy header are then prependend to the installed
__config header. By manually prepending the files we avoid the cost of an
extra #include and we allow the __config header to be ignorant of the extra
configuration all together. An example "__config" header generated when
-DLIBCXX_ENABLE_THREADS=OFF is given to CMake would look something like:
.. code-block:: 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.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
/* #undef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE */
/* #undef _LIBCPP_HAS_NO_STDIN */
/* #undef _LIBCPP_HAS_NO_STDOUT */
#define _LIBCPP_HAS_NO_THREADS
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
/* #undef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS */
#endif
// -*- C++ -*-
//===--------------------------- __config ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG

37
docs/Makefile.sphinx Normal file
View File

@ -0,0 +1,37 @@
# Makefile for Sphinx documentation
#
# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder
# to work with libcxx. This should be removed when that builder supports
# out-of-tree builds.
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext default
default: html
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@# FIXME: Remove this `cp` once HTML->Sphinx transition is completed.
@# Kind of a hack, but HTML-formatted docs are on the way out anyway.
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

13
docs/README.txt Normal file
View File

@ -0,0 +1,13 @@
libc++ Documentation
====================
The libc++ documentation is written using the Sphinx documentation generator. It is
currently tested with Sphinx 1.1.3.
To build the documents into html configure libc++ with the following cmake options:
* -DLLVM_ENABLE_SPHINX=ON
* -DLIBCXX_INCLUDE_DOCS=ON
After configuring libc++ with these options the make rule `docs-libcxx-html`
should be available.

191
docs/TestingLibcxx.rst Normal file
View File

@ -0,0 +1,191 @@
==============
Testing libc++
==============
.. contents::
:local:
Getting Started
===============
libc++ uses LIT to configure and run its tests. The primary way to run the
libc++ tests is by using make check-libcxx. However since libc++ can be used
in any number of possible configurations it is important to customize the way
LIT builds and runs the tests. This guide provides information on how to use
LIT directly to test libc++.
Please see the `Lit Command Guide`_ for more information about LIT.
.. _LIT Command Guide: http://llvm.org/docs/CommandGuide/lit.html
Setting up the Environment
--------------------------
After building libc++ you must setup your environment to test libc++ using
LIT.
#. Create a shortcut to the actual lit executable so that you can invoke it
easily from the command line.
.. code-block:: bash
$ alias lit='python path/to/llvm/utils/lit/lit.py'
#. Tell LIT where to find your build configuration.
.. code-block:: bash
$ export LIBCXX_SITE_CONFIG=path/to/build-libcxx/test/lit.site.cfg
Example Usage
-------------
Once you have your environment set up and you have built libc++ you can run
parts of the libc++ test suite by simply running `lit` on a specified test or
directory. For example:
.. code-block:: bash
$ cd path/to/src/libcxx
$ lit -sv test/std/re # Run all of the std::regex tests
$ lit -sv test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test
$ lit -sv test/std/atomics test/std/threads # Test std::thread and std::atomic
Sometimes you'll want to change the way LIT is running the tests. Custom options
can be specified using the `--param=<name>=<val>` flag. The most common option
you'll want to change is the standard dialect (ie -std=c++XX). By default the
test suite will select the newest C++ dialect supported by the compiler and use
that. However if you want to manually specify the option like so:
.. code-block:: bash
$ lit -sv test/std/containers # Run the tests with the newest -std
$ lit -sv --param=std=c++03 test/std/containers # Run the tests in C++03
Occasionally you'll want to add extra compile or link flags when testing.
You can do this as follows:
.. code-block:: bash
$ lit -sv --param=compile_flags='-Wcustom-warning'
$ lit -sv --param=link_flags='-L/custom/library/path'
Some other common examples include:
.. code-block:: bash
# Specify a custom compiler.
$ lit -sv --param=cxx_under_test=/opt/bin/g++ test/std
# Enable warnings in the test suite
$ lit -sv --param=enable_warnings=true test/std
# Use UBSAN when running the tests.
$ lit -sv --param=use_sanitizer=Undefined
LIT Options
===========
:program:`lit` [*options*...] [*filenames*...]
Command Line Options
--------------------
To use these options you pass them on the LIT command line as --param NAME or
--param NAME=VALUE. Some options have default values specified during CMake's
configuration. Passing the option on the command line will override the default.
.. program:: lit
.. option:: cxx_under_test=<path/to/compiler>
Specify the compiler used to build the tests.
.. option:: std=<standard version>
**Values**: c++98, c++03, c++11, c++14, c++1z
Change the standard version used when building the tests.
.. option:: libcxx_site_config=<path/to/lit.site.cfg>
Specify the site configuration to use when running the tests. This option
overrides the enviroment variable LIBCXX_SITE_CONFIG.
.. option:: libcxx_headers=<path/to/headers>
Specify the libc++ headers that are tested. By default the headers in the
source tree are used.
.. option:: libcxx_library=<path/to/libc++.so>
Specify the libc++ library that is tested. By default the library in the
build directory is used. This option cannot be used when use_system_lib is
provided.
.. option:: use_system_lib=<bool>
**Default**: False
Enable or disable testing against the installed version of libc++ library.
Note: This does not use the installed headers.
.. option:: use_lit_shell=<bool>
Enable or disable the use of LIT's internal shell in ShTests. If the
environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
the default value. Otherwise the default value is True on Windows and False
on every other platform.
.. option:: no_default_flags=<bool>
**Default**: False
Disable all default compile and link flags from being added. When this
option is used only flags specified using the compile_flags and link_flags
will be used.
.. option:: compile_flags="<list-of-args>"
Specify additional compile flags as a space delimited string.
Note: This options should not be used to change the standard version used.
.. option:: link_flags="<list-of-args>"
Specify additional link flags as a space delimited string.
.. option:: debug_level=<level>
**Values**: 0, 1
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
assertions and debugging of iterator misuse.
.. option:: use_sanitizer=<sanitizer name>
**Values**: Memory, MemoryWithOrigins, Address, Undefined
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
building libc++ then that sanitizer will be used by default.
.. option:: color_diagnostics
Enable the use of colorized compile diagnostics. If the color_diagnostics
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
present then color diagnostics will be enabled.
Environment Variables
---------------------
.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
Specify the site configuration to use when running the tests.
Also see :option:`libcxx_site_config`.
.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
to use color diagnostic outputs from the compiler.
Also see :option:`color_diagnostics`.

89
docs/UsingLibcxx.rst Normal file
View File

@ -0,0 +1,89 @@
============
Using libc++
============
.. contents::
:local:
Getting Started
===============
If you already have libc++ installed you can use it with clang.
.. code-block:: bash
$ clang++ -stdlib=libc++ test.cpp
$ clang++ -std=c++11 -stdlib=libc++ test.cpp
On OS X and FreeBSD libc++ is the default standard library
and the ``-stdlib=libc++`` is not required.
.. _alternate libcxx:
If you want to select an alternate installation of libc++ you
can use the following options.
.. code-block:: bash
$ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ \
-I<libcxx-install-prefix>/include/c++/v1 \
-L<libcxx-install-prefix>/lib \
-Wl,-rpath,<libcxx-install-prefix>/lib \
test.cpp
The option ``-Wl,-rpath,<libcxx-install-prefix>/lib`` adds a runtime library
search path. Meaning that the systems dynamic linker will look for libc++ in
``<libcxx-install-prefix>/lib`` whenever the program is run. Alternatively the
environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on OS X) can
be used to change the dynamic linkers search paths after a program is compiled.
An example of using ``LD_LIBRARY_PATH``:
.. code-block:: bash
$ clang++ -stdlib=libc++ -nostdinc++ \
-I<libcxx-install-prefix>/include/c++/v1
-L<libcxx-install-prefix>/lib \
test.cpp -o
$ ./a.out # Searches for libc++ in the systems library paths.
$ export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib
$ ./a.out # Searches for libc++ along LD_LIBRARY_PATH
Using libc++ on Linux
=====================
On Linux libc++ can typically be used with only '-stdlib=libc++'. However
some libc++ installations require the user manually link libc++abi themselves.
If you are running into linker errors when using libc++ try adding '-lc++abi'
to the link line. For example:
.. code-block:: bash
$ clang++ -stdlib=libc++ test.cpp -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
Alternately, you could just add libc++abi to your libraries list, which in
most situations will give the same result:
.. code-block:: bash
$ clang++ -stdlib=libc++ test.cpp -lc++abi
Using libc++ with GCC
---------------------
GCC does not provide a way to switch from libstdc++ to libc++. You must manually
configure the compile and link commands.
In particular you must tell GCC to remove the libstdc++ include directories
using ``-nostdinc++`` and to not link libstdc++.so using ``-nodefaultlibs``.
Note that ``-nodefaultlibs`` removes all of the standard system libraries and
not just libstdc++ so they must be manually linked. For example:
.. code-block:: bash
$ g++ -nostdinc++ -I<libcxx-install-prefix>/include/c++/v1 \
test.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc

251
docs/conf.py Normal file
View File

@ -0,0 +1,251 @@
# -*- coding: utf-8 -*-
#
# libc++ documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'libc++'
copyright = u'2011-2015, LLVM Project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.8'
# The full version, including alpha/beta/rc tags.
release = '3.8'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%Y-%m-%d'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
show_authors = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'friendly'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'haiku'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'libcxxdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('contents', 'libcxx.tex', u'libcxx Documentation',
u'LLVM project', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('contents', 'libc++', u'libc++ Documentation',
[u'LLVM project'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('contents', 'libc++', u'libc++ Documentation',
u'LLVM project', 'libc++', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# FIXME: Define intersphinx configration.
intersphinx_mapping = {}
# -- Options for extensions ----------------------------------------------------
# Enable this if you want TODOs to show up in the generated documentation.
todo_include_todos = True

185
docs/index.rst Normal file
View File

@ -0,0 +1,185 @@
.. _index:
=============================
"libc++" C++ Standard Library
=============================
Overview
========
libc++ is a new implementation of the C++ standard library, targeting C++11.
* Features and Goals
* Correctness as defined by the C++11 standard.
* Fast execution.
* Minimal memory use.
* Fast compile times.
* ABI compatibility with gcc's libstdc++ for some low-level features
such as exception objects, rtti and memory allocation.
* Extensive unit tests.
* Design and Implementation:
* Extensive unit tests
* Internal linker model can be dumped/read to textual format
* Additional linking features can be plugged in as "passes"
* OS specific and CPU specific code factored out
Getting Started with libc++
---------------------------
.. toctree::
:maxdepth: 2
UsingLibcxx
BuildingLibcxx
TestingLibcxx
Current Status
--------------
After its initial introduction, many people have asked "why start a new
library instead of contributing to an existing library?" (like Apache's
libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
reasons, but some of the major ones are:
* From years of experience (including having implemented the standard
library before), we've learned many things about implementing
the standard containers which require ABI breakage and fundamental changes
to how they are implemented. For example, it is generally accepted that
building std::string using the "short string optimization" instead of
using Copy On Write (COW) is a superior approach for multicore
machines (particularly in C++11, which has rvalue references). Breaking
ABI compatibility with old versions of the library was
determined to be critical to achieving the performance goals of
libc++.
* Mainline libstdc++ has switched to GPL3, a license which the developers
of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
independently extended to support C++11, but this would be a fork of the
codebase (which is often seen as worse for a project than starting a new
independent one). Another problem with libstdc++ is that it is tightly
integrated with G++ development, tending to be tied fairly closely to the
matching version of G++.
* STLport and the Apache libstdcxx library are two other popular
candidates, but both lack C++11 support. Our experience (and the
experience of libstdc++ developers) is that adding support for C++11 (in
particular rvalue references and move-only types) requires changes to
almost every class and function, essentially amounting to a rewrite.
Faced with a rewrite, we decided to start from scratch and evaluate every
design decision from first principles based on experience.
Further, both projects are apparently abandoned: STLport 5.2.1 was
released in Oct'08, and STDCXX 4.2.1 in May'08.
Platform and Compiler Support
-----------------------------
libc++ is known to work on the following platforms, using gcc-4.2 and
clang (lack of C++11 language support disables some functionality).
Note that functionality provided by ``<atomic>`` is only functional with clang
and GCC.
============ ==================== ============ ========================
OS Arch Compilers ABI Library
============ ==================== ============ ========================
Mac OS X i386, x86_64 Clang, GCC libc++abi
FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
Linux i386, x86_64 Clang, GCC libc++abi
============ ==================== ============ ========================
The following minimum compiler versions are strongly recommended.
* Clang 3.5 and above
* GCC 4.7 and above.
Anything older *may* work.
C++ Dialect Support
---------------------
* C++11 - Complete
* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
* `C++1z - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
Notes and Known Issues
----------------------
This list contains known issues with libc++
* Building libc++ with ``-fno-rtti`` is not supported. However
linking against it with ``-fno-rtti`` is supported.
* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
must be used during configuration.
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
Design Documents
----------------
.. toctree::
:maxdepth: 1
DesignDocs/CapturingConfigInfo
DesignDocs/ABIVersioning
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
* `Status of debug mode <http://libcxx.llvm.org/debug_mode.html>`_
* `Notes by Marshall Clow`__
.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
Build Bots and Test Coverage
----------------------------
* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
* `EricWF's Nightly Builders <http://ds2.efcs.ca:8080/console>`_
* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
Getting Involved
================
First please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__
and `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`__.
**Bug Reports**
If you think you've found a bug in libc++, please report it using
the `LLVM Bugzilla`_. If you're not sure, you
can post a message to the `cfe-dev mailing list`_ or on IRC.
Please include "libc++" in your subject.
**Patches**
If you want to contribute a patch to libc++, the best place for that is
`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please include [libcxx] in the subject and
add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
`cfe-commits mailing list <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_.
**Discussion and Questions**
Send discussions and questions to the
`cfe-dev mailing list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
Please include [libcxx] in the subject.
Quick Links
===========
* `LLVM Homepage <http://llvm.org/>`_
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
* `LLVM Bugzilla <http://llvm.org/bugs/>`_
* `cfe-commits Mailing List`_
* `cfe-dev Mailing List`_
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
* `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_

View File

@ -1,10 +1,12 @@
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
endif()
set(LIBCXX_HEADER_PATTERN
PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "__config_site.in" EXCLUDE
${LIBCXX_SUPPORT_HEADER_PATTERN}
)
@ -17,8 +19,34 @@ file(COPY .
if (LIBCXX_INSTALL_HEADERS)
install(DIRECTORY .
DESTINATION include/c++/v1
COMPONENT libcxx
FILES_MATCHING
${LIBCXX_HEADER_PATTERN}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
if (LIBCXX_NEEDS_SITE_CONFIG)
set(UNIX_CAT cat)
if (WIN32)
set(UNIX_CAT type)
endif()
# Generate and install a custom __config header. The new header is created
# by prepending __config_site to the current __config header.
add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
${LIBCXX_BINARY_DIR}/__config_site
)
# Add a target that executes the generation commands.
add_custom_target(generate_config_header ALL
DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
# Install the generated header as __config.
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
DESTINATION include/c++/v1
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
RENAME __config
COMPONENT libcxx)
endif()
endif()

View File

@ -11,19 +11,35 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#if !defined(_MSC_VER) || defined(__clang__)
#if defined(_MSC_VER) && !defined(__clang__)
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
#endif
#ifdef __cplusplus
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define _GNUC_VER 0
#endif
#define _LIBCPP_VERSION 3700
#define _LIBCPP_VERSION 3800
#ifndef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
#endif
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
// Change short string represention so that string data starts at offset 0,
// improving its alignment in some cases.
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
// Fix deque iterator type in order to support incomplete types.
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
#endif
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
@ -37,6 +53,9 @@
#ifndef __has_builtin
#define __has_builtin(__x) 0
#endif
#ifndef __has_extension
#define __has_extension(__x) 0
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
@ -61,6 +80,16 @@
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
#ifdef __BYTE_ORDER__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#endif // __BYTE_ORDER__
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
@ -227,9 +256,12 @@
#if defined(__clang__)
#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
!defined(__arm__)
#define _LIBCPP_ALTERNATE_STRING_LAYOUT
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
!defined(__arm__)) || \
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
#endif
#if __has_feature(cxx_alignas)
@ -273,6 +305,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_UNUSED __attribute__((__unused__))
#if !(__has_feature(cxx_default_function_template_args))
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#endif
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
@ -354,24 +390,23 @@ typedef __char32_t char32_t;
#elif defined(__ANDROID__)
#define _LIBCPP_HAS_QUICK_EXIT
#elif defined(__linux__)
#include <features.h>
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
# include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif // __linux__
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
# define _NOEXCEPT_OR_FALSE(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
# define _NOEXCEPT_OR_FALSE(x) false
#if !(__has_feature(cxx_noexcept))
#define _LIBCPP_HAS_NO_NOEXCEPT
#endif
#if __has_feature(underlying_type)
@ -429,19 +464,21 @@ namespace std {
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
// No version of GCC supports relaxed constexpr rules
// Determine if GCC supports relaxed constexpr
#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
// GCC 5 will support variable templates
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
// GCC 5 will support variable templates
#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
@ -449,31 +486,29 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_NO_NOEXCEPT
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404
#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#endif
@ -501,22 +536,20 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _LIBCPP_UNUSED
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw ()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
@ -536,14 +569,11 @@ namespace std {
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _LIBCPP_UNUSED
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_IS_BASE_OF
@ -567,6 +597,14 @@ namespace std {
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
#ifndef _LIBCPP_HAS_NO_NOEXCEPT
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
@ -578,9 +616,11 @@ typedef unsigned int char32_t;
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
extern "C++" {
template <bool> struct __static_assert_test;
template <> struct __static_assert_test<true> {};
template <unsigned> struct __static_assert_check {};
}
#define static_assert(__b, __m) \
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
@ -716,6 +756,12 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
#else
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
#endif
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
const void *, const void *, const void *, const void *);
@ -725,7 +771,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
# if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
@ -757,7 +803,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_STDOUT
#endif
#if defined(__ANDROID__) || defined(__CloudABI__)
#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
@ -767,4 +813,17 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif
#endif // _LIBCPP_CONFIG
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
#define _LIBCPP_HAS_C_ATOMIC_IMP
#elif _GNUC_VER > 407
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
#endif
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
|| defined(_LIBCPP_HAS_NO_THREADS)
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
#endif
#endif // __cplusplus
#endif // _LIBCPP_CONFIG

23
include/__config_site.in Normal file
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.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
#cmakedefine _LIBCPP_ABI_UNSTABLE
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#cmakedefine _LIBCPP_HAS_NO_STDIN
#cmakedefine _LIBCPP_HAS_NO_STDOUT
#cmakedefine _LIBCPP_HAS_NO_THREADS
#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
#endif // _LIBCPP_CONFIG_SITE

View File

@ -17,218 +17,7 @@
#pragma GCC system_header
#endif
template <class _Tp>
class __mem_fn
: public __weak_result_type<_Tp>
{
public:
// types
typedef _Tp type;
private:
type __f_;
public:
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
// invoke
typename __invoke_return<type>::type
operator() () const
{
return __invoke(__f_);
}
template <class _A0>
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const
{
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1, class _A2>
typename __invoke_return2<type, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
return __invoke(__f_, __a0, __a1, __a2);
}
};
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp _Tp::*>
mem_fn(_Rp _Tp::* __pm)
{
return __mem_fn<_Rp _Tp::*>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)()>
mem_fn(_Rp (_Tp::* __pm)())
{
return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0)>
mem_fn(_Rp (_Tp::* __pm)(_A0))
{
return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1))
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const>
mem_fn(_Rp (_Tp::* __pm)() const)
{
return __mem_fn<_Rp (_Tp::*)() const>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const>
mem_fn(_Rp (_Tp::* __pm)(_A0) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() volatile>
mem_fn(_Rp (_Tp::* __pm)() volatile)
{
return __mem_fn<_Rp (_Tp::*)() volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const volatile>
mem_fn(_Rp (_Tp::* __pm)() const volatile)
{
return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm);
}
// bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
};
template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
template<class _Fp>
struct __maybe_derive_from_unary_function
{
};
template<class _Rp, class _A1>
struct __maybe_derive_from_unary_function<_Rp(_A1)>
: public unary_function<_A1, _Rp>
{
};
template<class _Fp>
struct __maybe_derive_from_binary_function
{
};
template<class _Rp, class _A1, class _A2>
struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
namespace __function {
template<class _Fp> class __base;
@ -662,15 +451,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)()) {return __p;}
template <class _R2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2()>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -769,7 +549,7 @@ function<_Rp()>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -796,7 +576,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -947,27 +727,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)()) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_B0)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1066,7 +825,7 @@ function<_Rp(_A0)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1093,7 +852,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1244,27 +1003,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1363,7 +1101,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1390,7 +1128,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1540,27 +1278,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1660,7 +1377,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1687,7 +1404,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1856,274 +1573,4 @@ void
swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders
{
template <int _Np> struct __ph {};
extern __ph<1> _1;
extern __ph<2> _2;
extern __ph<3> _3;
extern __ph<4> _4;
extern __ph<5> _5;
extern __ph<6> _6;
extern __ph<7> _7;
extern __ph<8> _8;
extern __ph<9> _9;
extern __ph<10> _10;
} // placeholders
template<int _Np>
struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
__mu(reference_wrapper<_Tp> __t, _Uj&)
{
return __t.get();
}
/*
template <bool _IsBindExpr, class _Ti, class ..._Uj>
struct __mu_return1 {};
template <class _Ti, class ..._Uj>
struct __mu_return1<true, _Ti, _Uj...>
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class ..._Uj, size_t ..._Indx>
inline _LIBCPP_INLINE_VISIBILITY
typename __mu_return1<true, _Ti, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
{
__ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...);
}
template <class _Ti, class ..._Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_bind_expression<_Ti>::value,
typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
>::type
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
{
typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
return __mu_expand(__ti, __uj, __indices());
}
template <bool IsPh, class _Ti, class _Uj>
struct __mu_return2 {};
template <class _Ti, class _Uj>
struct __mu_return2<true, _Ti, _Uj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
};
template <class _Ti, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
0 < is_placeholder<_Ti>::value,
typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
>::type
__mu(_Ti&, _Uj& __uj)
{
const size_t _Indx = is_placeholder<_Ti>::value - 1;
// compiler bug workaround
typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj);
return __t;
// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
}
template <class _Ti, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_bind_expression<_Ti>::value &&
is_placeholder<_Ti>::value == 0 &&
!__is_reference_wrapper<_Ti>::value,
_Ti&
>::type
__mu(_Ti& __ti, _Uj& __uj)
{
return __ti;
}
template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
struct ____mu_return;
template <class _Ti, class ..._Uj>
struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, true, _TupleUj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
_TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, _TupleUj>
{
typedef _Ti& type;
};
template <class _Ti, class _TupleUj>
struct __mu_return
: public ____mu_return<_Ti,
is_bind_expression<_Ti>::value,
0 < is_placeholder<_Ti>::value,
_TupleUj>
{
};
template <class _Ti, class _TupleUj>
struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
{
typedef _Ti& type;
};
template <class _Fp, class _BoundArgs, class _TupleUj>
struct __bind_return;
template <class _Fp, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
_Fp&,
typename __mu_return
<
_BoundArgs,
_TupleUj
>::type...
>::type type;
};
template <class _Fp, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
_Fp&,
typename __mu_return
<
const _BoundArgs,
_TupleUj
>::type...
>::type type;
};
template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
inline _LIBCPP_INLINE_VISIBILITY
typename __bind_return<_Fp, _BoundArgs, _Args>::type
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
}
template<class _Fp, class ..._BoundArgs>
class __bind
{
_Fp __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
template <class _Gp, class ..._BA>
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
: __f_(_VSTD::forward<_Gp>(__f)),
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
}
template <class ..._Args>
typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
}
};
template<class _Fp, class ..._BoundArgs>
struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
template<class _Rp, class _Fp, class ..._BoundArgs>
class __bind_r
: public __bind<_Fp, _BoundArgs...>
{
typedef __bind<_Fp, _BoundArgs...> base;
public:
typedef _Rp result_type;
template <class _Gp, class ..._BA>
explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
: base(_VSTD::forward<_Gp>(__f),
_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
result_type
operator()(_Args&& ...__args)
{
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
}
template <class ..._Args>
result_type
operator()(_Args&& ...__args) const
{
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
}
};
template<class _Rp, class _Fp, class ..._BoundArgs>
struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
template<class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
template<class _Rp, class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
*/
#endif // _LIBCPP_FUNCTIONAL_03

View File

@ -77,62 +77,6 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void>
};
#endif
// addressof
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__strong _Tp*
addressof(__strong _Tp& __x) _NOEXCEPT
{
return &__x;
}
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__weak _Tp*
addressof(__weak _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__autoreleasing _Tp*
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
{
return &__x;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__unsafe_unretained _Tp*
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
#else // _LIBCPP_HAS_NO_VARIADICS
// __weak_result_type
template <class _Tp>
@ -314,6 +258,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
@ -358,8 +304,12 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
typedef _Rp result_type;
};
#endif // _LIBCPP_HAS_NO_VARIADICS
// __invoke
#ifndef _LIBCPP_HAS_NO_VARIADICS
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args,
@ -414,31 +364,79 @@ __invoke(_Fp&& __f, _Args&& ...__args)
{
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
struct __invoke_return
{
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
#else // _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ret>
struct __invoke_void_return_wrapper
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
static _Ret __call(_Args&&... __args)
{
static _Ret __call(_Args&&... __args) {
return __invoke(_VSTD::forward<_Args>(__args)...);
}
#else
template <class _Fn>
static _Ret __call(_Fn __f) {
return __invoke(__f);
}
template <class _Fn, class _A0>
static _Ret __call(_Fn __f, _A0& __a0) {
return __invoke(__f, __a0);
}
template <class _Fn, class _A0, class _A1>
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
return __invoke(__f, __a0, __a1);
}
template <class _Fn, class _A0, class _A1, class _A2>
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
return __invoke(__f, __a0, __a1, __a2);
}
#endif
};
template <>
struct __invoke_void_return_wrapper<void>
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
static void __call(_Args&&... __args)
{
static void __call(_Args&&... __args) {
__invoke(_VSTD::forward<_Args>(__args)...);
}
#else
template <class _Fn>
static void __call(_Fn __f) {
__invoke(__f);
}
template <class _Fn, class _A0>
static void __call(_Fn __f, _A0& __a0) {
__invoke(__f, __a0);
}
template <class _Fn, class _A0, class _A1>
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
__invoke(__f, __a0, __a1);
}
template <class _Fn, class _A0, class _A1, class _A2>
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
__invoke(__f, __a0, __a1, __a2);
}
#endif
};
template <class _Tp>
@ -463,14 +461,120 @@ public:
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
#else
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type>::type
operator() () const {
return __invoke(get());
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const {
return __invoke(get(), __a0);
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0 const>::type
operator() (_A0 const& __a0) const {
return __invoke(get(), __a0);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1>::type
operator() (_A0 const& __a0, _A1& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1 const>::type
operator() (_A0& __a0, _A1 const& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1 const>::type
operator() (_A0 const& __a0, _A1 const& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
};
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
@ -510,6 +614,7 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

View File

@ -836,6 +836,7 @@ public:
typedef __hash_local_iterator<__node_pointer> local_iterator;
typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
@ -843,6 +844,7 @@ public:
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value);
_LIBCPP_INLINE_VISIBILITY
__hash_table(const hasher& __hf, const key_equal& __eql);
__hash_table(const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
@ -863,6 +865,7 @@ public:
__hash_table& operator=(const __hash_table& __u);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_table& operator=(__hash_table&& __u)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
@ -934,9 +937,13 @@ public:
return __bucket_list_.get_deleter().size();
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT;
template <class _Key>
@ -965,6 +972,7 @@ public:
__node_holder remove(const_iterator __p) _NOEXCEPT;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type __count_unique(const _Key& __k) const;
template <class _Key>
size_type __count_multi(const _Key& __k) const;
@ -984,15 +992,17 @@ public:
__equal_range_multi(const _Key& __k) const;
void swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
#endif
);
#else
_NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const _NOEXCEPT
@ -1128,11 +1138,12 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
is_nothrow_default_constructible<__first_node>::value &&
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value)
: __p2_(0),
@ -1141,7 +1152,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@ -1201,6 +1212,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
_NOEXCEPT_(
is_nothrow_move_constructible<__bucket_list>::value &&
is_nothrow_move_constructible<__first_node>::value &&
is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
@ -1408,7 +1420,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
_NOEXCEPT_(
@ -1493,7 +1505,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
{
@ -1505,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
{
@ -1517,7 +1529,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
{
@ -1529,7 +1541,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
{
@ -2106,7 +2118,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -2122,7 +2134,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@ -2254,7 +2266,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{
@ -2351,15 +2363,17 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
#endif
)
#else
_NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
#endif
{
{
__node_pointer_pointer __npp = __bucket_list_.release();

View File

@ -37,6 +37,8 @@
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
# include <xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include <support/musl/xlocale.h>
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -329,7 +331,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_TYPE_VIS ctype_base
{
public:
#ifdef __GLIBC__
#if defined(__GLIBC__)
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
@ -359,7 +361,7 @@ public:
typedef __uint32_t mask;
# elif defined(__FreeBSD__)
typedef unsigned long mask;
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
typedef unsigned short mask;
# endif
static const mask space = _CTYPE_S;

View File

@ -14,7 +14,9 @@
#include <__config>
#include <chrono>
#include <system_error>
#ifndef _LIBCPP_HAS_NO_THREADS
#include <pthread.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -306,6 +308,7 @@ public:
template <class _Rep, class _Period, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
@ -390,7 +393,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
}
template <class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,

66
include/__nullptr Normal file
View File

@ -0,0 +1,66 @@
// -*- C++ -*-
//===--------------------------- __nullptr --------------------------------===//
//
// 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_NULLPTR
#define _LIBCPP_NULLPTR
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
{
void* __lx;
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t()
_LIBCPP_END_NAMESPACE_STD
#else // _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_NULLPTR

View File

@ -56,9 +56,12 @@ public:
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY
__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
_LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(__alloc_rr& __a);
_LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
@ -128,7 +131,9 @@ public:
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, false_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY
@ -266,7 +271,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
@ -275,7 +280,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
@ -309,7 +314,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
@ -317,14 +322,14 @@ __split_buffer<_Tp, _Allocator>::__split_buffer()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{

View File

@ -276,7 +276,6 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
codecvt_base::result __r;
char_type* pbase = &__1buf;
char_type* pptr = pbase + 1;
char_type* epptr = pptr;
do
{
const char_type* __e;

View File

@ -1118,8 +1118,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
: __pair1_(__node_allocator(__a)),
__begin_node_(__node_pointer()),
: __begin_node_(__node_pointer()),
__pair1_(__node_allocator(__a)),
__pair3_(0)
{
__begin_node() = __end_node();
@ -1128,8 +1128,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
const allocator_type& __a)
: __pair1_(__node_allocator(__a)),
__begin_node_(__node_pointer()),
: __begin_node_(__node_pointer()),
__pair1_(__node_allocator(__a)),
__pair3_(0, __comp)
{
__begin_node() = __end_node();
@ -1843,7 +1843,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@ -86,6 +86,11 @@ template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&&) _NOEXCEPT;
#endif
// pair specializations
@ -109,6 +114,11 @@ template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&&) _NOEXCEPT;
#endif
// array specializations
@ -132,35 +142,15 @@ template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&&
get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
// __lazy_and
template <bool _Last, class ..._Preds>
struct __lazy_and_impl;
template <class ..._Preds>
struct __lazy_and_impl<false, _Preds...> : false_type {};
template <>
struct __lazy_and_impl<true> : true_type {};
template <class _Pred>
struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
template <class _Hp, class ..._Tp>
struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
template <class _P1, class ..._Pr>
struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
// __lazy_not
template <class _Pred>
struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
// __make_tuple_indices
template <size_t...> struct __tuple_indices {};

View File

@ -851,7 +851,7 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
return _VSTD::move(__f); // explicitly moved for (emulated) C++03
return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03
}
// find
@ -2330,7 +2330,7 @@ __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirec
{
if (__first == --__last)
break;
swap(*__first, *__last);
_VSTD::iter_swap(__first, __last);
++__first;
}
}
@ -2342,7 +2342,7 @@ __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_ac
{
if (__first != __last)
for (; __first < --__last; ++__first)
swap(*__first, *__last);
_VSTD::iter_swap(__first, __last);
}
template <class _BidirectionalIterator>
@ -3037,7 +3037,7 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
if (_Rp == 0)
return static_cast<result_type>(_Eng(__g, _Dt)());
size_t __w = _Dt - __clz(_Rp) - 1;
if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0)
if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
++__w;
_Eng __e(__g, __w);
_UIntType __u;

View File

@ -89,12 +89,13 @@ template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <size_t I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexcept; // constexpr in C++14
} // std
@ -324,6 +325,15 @@ get(array<_Tp, _Size>&& __a) _NOEXCEPT
return _VSTD::move(__a.__elems_[_Ip]);
}
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&&
get(const array<_Tp, _Size>&& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
return _VSTD::move(__a.__elems_[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD

View File

@ -535,25 +535,35 @@ void atomic_signal_fence(memory_order m) noexcept;
#ifdef _LIBCPP_HAS_NO_THREADS
#error <atomic> is not supported on this single threaded system
#else // !_LIBCPP_HAS_NO_THREADS
#endif
#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
#error <atomic> is not implemented
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if !__has_feature(cxx_atomic) && _GNUC_VER < 407
#error <atomic> is not implemented
#else
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
#if _GNUC_VER >= 407
#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
namespace __gcc_atomic {
template <typename _Tp>
struct __gcc_atomic_t {
__gcc_atomic_t() _NOEXCEPT {}
#if _GNUC_VER >= 501
static_assert(is_trivially_copyable<_Tp>::value,
"std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
#endif
_LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
__gcc_atomic_t() _NOEXCEPT = default;
#else
__gcc_atomic_t() _NOEXCEPT : __a_value() {}
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
: __a_value(value) {}
_Tp __a_value;
@ -574,7 +584,7 @@ struct __can_assign {
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
};
static inline constexpr int __to_gcc_order(memory_order __order) {
static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@ -584,7 +594,7 @@ static inline constexpr int __to_gcc_order(memory_order __order) {
__ATOMIC_CONSUME))));
}
static inline constexpr int __to_gcc_failure_order(memory_order __order) {
static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@ -805,7 +815,7 @@ static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
return __atomic_fetch_xor(&__a->__a_value, __pattern,
__gcc_atomic::__to_gcc_order(__order));
}
#endif // _GNUC_VER >= 407
#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@ -825,7 +835,7 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile _NOEXCEPT
{
#if __has_feature(cxx_atomic)
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
return __c11_atomic_is_lock_free(sizeof(_Tp));
#else
return __atomic_is_lock_free(sizeof(_Tp), 0);
@ -1779,8 +1789,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
// lock-free property
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
@ -1792,10 +1800,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
#endif // !__has_feature(cxx_atomic)
_LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
#endif // _LIBCPP_ATOMIC

View File

@ -168,7 +168,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@ -180,8 +182,11 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip() _NOEXCEPT;
@ -192,22 +197,27 @@ protected:
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type, false_type) const;
unsigned long long to_ullong(true_type, true_type) const;
};
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@ -245,7 +255,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@ -264,7 +274,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@ -273,7 +283,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@ -282,7 +292,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@ -325,7 +335,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
__bitset<_N_words, _Size>::to_ulong(true_type) const
{
@ -348,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type) const
{
@ -356,7 +366,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
{
@ -414,7 +424,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{
@ -450,7 +460,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@ -462,23 +474,32 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void flip() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
_LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
@ -486,7 +507,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
@ -494,7 +515,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@ -502,7 +523,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@ -510,7 +531,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@ -518,7 +539,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::flip() _NOEXCEPT
{
@ -528,7 +549,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
__bitset<1, _Size>::to_ulong() const
{
@ -536,7 +557,7 @@ __bitset<1, _Size>::to_ulong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<1, _Size>::to_ullong() const
{
@ -544,7 +565,7 @@ __bitset<1, _Size>::to_ullong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
__bitset<1, _Size>::all() const _NOEXCEPT
{
@ -553,7 +574,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
__bitset<1, _Size>::any() const _NOEXCEPT
{
@ -562,7 +583,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
{
@ -593,7 +614,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
@ -620,13 +643,13 @@ protected:
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
@ -663,16 +686,23 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
_LIBCPP_INLINE_VISIBILITY
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true);
_LIBCPP_INLINE_VISIBILITY
bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos);
_LIBCPP_INLINE_VISIBILITY
bitset operator~() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& flip() _NOEXCEPT;
bitset& flip(size_t __pos);
@ -680,28 +710,40 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
_LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT>
_LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
_LIBCPP_INLINE_VISIBILITY
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
_LIBCPP_INLINE_VISIBILITY
size_t count() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const bitset& __rhs) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
_LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
_LIBCPP_INLINE_VISIBILITY
bitset operator<<(size_t __pos) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
@ -774,7 +816,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{
@ -783,7 +825,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{
@ -792,7 +834,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{
@ -821,7 +863,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::set() _NOEXCEPT
{
@ -844,7 +886,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::reset() _NOEXCEPT
{
@ -867,7 +909,7 @@ bitset<_Size>::reset(size_t __pos)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator~() const _NOEXCEPT
{
@ -877,7 +919,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::flip() _NOEXCEPT
{
@ -901,7 +943,7 @@ bitset<_Size>::flip(size_t __pos)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
bitset<_Size>::to_ulong() const
{
@ -909,7 +951,7 @@ bitset<_Size>::to_ulong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
bitset<_Size>::to_ullong() const
{
@ -932,7 +974,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, _Traits, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@ -941,7 +983,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@ -949,7 +991,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<char, char_traits<char>, allocator<char> >
bitset<_Size>::to_string(char __zero, char __one) const
{
@ -957,7 +999,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
bitset<_Size>::count() const _NOEXCEPT
{
@ -965,7 +1007,7 @@ bitset<_Size>::count() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{
@ -973,7 +1015,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{
@ -994,7 +1036,7 @@ bitset<_Size>::test(size_t __pos) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::all() const _NOEXCEPT
{
@ -1002,7 +1044,7 @@ bitset<_Size>::all() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::any() const _NOEXCEPT
{
@ -1010,7 +1052,7 @@ bitset<_Size>::any() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{
@ -1020,7 +1062,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{

View File

@ -37,10 +37,6 @@ int toupper(int c);
#include <__config>
#include <ctype.h>
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -48,117 +44,20 @@ int toupper(int c);
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef isalnum
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
#undef isalnum
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
#else // isalnum
using ::isalnum;
#endif // isalnum
#ifdef isalpha
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
#undef isalpha
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
#else // isalpha
using ::isalpha;
#endif // isalpha
#ifdef isblank
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
#undef isblank
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
#else // isblank
using ::isblank;
#endif // isblank
#ifdef iscntrl
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
#undef iscntrl
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
#else // iscntrl
using ::iscntrl;
#endif // iscntrl
#ifdef isdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
#undef isdigit
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
#else // isdigit
using ::isdigit;
#endif // isdigit
#ifdef isgraph
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
#undef isgraph
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
#else // isgraph
using ::isgraph;
#endif // isgraph
#ifdef islower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
#undef islower
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
#else // islower
using ::islower;
#endif // islower
#ifdef isprint
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
#undef isprint
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
#else // isprint
using ::isprint;
#endif // isprint
#ifdef ispunct
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
#undef ispunct
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
#else // ispunct
using ::ispunct;
#endif // ispunct
#ifdef isspace
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
#undef isspace
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
#else // isspace
using ::isspace;
#endif // isspace
#ifdef isupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
#undef isupper
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
#else // isupper
using ::isupper;
#endif // isupper
#ifdef isxdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
#undef isxdigit
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
#else // isxdigit
using ::isxdigit;
#endif // isxdigit
#ifdef tolower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
#undef tolower
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
#else // tolower
using ::tolower;
#endif // tolower
#ifdef toupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
#undef toupper
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
#else // toupper
using ::toupper;
#endif // toupper
_LIBCPP_END_NAMESPACE_STD

View File

@ -30,364 +30,4 @@ Macros:
#pragma GCC system_header
#endif
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2;
#else
const int __elast1 = 104;
const int __elast2 = 105;
#endif
#ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#else // defined(EOWNERDEAD)
#define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD)
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 9901
#endif
#ifndef EADDRINUSE
#define EADDRINUSE 9902
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL 9903
#endif
#ifndef EISCONN
#define EISCONN 9904
#endif
#ifndef EBADMSG
#define EBADMSG 9905
#endif
#ifndef ECONNABORTED
#define ECONNABORTED 9906
#endif
#ifndef EALREADY
#define EALREADY 9907
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED 9908
#endif
#ifndef ECONNRESET
#define ECONNRESET 9909
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ 9910
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH 9911
#endif
#ifndef EIDRM
#define EIDRM 9912
#endif
#ifndef EMSGSIZE
#define EMSGSIZE 9913
#endif
#ifndef ENETDOWN
#define ENETDOWN 9914
#endif
#ifndef ENETRESET
#define ENETRESET 9915
#endif
#ifndef ENETUNREACH
#define ENETUNREACH 9916
#endif
#ifndef ENOBUFS
#define ENOBUFS 9917
#endif
#ifndef ENOLINK
#define ENOLINK 9918
#endif
#ifndef ENODATA
#define ENODATA 9919
#endif
#ifndef ENOMSG
#define ENOMSG 9920
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 9921
#endif
#ifndef ENOSR
#define ENOSR 9922
#endif
#ifndef ENOTSOCK
#define ENOTSOCK 9923
#endif
#ifndef ENOSTR
#define ENOSTR 9924
#endif
#ifndef ENOTCONN
#define ENOTCONN 9925
#endif
#ifndef ENOTSUP
#define ENOTSUP 9926
#endif
#ifndef ECANCELED
#define ECANCELED 9927
#endif
#ifndef EINPROGRESS
#define EINPROGRESS 9928
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 9929
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 9930
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 9931
#endif
#ifndef EPROTO
#define EPROTO 9932
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 9933
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 9934
#endif
#ifndef ETIME
#define ETIME 9935
#endif
#ifndef ETXTBSY
#define ETXTBSY 9936
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 9938
#endif
#ifndef ELOOP
#define ELOOP 9939
#endif
#ifndef EOVERFLOW
#define EOVERFLOW 9940
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE 9941
#endif
#ifndef ENOSYS
#define ENOSYS 9942
#endif
#ifndef EINVAL
#define EINVAL 9943
#endif
#ifndef ERANGE
#define ERANGE 9944
#endif
#ifndef EILSEQ
#define EILSEQ 9945
#endif
// Windows Mobile doesn't appear to define these:
#ifndef E2BIG
#define E2BIG 9946
#endif
#ifndef EDOM
#define EDOM 9947
#endif
#ifndef EFAULT
#define EFAULT 9948
#endif
#ifndef EBADF
#define EBADF 9949
#endif
#ifndef EPIPE
#define EPIPE 9950
#endif
#ifndef EXDEV
#define EXDEV 9951
#endif
#ifndef EBUSY
#define EBUSY 9952
#endif
#ifndef ENOTEMPTY
#define ENOTEMPTY 9953
#endif
#ifndef ENOEXEC
#define ENOEXEC 9954
#endif
#ifndef EEXIST
#define EEXIST 9955
#endif
#ifndef EFBIG
#define EFBIG 9956
#endif
#ifndef ENAMETOOLONG
#define ENAMETOOLONG 9957
#endif
#ifndef ENOTTY
#define ENOTTY 9958
#endif
#ifndef EINTR
#define EINTR 9959
#endif
#ifndef ESPIPE
#define ESPIPE 9960
#endif
#ifndef EIO
#define EIO 9961
#endif
#ifndef EISDIR
#define EISDIR 9962
#endif
#ifndef ECHILD
#define ECHILD 9963
#endif
#ifndef ENOLCK
#define ENOLCK 9964
#endif
#ifndef ENOSPC
#define ENOSPC 9965
#endif
#ifndef ENXIO
#define ENXIO 9966
#endif
#ifndef ENODEV
#define ENODEV 9967
#endif
#ifndef ENOENT
#define ENOENT 9968
#endif
#ifndef ESRCH
#define ESRCH 9969
#endif
#ifndef ENOTDIR
#define ENOTDIR 9970
#endif
#ifndef ENOMEM
#define ENOMEM 9971
#endif
#ifndef EPERM
#define EPERM 9972
#endif
#ifndef EACCES
#define EACCES 9973
#endif
#ifndef EROFS
#define EROFS 9974
#endif
#ifndef EDEADLK
#define EDEADLK 9975
#endif
#ifndef EAGAIN
#define EAGAIN 9976
#endif
#ifndef ENFILE
#define ENFILE 9977
#endif
#ifndef EMFILE
#define EMFILE 9978
#endif
#ifndef EMLINK
#define EMLINK 9979
#endif
#endif // _LIBCPP_CERRNO

View File

@ -1,5 +1,5 @@
// -*- C++ -*-
//===---------------------------- cctype ----------------------------------===//
//===---------------------------- cfenv -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//

View File

@ -67,12 +67,4 @@ Macros:
#pragma GCC system_header
#endif
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif
#endif // _LIBCPP_CFLOAT

View File

@ -26,6 +26,9 @@ duration_cast(const duration<Rep, Period>& fd);
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
template <class Rep> constexpr bool treat_as_floating_point_v
= treat_as_floating_point<Rep>::value; // C++17
template <class Rep>
struct duration_values
{
@ -194,6 +197,13 @@ template <class Rep1, class Period1, class Rep2, class Period2>
template <class ToDuration, class Rep, class Period>
ToDuration duration_cast(const duration<Rep, Period>& d);
template <class ToDuration, class Rep, class Period>
constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
template <class ToDuration, class Rep, class Period>
constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
template <class ToDuration, class Rep, class Period>
constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
// time_point arithmetic (all constexpr in C++14)
template <class Clock, class Duration1, class Rep2, class Period2>
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
@ -227,6 +237,20 @@ template <class Clock, class Duration1, class Duration2>
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
floor(const time_point<Clock, Duration>& tp); // C++17
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
ceil(const time_point<Clock, Duration>& tp); // C++17
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
round(const time_point<Clock, Duration>& tp); // C++17
template <class Rep, class Period>
constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
// Clocks
class system_clock
@ -392,6 +416,11 @@ duration_cast(const duration<_Rep, _Period>& __fd)
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
= treat_as_floating_point<_Rep>::value;
#endif
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY duration_values
{
@ -401,6 +430,58 @@ public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
};
#if _LIBCPP_STD_VER > 14
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
floor(const duration<_Rep, _Period>& __d)
{
_ToDuration __t = duration_cast<_ToDuration>(__d);
if (__t > __d)
__t = __t - _ToDuration{1};
return __t;
}
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
ceil(const duration<_Rep, _Period>& __d)
{
_ToDuration __t = duration_cast<_ToDuration>(__d);
if (__t < __d)
__t = __t + _ToDuration{1};
return __t;
}
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
round(const duration<_Rep, _Period>& __d)
{
_ToDuration __lower = floor<_ToDuration>(__d);
_ToDuration __upper = __lower + _ToDuration{1};
auto __lowerDiff = __d - __lower;
auto __upperDiff = __upper - __d;
if (__lowerDiff < __upperDiff)
return __lower;
if (__lowerDiff > __upperDiff)
return __upper;
return __lower.count() & 1 ? __upper : __lower;
}
#endif
// duration
template <class _Rep, class _Period>
@ -807,6 +888,56 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
#if _LIBCPP_STD_VER > 14
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
floor(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
ceil(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
round(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
numeric_limits<_Rep>::is_signed,
duration<_Rep, _Period>
>::type
abs(duration<_Rep, _Period> __d)
{
return __d >= __d.zero() ? __d : -__d;
}
#endif
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>

View File

@ -246,10 +246,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
_LIBCPP_BEGIN_NAMESPACE_STD
using::imaxdiv_t;
#undef imaxabs
using::imaxabs;
#undef imaxdiv
using::imaxdiv;
using::strtoimax;
using::strtoumax;

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,12 @@
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef __cplusplus
#include <ccomplex>
@ -28,8 +34,4 @@
#endif // __cplusplus
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#endif // _LIBCPP_COMPLEX_H

View File

@ -124,14 +124,18 @@ class _LIBCPP_TYPE_VIS condition_variable_any
condition_variable __cv_;
shared_ptr<mutex> __mut_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable_any();
_LIBCPP_INLINE_VISIBILITY
void notify_one() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void notify_all() _NOEXCEPT;
template <class _Lock>
void wait(_Lock& __lock);
template <class _Lock, class _Predicate>
_LIBCPP_INLINE_VISIBILITY
void wait(_Lock& __lock, _Predicate __pred);
template <class _Lock, class _Clock, class _Duration>
@ -141,27 +145,30 @@ public:
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
template <class _Lock, class _Rep, class _Period>
cv_status
_LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d);
template <class _Lock, class _Rep, class _Period, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
};
inline _LIBCPP_INLINE_VISIBILITY
inline
condition_variable_any::condition_variable_any()
: __mut_(make_shared<mutex>()) {}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_one() _NOEXCEPT
{
@ -169,7 +176,7 @@ condition_variable_any::notify_one() _NOEXCEPT
__cv_.notify_one();
}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_all() _NOEXCEPT
{
@ -196,7 +203,7 @@ condition_variable_any::wait(_Lock& __lock)
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
{
@ -218,7 +225,7 @@ condition_variable_any::wait_until(_Lock& __lock,
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
@ -231,7 +238,7 @@ condition_variable_any::wait_until(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
cv_status
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d)
@ -240,7 +247,7 @@ condition_variable_any::wait_for(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,

View File

@ -38,10 +38,6 @@ void longjmp(jmp_buf env, int val);
#pragma GCC system_header
#endif
#ifndef setjmp
#define setjmp(env) setjmp(env)
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::jmp_buf;

View File

@ -35,12 +35,14 @@ Types:
#include <__config>
#include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
#include_next <stddef.h>
#include <__nullptr>
_LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
@ -53,50 +55,6 @@ using ::max_align_t;
typedef long double max_align_t;
#endif
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
{
void* __lx;
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t()
#endif // _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_CSTDDEF

View File

@ -103,41 +103,6 @@ void perror(const char* s);
#pragma GCC system_header
#endif
// snprintf
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
#endif // getc
#ifdef putc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
#undef putc
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
#ifdef clearerr
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
#undef clearerr
inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
#endif // clearerr
#ifdef feof
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
#undef feof
inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
#endif // feof
#ifdef ferror
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
#undef ferror
inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
#endif // ferror
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;

View File

@ -84,9 +84,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config>
#include <stdlib.h>
#ifdef _LIBCPP_MSVCRT
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -131,20 +128,14 @@ using ::getenv;
using ::system;
using ::bsearch;
using ::qsort;
#undef abs
using ::abs;
#undef labs
using ::labs;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef llabs
using ::llabs;
#endif // _LIBCPP_HAS_NO_LONG_LONG
#undef div
using ::div;
#undef ldiv
using ::ldiv;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef lldiv
using ::lldiv;
#endif // _LIBCPP_HAS_NO_LONG_LONG
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
@ -162,19 +153,6 @@ using ::quick_exit;
using ::aligned_alloc;
#endif
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _LIBCPP_MSVCRT
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CSTDLIB

69
include/ctype.h Normal file
View File

@ -0,0 +1,69 @@
// -*- C++ -*-
//===---------------------------- ctype.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CTYPE_H
#define _LIBCPP_CTYPE_H
/*
ctype.h synopsis
int isalnum(int c);
int isalpha(int c);
int isblank(int c); // C99
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <ctype.h>
#ifdef __cplusplus
#if defined(_LIBCPP_MSVCRT)
// We support including .h headers inside 'extern "C"' contexts, so switch
// back to C++ linkage before including these C++ headers.
extern "C++" {
#include "support/win32/support.h"
#include "support/win32/locale_win32.h"
}
#endif // _LIBCPP_MSVCRT
#undef isalnum
#undef isalpha
#undef isblank
#undef iscntrl
#undef isdigit
#undef isgraph
#undef islower
#undef isprint
#undef ispunct
#undef isspace
#undef isupper
#undef isxdigit
#undef tolower
#undef toupper
#endif
#endif // _LIBCPP_CTYPE_H

View File

@ -106,9 +106,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -161,16 +158,13 @@ using ::wcscoll;
using ::wcsncmp;
using ::wcsxfrm;
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
#else
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
@ -185,7 +179,6 @@ inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, cons
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
#endif
using ::wcscspn;

View File

@ -63,150 +63,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::wint_t;
using ::wctrans_t;
using ::wctype_t;
#ifdef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
#undef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
#else // iswalnum
using ::iswalnum;
#endif
#ifdef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
#undef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
#else // iswalpha
using ::iswalpha;
#endif
#ifdef iswblank
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
#undef iswblank
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
#else // iswblank
using ::iswblank;
#endif
#ifdef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
#undef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
#else // iswcntrl
using ::iswcntrl;
#endif
#ifdef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
#undef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
#else // iswdigit
using ::iswdigit;
#endif
#ifdef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
#undef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
#else // iswgraph
using ::iswgraph;
#endif
#ifdef iswlower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
#undef iswlower
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
#else // iswlower
using ::iswlower;
#endif
#ifdef iswprint
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
#undef iswprint
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
#else // iswprint
using ::iswprint;
#endif
#ifdef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
#undef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
#else // iswpunct
using ::iswpunct;
#endif
#ifdef iswspace
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
#undef iswspace
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
#else // iswspace
using ::iswspace;
#endif
#ifdef iswupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
#undef iswupper
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
#else // iswupper
using ::iswupper;
#endif
#ifdef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
#undef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
#else // iswxdigit
using ::iswxdigit;
#endif
#ifdef iswctype
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
#undef iswctype
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
#else // iswctype
using ::iswctype;
#endif
#ifdef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
#undef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
#else // wctype
using ::wctype;
#endif
#ifdef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
#undef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
#else // towlower
using ::towlower;
#endif
#ifdef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
#undef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
#else // towupper
using ::towupper;
#endif
#ifdef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
#undef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
#else // towctrans
using ::towctrans;
#endif
#ifdef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
#undef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
#else // wctrans
using ::wctrans;
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -261,8 +261,21 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
template <class _ValueType, class _DiffType>
struct __deque_block_size {
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _DiffType, _DiffType _BS =
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
// Keep template parameter to avoid changing all template declarations thoughout
// this file.
0
#else
__deque_block_size<_ValueType, _DiffType>::value
#endif
>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
{
typedef _MapPointer __map_iterator;
@ -273,7 +286,7 @@ private:
__map_iterator __m_iter_;
pointer __ptr_;
static const difference_type __block_size = _BlockSize;
static const difference_type __block_size;
public:
typedef _ValueType value_type;
typedef random_access_iterator_tag iterator_category;
@ -287,7 +300,7 @@ public:
template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
@ -520,6 +533,12 @@ private:
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
_DiffType, _BlockSize>::__block_size =
__deque_block_size<_ValueType, _DiffType>::value;
// copy
template <class _RAIter,
@ -532,10 +551,11 @@ copy(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
pointer __re = *__r.__m_iter_ + _B2;
pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@ -560,11 +580,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -587,11 +608,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -705,10 +727,11 @@ move(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
pointer __re = *__r.__m_iter_ + _B2;
pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@ -733,11 +756,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -760,11 +784,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -909,7 +934,7 @@ protected:
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
static const difference_type __block_size;
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
@ -919,9 +944,9 @@ protected:
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
difference_type, __block_size> iterator;
difference_type> iterator;
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
difference_type, __block_size> const_iterator;
difference_type> const_iterator;
__map __map_;
size_type __start_;
@ -939,8 +964,10 @@ protected:
_LIBCPP_INLINE_VISIBILITY
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
_LIBCPP_INLINE_VISIBILITY
__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
_LIBCPP_INLINE_VISIBILITY
explicit __deque_base(const allocator_type& __a);
public:
~__deque_base();
@ -996,6 +1023,11 @@ private:
{}
};
template <class _Tp, class _Allocator>
const typename __deque_base<_Tp, _Allocator>::difference_type
__deque_base<_Tp, _Allocator>::__block_size =
__deque_block_size<value_type, difference_type>::value;
template <class _Tp, class _Allocator>
bool
__deque_base<_Tp, _Allocator>::__invariants() const
@ -1060,13 +1092,13 @@ __deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deque_base<_Tp, _Allocator>::__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __start_(0), __size_(0) {}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
@ -1164,6 +1196,9 @@ public:
typedef _Tp value_type;
typedef _Allocator allocator_type;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
typedef __deque_base<value_type, allocator_type> __base;
typedef typename __base::__alloc_traits __alloc_traits;
@ -1211,8 +1246,11 @@ public:
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
_LIBCPP_INLINE_VISIBILITY
deque(deque&& __c, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
deque& operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
@ -1231,6 +1269,7 @@ public:
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT;
// iterators:
@ -1283,13 +1322,21 @@ public:
bool empty() const _NOEXCEPT {return __base::size() == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY
reference operator[](size_type __i);
_LIBCPP_INLINE_VISIBILITY
const_reference operator[](size_type __i) const;
_LIBCPP_INLINE_VISIBILITY
reference at(size_type __i);
_LIBCPP_INLINE_VISIBILITY
const_reference at(size_type __i) const;
_LIBCPP_INLINE_VISIBILITY
reference front();
_LIBCPP_INLINE_VISIBILITY
const_reference front() const;
_LIBCPP_INLINE_VISIBILITY
reference back();
_LIBCPP_INLINE_VISIBILITY
const_reference back() const;
// 23.2.2.3 modifiers:
@ -1328,6 +1375,7 @@ public:
iterator erase(const_iterator __p);
iterator erase(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY
void swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
@ -1335,6 +1383,7 @@ public:
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@ -1507,7 +1556,7 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __base(_VSTD::move(__c))
@ -1515,7 +1564,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_VSTD::move(__c), __a)
{
@ -1527,7 +1576,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
@ -1611,7 +1660,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Allocator
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
{
@ -1670,7 +1719,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::operator[](size_type __i)
{
@ -1679,7 +1728,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const
{
@ -1688,7 +1737,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::at(size_type __i)
{
@ -1699,7 +1748,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::at(size_type __i) const
{
@ -1710,7 +1759,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::front()
{
@ -1719,7 +1768,7 @@ deque<_Tp, _Allocator>::front()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::front() const
{
@ -1728,7 +1777,7 @@ deque<_Tp, _Allocator>::front() const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::back()
{
@ -1737,7 +1786,7 @@ deque<_Tp, _Allocator>::back()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::back() const
{
@ -2029,7 +2078,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
if (__n > __pos)
@ -2054,7 +2102,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
size_type __de = __base::size() - __pos;
@ -2119,7 +2166,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
_BiIter __m = __f;
@ -2150,7 +2196,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
_BiIter __m = __l;
@ -2685,7 +2730,6 @@ template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::erase(const_iterator __f)
{
difference_type __n = 1;
iterator __b = __base::begin();
difference_type __pos = __f - __b;
iterator __p = __b + __pos;
@ -2781,7 +2825,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
@ -2795,7 +2839,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::clear() _NOEXCEPT
{

398
include/errno.h Normal file
View File

@ -0,0 +1,398 @@
// -*- C++ -*-
//===-------------------------- errno.h -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_ERRNO_H
#define _LIBCPP_ERRNO_H
/*
errno.h synopsis
Macros:
EDOM
EILSEQ // C99
ERANGE
errno
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <errno.h>
#ifdef __cplusplus
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
static const int __elast1 = ELAST+1;
static const int __elast2 = ELAST+2;
#else
static const int __elast1 = 104;
static const int __elast2 = 105;
#endif
#ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#else // defined(EOWNERDEAD)
#define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD)
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 9901
#endif
#ifndef EADDRINUSE
#define EADDRINUSE 9902
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL 9903
#endif
#ifndef EISCONN
#define EISCONN 9904
#endif
#ifndef EBADMSG
#define EBADMSG 9905
#endif
#ifndef ECONNABORTED
#define ECONNABORTED 9906
#endif
#ifndef EALREADY
#define EALREADY 9907
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED 9908
#endif
#ifndef ECONNRESET
#define ECONNRESET 9909
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ 9910
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH 9911
#endif
#ifndef EIDRM
#define EIDRM 9912
#endif
#ifndef EMSGSIZE
#define EMSGSIZE 9913
#endif
#ifndef ENETDOWN
#define ENETDOWN 9914
#endif
#ifndef ENETRESET
#define ENETRESET 9915
#endif
#ifndef ENETUNREACH
#define ENETUNREACH 9916
#endif
#ifndef ENOBUFS
#define ENOBUFS 9917
#endif
#ifndef ENOLINK
#define ENOLINK 9918
#endif
#ifndef ENODATA
#define ENODATA 9919
#endif
#ifndef ENOMSG
#define ENOMSG 9920
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 9921
#endif
#ifndef ENOSR
#define ENOSR 9922
#endif
#ifndef ENOTSOCK
#define ENOTSOCK 9923
#endif
#ifndef ENOSTR
#define ENOSTR 9924
#endif
#ifndef ENOTCONN
#define ENOTCONN 9925
#endif
#ifndef ENOTSUP
#define ENOTSUP 9926
#endif
#ifndef ECANCELED
#define ECANCELED 9927
#endif
#ifndef EINPROGRESS
#define EINPROGRESS 9928
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 9929
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 9930
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 9931
#endif
#ifndef EPROTO
#define EPROTO 9932
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 9933
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 9934
#endif
#ifndef ETIME
#define ETIME 9935
#endif
#ifndef ETXTBSY
#define ETXTBSY 9936
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 9938
#endif
#ifndef ELOOP
#define ELOOP 9939
#endif
#ifndef EOVERFLOW
#define EOVERFLOW 9940
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE 9941
#endif
#ifndef ENOSYS
#define ENOSYS 9942
#endif
#ifndef EINVAL
#define EINVAL 9943
#endif
#ifndef ERANGE
#define ERANGE 9944
#endif
#ifndef EILSEQ
#define EILSEQ 9945
#endif
// Windows Mobile doesn't appear to define these:
#ifndef E2BIG
#define E2BIG 9946
#endif
#ifndef EDOM
#define EDOM 9947
#endif
#ifndef EFAULT
#define EFAULT 9948
#endif
#ifndef EBADF
#define EBADF 9949
#endif
#ifndef EPIPE
#define EPIPE 9950
#endif
#ifndef EXDEV
#define EXDEV 9951
#endif
#ifndef EBUSY
#define EBUSY 9952
#endif
#ifndef ENOTEMPTY
#define ENOTEMPTY 9953
#endif
#ifndef ENOEXEC
#define ENOEXEC 9954
#endif
#ifndef EEXIST
#define EEXIST 9955
#endif
#ifndef EFBIG
#define EFBIG 9956
#endif
#ifndef ENAMETOOLONG
#define ENAMETOOLONG 9957
#endif
#ifndef ENOTTY
#define ENOTTY 9958
#endif
#ifndef EINTR
#define EINTR 9959
#endif
#ifndef ESPIPE
#define ESPIPE 9960
#endif
#ifndef EIO
#define EIO 9961
#endif
#ifndef EISDIR
#define EISDIR 9962
#endif
#ifndef ECHILD
#define ECHILD 9963
#endif
#ifndef ENOLCK
#define ENOLCK 9964
#endif
#ifndef ENOSPC
#define ENOSPC 9965
#endif
#ifndef ENXIO
#define ENXIO 9966
#endif
#ifndef ENODEV
#define ENODEV 9967
#endif
#ifndef ENOENT
#define ENOENT 9968
#endif
#ifndef ESRCH
#define ESRCH 9969
#endif
#ifndef ENOTDIR
#define ENOTDIR 9970
#endif
#ifndef ENOMEM
#define ENOMEM 9971
#endif
#ifndef EPERM
#define EPERM 9972
#endif
#ifndef EACCES
#define EACCES 9973
#endif
#ifndef EROFS
#define EROFS 9974
#endif
#ifndef EDEADLK
#define EDEADLK 9975
#endif
#ifndef EAGAIN
#define EAGAIN 9976
#endif
#ifndef ENFILE
#define ENFILE 9977
#endif
#ifndef EMFILE
#define EMFILE 9978
#endif
#ifndef EMLINK
#define EMLINK 9979
#endif
#endif // __cplusplus
#endif // _LIBCPP_ERRNO_H

View File

@ -235,7 +235,7 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
is_polymorphic<_Ep>::value
>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
__nep->rethrow_nested();
}

View File

@ -50,6 +50,12 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last,
_LIBCPP_BEGIN_NAMESPACE_LFTS
template <class _ForwardIterator, class _Searcher>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
{ return __s(__f, __l); }
template <class _PopulationIterator, class _SampleIterator, class _Distance,
class _UniformRandomNumberGenerator>
_LIBCPP_INLINE_VISIBILITY

590
include/experimental/any Normal file
View File

@ -0,0 +1,590 @@
// -*- C++ -*-
//===------------------------------ any -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_ANY
#define _LIBCPP_EXPERIMENTAL_ANY
/*
experimental/any synopsis
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
class bad_any_cast : public bad_cast
{
public:
virtual const char* what() const noexcept;
};
class any
{
public:
// 6.3.1 any construct/destruct
any() noexcept;
any(const any& other);
any(any&& other) noexcept;
template <class ValueType>
any(ValueType&& value);
~any();
// 6.3.2 any assignments
any& operator=(const any& rhs);
any& operator=(any&& rhs) noexcept;
template <class ValueType>
any& operator=(ValueType&& rhs);
// 6.3.3 any modifiers
void clear() noexcept;
void swap(any& rhs) noexcept;
// 6.3.4 any observers
bool empty() const noexcept;
const type_info& type() const noexcept;
};
// 6.4 Non-member functions
void swap(any& x, any& y) noexcept;
template<class ValueType>
ValueType any_cast(const any& operand);
template<class ValueType>
ValueType any_cast(any& operand);
template<class ValueType>
ValueType any_cast(any&& operand);
template<class ValueType>
const ValueType* any_cast(const any* operand) noexcept;
template<class ValueType>
ValueType* any_cast(any* operand) noexcept;
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <memory>
#include <new>
#include <typeinfo>
#include <type_traits>
#include <cstdlib>
#include <cassert>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
{
public:
virtual const char* what() const _NOEXCEPT;
};
#if _LIBCPP_STD_VER > 11 // C++ > 11
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
inline void __throw_bad_any_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_any_cast();
#else
assert(!"bad_any_cast");
#endif
}
// Forward declarations
class any;
template <class _ValueType>
typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const *) _NOEXCEPT;
template <class _ValueType>
typename add_pointer<_ValueType>::type
any_cast(any *) _NOEXCEPT;
namespace __any_imp
{
typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
_Buffer;
template <class _Tp>
struct _IsSmallObject
: public integral_constant<bool
, sizeof(_Tp) <= sizeof(_Buffer)
&& alignment_of<_Buffer>::value
% alignment_of<_Tp>::value == 0
&& is_nothrow_move_constructible<_Tp>::value
>
{};
enum class _Action
{
_Destroy,
_Copy,
_Move,
_Get,
_TypeInfo
};
template <class _Tp>
struct _SmallHandler;
template <class _Tp>
struct _LargeHandler;
template <class _Tp>
using _Handler = typename conditional<_IsSmallObject<_Tp>::value
, _SmallHandler<_Tp>
, _LargeHandler<_Tp>
>::type;
template <class _ValueType>
using _EnableIfNotAny = typename
enable_if<
!is_same<typename decay<_ValueType>::type, any>::value
>::type;
} // namespace __any_imp
class any
{
public:
// 6.3.1 any construct/destruct
_LIBCPP_INLINE_VISIBILITY
any() _NOEXCEPT : __h(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
any(any const & __other) : __h(nullptr)
{
if (__other.__h) __other.__call(_Action::_Copy, this);
}
_LIBCPP_INLINE_VISIBILITY
any(any && __other) _NOEXCEPT : __h(nullptr)
{
if (__other.__h) __other.__call(_Action::_Move, this);
}
template <
class _ValueType
, class = __any_imp::_EnableIfNotAny<_ValueType>
>
any(_ValueType && __value);
_LIBCPP_INLINE_VISIBILITY
~any()
{
this->clear();
}
// 6.3.2 any assignments
_LIBCPP_INLINE_VISIBILITY
any & operator=(any const & __rhs)
{
any(__rhs).swap(*this);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
any & operator=(any && __rhs) _NOEXCEPT
{
any(_VSTD::move(__rhs)).swap(*this);
return *this;
}
template <
class _ValueType
, class = __any_imp::_EnableIfNotAny<_ValueType>
>
any & operator=(_ValueType && __rhs);
// 6.3.3 any modifiers
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{
if (__h) this->__call(_Action::_Destroy);
}
void swap(any & __rhs) _NOEXCEPT;
// 6.3.4 any observers
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT
{
return __h == nullptr;
}
#if !defined(_LIBCPP_NO_RTTI)
_LIBCPP_INLINE_VISIBILITY
const type_info & type() const _NOEXCEPT
{
if (__h) {
return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
} else {
return typeid(void);
}
}
#endif
private:
typedef __any_imp::_Action _Action;
typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
union _Storage
{
void * __ptr;
__any_imp::_Buffer __buf;
};
_LIBCPP_ALWAYS_INLINE
void * __call(_Action __a, any * __other = nullptr,
type_info const * __info = nullptr) const
{
return __h(__a, this, __other, __info);
}
_LIBCPP_ALWAYS_INLINE
void * __call(_Action __a, any * __other = nullptr,
type_info const * __info = nullptr)
{
return __h(__a, this, __other, __info);
}
template <class>
friend struct __any_imp::_SmallHandler;
template <class>
friend struct __any_imp::_LargeHandler;
template <class _ValueType>
friend typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const *) _NOEXCEPT;
template <class _ValueType>
friend typename add_pointer<_ValueType>::type
any_cast(any *) _NOEXCEPT;
_HandleFuncPtr __h;
_Storage __s;
};
namespace __any_imp
{
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY _SmallHandler
{
_LIBCPP_INLINE_VISIBILITY
static void* __handle(_Action __act, any const * __this, any * __other,
type_info const * __info)
{
switch (__act)
{
case _Action::_Destroy:
__destroy(const_cast<any &>(*__this));
return nullptr;
case _Action::_Copy:
__copy(*__this, *__other);
return nullptr;
case _Action::_Move:
__move(const_cast<any &>(*__this), *__other);
return nullptr;
case _Action::_Get:
return __get(const_cast<any &>(*__this), __info);
case _Action::_TypeInfo:
return __type_info();
}
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
static void __create(any & __dest, _Up && __v)
{
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
__dest.__h = &_SmallHandler::__handle;
}
private:
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __destroy(any & __this)
{
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
__value.~_Tp();
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __copy(any const & __this, any & __dest)
{
_SmallHandler::__create(__dest, *static_cast<_Tp const *>(
static_cast<void const *>(&__this.__s.__buf)));
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __move(any & __this, any & __dest)
{
_SmallHandler::__create(__dest, _VSTD::move(
*static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
__destroy(__this);
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __get(any & __this, type_info const * __info)
{
#if !defined(_LIBCPP_NO_RTTI)
if (typeid(_Tp) == *__info) {
return static_cast<void*>(&__this.__s.__buf);
}
return nullptr;
#else
return static_cast<void*>(&__this.__s.__buf);
#endif
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __type_info()
{
#if !defined(_LIBCPP_NO_RTTI)
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
#else
return nullptr;
#endif
}
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY _LargeHandler
{
_LIBCPP_INLINE_VISIBILITY
static void* __handle(_Action __act, any const * __this, any * __other,
type_info const * __info)
{
switch (__act)
{
case _Action::_Destroy:
__destroy(const_cast<any &>(*__this));
return nullptr;
case _Action::_Copy:
__copy(*__this, *__other);
return nullptr;
case _Action::_Move:
__move(const_cast<any &>(*__this), *__other);
return nullptr;
case _Action::_Get:
return __get(const_cast<any &>(*__this), __info);
case _Action::_TypeInfo:
return __type_info();
}
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
static void __create(any & __dest, _Up && __v)
{
typedef allocator<_Tp> _Alloc;
typedef __allocator_destructor<_Alloc> _Dp;
_Alloc __a;
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v));
__dest.__s.__ptr = __hold.release();
__dest.__h = &_LargeHandler::__handle;
}
private:
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __destroy(any & __this)
{
delete static_cast<_Tp*>(__this.__s.__ptr);
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __copy(any const & __this, any & __dest)
{
_LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __move(any & __this, any & __dest)
{
__dest.__s.__ptr = __this.__s.__ptr;
__dest.__h = &_LargeHandler::__handle;
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __get(any & __this, type_info const * __info)
{
#if !defined(_LIBCPP_NO_RTTI)
if (typeid(_Tp) == *__info) {
return static_cast<void*>(__this.__s.__ptr);
}
return nullptr;
#else
return static_cast<void*>(__this.__s.__ptr);
#endif
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __type_info()
{
#if !defined(_LIBCPP_NO_RTTI)
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
#else
return nullptr;
#endif
}
};
} // namespace __any_imp
template <class _ValueType, class>
_LIBCPP_INLINE_VISIBILITY
any::any(_ValueType && __v) : __h(nullptr)
{
typedef typename decay<_ValueType>::type _Tp;
static_assert(is_copy_constructible<_Tp>::value,
"_ValueType must be CopyConstructible.");
typedef __any_imp::_Handler<_Tp> _HandlerType;
_HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
}
template <class _ValueType, class>
_LIBCPP_INLINE_VISIBILITY
any & any::operator=(_ValueType && __v)
{
typedef typename decay<_ValueType>::type _Tp;
static_assert(is_copy_constructible<_Tp>::value,
"_ValueType must be CopyConstructible.");
any(_VSTD::forward<_ValueType>(__v)).swap(*this);
return *this;
}
inline _LIBCPP_INLINE_VISIBILITY
void any::swap(any & __rhs) _NOEXCEPT
{
if (__h && __rhs.__h) {
any __tmp;
__rhs.__call(_Action::_Move, &__tmp);
this->__call(_Action::_Move, &__rhs);
__tmp.__call(_Action::_Move, this);
}
else if (__h) {
this->__call(_Action::_Move, &__rhs);
}
else if (__rhs.__h) {
__rhs.__call(_Action::_Move, this);
}
}
// 6.4 Non-member functions
inline _LIBCPP_INLINE_VISIBILITY
void swap(any & __lhs, any & __rhs) _NOEXCEPT
{
__lhs.swap(__rhs);
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any const & __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename add_const<typename remove_reference<_ValueType>::type>::type
_Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any & __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename remove_reference<_ValueType>::type _Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any && __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename remove_reference<_ValueType>::type _Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
inline _LIBCPP_INLINE_VISIBILITY
typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const * __any) _NOEXCEPT
{
static_assert(!is_reference<_ValueType>::value,
"_ValueType may not be a reference.");
return any_cast<_ValueType>(const_cast<any *>(__any));
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
typename add_pointer<_ValueType>::type
any_cast(any * __any) _NOEXCEPT
{
using __any_imp::_Action;
static_assert(!is_reference<_ValueType>::value,
"_ValueType may not be a reference.");
typedef typename add_pointer<_ValueType>::type _ReturnType;
if (__any && __any->__h) {
return static_cast<_ReturnType>(
__any->__call(_Action::_Get, nullptr,
#if !defined(_LIBCPP_NO_RTTI)
&typeid(_ValueType)
#else
nullptr
#endif
));
}
return nullptr;
}
#endif // _LIBCPP_STD_VER > 11
_LIBCPP_END_NAMESPACE_LFTS
#endif // _LIBCPP_EXPERIMENTAL_ANY

View File

@ -137,7 +137,7 @@ public:
private:
size_t __size_;
value_type * __base_;
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
{

View File

@ -0,0 +1,454 @@
// -*- C++ -*-
//===-------------------------- functional --------------------------------===//
//
// 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_EXPERIMENTAL_FUNCTIONAL
#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL
/*
experimental/functional synopsis
#include <algorithm>
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
// See C++14 20.9.9, Function object binders
template <class T> constexpr bool is_bind_expression_v
= is_bind_expression<T>::value;
template <class T> constexpr int is_placeholder_v
= is_placeholder<T>::value;
// 4.2, Class template function
template<class> class function; // undefined
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
// 4.3, Searchers
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
class default_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher;
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
default_searcher<ForwardIterator, BinaryPredicate>
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_horspool_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
} // namespace fundamentals_v1
} // namespace experimental
template<class R, class... ArgTypes, class Alloc>
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
} // namespace std
*/
#include <experimental/__config>
#include <functional>
#include <algorithm>
#include <type_traits>
#include <vector>
#include <array>
#include <unordered_map>
#include <__undef_min_max>
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
#if _LIBCPP_STD_VER > 11
// default searcher
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class default_searcher {
public:
_LIBCPP_INLINE_VISIBILITY
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
_BinaryPredicate __p = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__p) {}
template <typename _ForwardIterator2>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
{
return _VSTD::search(__f, __l, __first_, __last_, __pred_);
}
private:
_ForwardIterator __first_;
_ForwardIterator __last_;
_BinaryPredicate __pred_;
};
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
default_searcher<_ForwardIterator, _BinaryPredicate>
make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ())
{
return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p);
}
template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable;
// General case for BM data searching; use a map
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
public: // TODO private:
typedef _Value value_type;
typedef _Key key_type;
const _Value __default_value_;
std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
public:
_LIBCPP_INLINE_VISIBILITY
_BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
: __default_value_(__default), __table(__sz, __hf, __pred) {}
_LIBCPP_INLINE_VISIBILITY
void insert(const key_type &__key, value_type __val)
{
__table [__key] = __val; // Would skip_.insert (val) be better here?
}
_LIBCPP_INLINE_VISIBILITY
value_type operator [](const key_type & __key) const
{
auto __it = __table.find (__key);
return __it == __table.end() ? __default_value_ : __it->second;
}
};
// Special case small numeric values; use an array
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
private:
typedef _Value value_type;
typedef _Key key_type;
typedef typename std::make_unsigned<key_type>::type unsigned_key_type;
typedef std::array<value_type, _VSTD::numeric_limits<unsigned_key_type>::max()> skip_map;
skip_map __table;
public:
_LIBCPP_INLINE_VISIBILITY
_BMSkipTable(std::size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/)
{
std::fill_n(__table.begin(), __table.size(), __default);
}
_LIBCPP_INLINE_VISIBILITY
void insert(key_type __key, value_type __val)
{
__table[static_cast<unsigned_key_type>(__key)] = __val;
}
_LIBCPP_INLINE_VISIBILITY
value_type operator [](key_type __key) const
{
return __table[static_cast<unsigned_key_type>(__key)];
}
};
template <class _RandomAccessIterator1,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class boyer_moore_searcher {
private:
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
_VSTD::is_integral<value_type>::value && // what about enums?
sizeof(value_type) == 1 &&
is_same<_Hash, hash<value_type>>::value &&
is_same<_BinaryPredicate, equal_to<>>::value
> skip_table_type;
public:
boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__pred),
__pattern_length_(_VSTD::distance(__first_, __last_)),
__skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
__suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)}
{
// build the skip table
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
__skip_->insert(*__f, __i);
this->__build_suffix_table ( __first_, __last_, __pred_ );
}
template <typename _RandomAccessIterator2>
_RandomAccessIterator2
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
static_assert ( std::is_same<
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
>::value,
"Corpus and Pattern iterators must point to the same type" );
if (__f == __l ) return __l; // empty corpus
if (__first_ == __last_) return __f; // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance (__f, __l))
return __l;
// Do the search
return this->__search(__f, __l);
}
public: // TODO private:
_RandomAccessIterator1 __first_;
_RandomAccessIterator1 __last_;
_BinaryPredicate __pred_;
difference_type __pattern_length_;
shared_ptr<skip_table_type> __skip_;
shared_ptr<vector<difference_type>> __suffix_;
template <typename _RandomAccessIterator2>
_RandomAccessIterator2 __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
_RandomAccessIterator2 __cur = __f;
const _RandomAccessIterator2 __last = __l - __pattern_length_;
const skip_table_type & __skip = *__skip_.get();
const vector<difference_type> & __suffix = *__suffix_.get();
while (__cur <= __last)
{
// Do we match right where we are?
difference_type __j = __pattern_length_;
while (__pred_(__first_ [__j-1], __cur [__j-1])) {
__j--;
// We matched - we're done!
if ( __j == 0 )
return __cur;
}
// Since we didn't match, figure out how far to skip forward
difference_type __k = __skip[__cur [ __j - 1 ]];
difference_type __m = __j - __k - 1;
if (__k < __j && __m > __suffix[ __j ])
__cur += __m;
else
__cur += __suffix[ __j ];
}
return __l; // We didn't find anything
}
template<typename _Iterator, typename _Container>
void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
{
const std::size_t __count = _VSTD::distance(__f, __l);
__prefix[0] = 0;
std::size_t __k = 0;
for ( std::size_t __i = 1; __i < __count; ++__i )
{
while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
__k = __prefix [ __k - 1 ];
if ( __pred ( __f[__k], __f[__i] ))
__k++;
__prefix [ __i ] = __k;
}
}
void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_BinaryPredicate __pred)
{
const std::size_t __count = _VSTD::distance(__f, __l);
vector<difference_type> & __suffix = *__suffix_.get();
if (__count > 0)
{
_VSTD::vector<value_type> __scratch(__count);
__compute_bm_prefix(__f, __l, __pred, __scratch);
for ( std::size_t __i = 0; __i <= __count; __i++ )
__suffix[__i] = __count - __scratch[__count-1];
typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
__compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
for ( std::size_t __i = 0; __i < __count; __i++ )
{
const std::size_t __j = __count - __scratch[__i];
const difference_type __k = __i - __scratch[__i] + 1;
if (__suffix[__j] > __k)
__suffix[__j] = __k;
}
}
}
};
template<class _RandomAccessIterator,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
{
return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
}
// boyer-moore-horspool
template <class _RandomAccessIterator1,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class boyer_moore_horspool_searcher {
private:
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
_VSTD::is_integral<value_type>::value && // what about enums?
sizeof(value_type) == 1 &&
is_same<_Hash, hash<value_type>>::value &&
is_same<_BinaryPredicate, equal_to<>>::value
> skip_table_type;
public:
boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__pred),
__pattern_length_(_VSTD::distance(__first_, __last_)),
__skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)}
{
// build the skip table
if ( __f != __l )
{
__l = __l - 1;
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
__skip_->insert(*__f, __pattern_length_ - 1 - __i);
}
}
template <typename _RandomAccessIterator2>
_RandomAccessIterator2
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
static_assert ( std::is_same<
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
>::value,
"Corpus and Pattern iterators must point to the same type" );
if (__f == __l ) return __l; // empty corpus
if (__first_ == __last_) return __f; // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance (__f, __l))
return __l;
// Do the search
return this->__search(__f, __l);
}
private:
_RandomAccessIterator1 __first_;
_RandomAccessIterator1 __last_;
_BinaryPredicate __pred_;
difference_type __pattern_length_;
shared_ptr<skip_table_type> __skip_;
template <typename _RandomAccessIterator2>
_RandomAccessIterator2 __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const {
_RandomAccessIterator2 __cur = __f;
const _RandomAccessIterator2 __last = __l - __pattern_length_;
const skip_table_type & __skip = *__skip_.get();
while (__cur <= __last)
{
// Do we match right where we are?
difference_type __j = __pattern_length_;
while (__pred_(__first_[__j-1], __cur[__j-1]))
{
__j--;
// We matched - we're done!
if ( __j == 0 )
return __cur;
}
__cur += __skip[__cur[__pattern_length_-1]];
}
return __l;
}
};
template<class _RandomAccessIterator,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
{
return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
}
#endif // _LIBCPP_STD_VER > 11
_LIBCPP_END_NAMESPACE_LFTS
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */

View File

@ -681,7 +681,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>

83
include/float.h Normal file
View File

@ -0,0 +1,83 @@
// -*- C++ -*-
//===--------------------------- float.h ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_FLOAT_H
#define _LIBCPP_FLOAT_H
/*
float.h synopsis
Macros:
FLT_ROUNDS
FLT_EVAL_METHOD // C99
FLT_RADIX
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
DECIMAL_DIG // C99
FLT_DIG
DBL_DIG
LDBL_DIG
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
FLT_MIN_10_EXP
DBL_MIN_10_EXP
LDBL_MIN_10_EXP
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
FLT_MAX_10_EXP
DBL_MAX_10_EXP
LDBL_MAX_10_EXP
FLT_MAX
DBL_MAX
LDBL_MAX
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
FLT_MIN
DBL_MIN
LDBL_MIN
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <float.h>
#ifdef __cplusplus
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif
#endif // __cplusplus
#endif // _LIBCPP_FLOAT_H

View File

@ -537,6 +537,9 @@ public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename allocator_traits<allocator_type>::pointer pointer;

View File

@ -1234,11 +1234,9 @@ const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_03>
#else // _LIBCPP_HAS_NO_VARIADICS
////////////////////////////////////////////////////////////////////////////////
// MEMFUN
//==============================================================================
template <class _Tp>
class __mem_fn
@ -1251,26 +1249,130 @@ private:
type __f_;
public:
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
}
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
}
#else
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const {
return __invoke(__f_, __a0);
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0 const>::type
operator() (_A0 const& __a0) const {
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1>::type
operator() (_A0 const& __a0, _A1& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1 const>::type
operator() (_A0& __a0, _A1 const& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1 const>::type
operator() (_A0 const& __a0, _A1 const& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
#endif
};
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp _Tp::*>
mem_fn(_Rp _Tp::* __pm)
mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
{
return __mem_fn<_Rp _Tp::*>(__pm);
}
////////////////////////////////////////////////////////////////////////////////
// FUNCTION
//==============================================================================
// bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
@ -1283,7 +1385,7 @@ template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
template<class _Rp, class ..._ArgTypes>
template<class _Rp>
struct __maybe_derive_from_unary_function
{
};
@ -1294,7 +1396,7 @@ struct __maybe_derive_from_unary_function<_Rp(_A1)>
{
};
template<class _Rp, class ..._ArgTypes>
template<class _Rp>
struct __maybe_derive_from_binary_function
{
};
@ -1305,6 +1407,28 @@ struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
{
};
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Fp const&) { return true; }
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Fp* __ptr) { return __ptr; }
template <class _Ret, class _Class>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(function<_Fp> const& __f) { return !!__f; }
} // namespace __function
#ifndef _LIBCPP_HAS_NO_VARIADICS
namespace __function {
template<class _Fp> class __base;
template<class _Rp, class ..._ArgTypes>
@ -1440,28 +1564,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)>
typename aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_Ap...)) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...)) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) volatile) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const volatile) {return __p;}
template <class _R2, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_Ap...)>& __p) {return !!__p;}
template <class _Fp, bool = !is_same<_Fp, function>::value &&
__invokable<_Fp&, _ArgTypes...>::value>
struct __callable;
@ -1626,7 +1728,7 @@ function<_Rp(_ArgTypes...)>::function(_Fp __f,
>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
@ -1653,7 +1755,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
@ -1848,6 +1950,16 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
#else // _LIBCPP_HAS_NO_VARIADICS
#include <__functional_03>
#endif
////////////////////////////////////////////////////////////////////////////////
// BIND
//==============================================================================
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
@ -1878,6 +1990,9 @@ template<int _Np>
struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
@ -2402,14 +2517,14 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
size_t __b;
size_t __c;
size_t __d;
};
} __s;
} __u;
__u.__a = 0;
__u.__b = 0;
__u.__c = 0;
__u.__d = 0;
__u.__s.__a = 0;
__u.__s.__b = 0;
__u.__s.__c = 0;
__u.__s.__d = 0;
__u.__t = __v;
return __u.__a ^ __u.__b ^ __u.__c ^ __u.__d;
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
#elif defined(__x86_64__)
// Zero out padding bits
union
@ -2419,12 +2534,12 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
{
size_t __a;
size_t __b;
};
} __s;
} __u;
__u.__a = 0;
__u.__b = 0;
__u.__s.__a = 0;
__u.__s.__b = 0;
__u.__t = __v;
return __u.__a ^ __u.__b;
return __u.__s.__a ^ __u.__s.__b;
#else
return __scalar_hash<long double>::operator()(__v);
#endif

View File

@ -512,6 +512,16 @@ public:
virtual ~future_error() _NOEXCEPT;
};
inline _LIBCPP_ALWAYS_INLINE
void __throw_future_error(future_errc _Ev)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw future_error(make_error_code(_Ev));
#else
assert(!"future_error");
#endif
}
class _LIBCPP_TYPE_VIS __assoc_sub_state
: public __shared_count
{
@ -566,6 +576,7 @@ public:
void wait();
template <class _Rep, class _Period>
future_status
_LIBCPP_INLINE_VISIBILITY
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
template <class _Clock, class _Duration>
future_status
@ -589,7 +600,7 @@ __assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs
}
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
future_status
__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
{
@ -645,10 +656,8 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@ -664,10 +673,8 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@ -725,10 +732,8 @@ void
__assoc_state<_Rp&>::set_value(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@ -739,10 +744,8 @@ void
__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@ -849,6 +852,7 @@ class __deferred_assoc_state
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@ -858,7 +862,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -895,6 +899,7 @@ class __deferred_assoc_state<void, _Fp>
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@ -904,7 +909,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -943,6 +948,7 @@ class __async_assoc_state
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@ -952,7 +958,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -997,6 +1003,7 @@ class __async_assoc_state<void, _Fp>
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@ -1006,7 +1013,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -1108,6 +1115,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<_Rp> share();
// retrieving the value
@ -1138,10 +1146,8 @@ template <class _Rp>
future<_Rp>::future(__assoc_state<_Rp>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
throw future_error(make_error_code(future_errc::future_already_retrieved));
#endif
__throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@ -1212,6 +1218,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<_Rp&> share();
// retrieving the value
@ -1242,10 +1249,8 @@ template <class _Rp>
future<_Rp&>::future(__assoc_state<_Rp&>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
throw future_error(make_error_code(future_errc::future_already_retrieved));
#endif
__throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@ -1311,6 +1316,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<void> share();
// retrieving the value
@ -1445,10 +1451,8 @@ template <class _Rp>
future<_Rp>
promise<_Rp>::get_future()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
return future<_Rp>(__state_);
}
@ -1456,10 +1460,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@ -1469,10 +1471,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(_VSTD::move(__r));
}
@ -1482,10 +1482,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@ -1493,10 +1491,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@ -1506,10 +1502,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(_VSTD::move(__r));
}
@ -1519,10 +1513,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@ -1619,10 +1611,8 @@ template <class _Rp>
future<_Rp&>
promise<_Rp&>::get_future()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
return future<_Rp&>(__state_);
}
@ -1630,10 +1620,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@ -1641,10 +1629,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@ -1652,10 +1638,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@ -1663,10 +1647,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@ -1861,6 +1843,7 @@ public:
void swap(__packaged_task_function&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
_Rp operator()(_ArgTypes...) const;
};
@ -2000,7 +1983,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f)
}
template<class _Rp, class ..._ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Rp
__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
@ -2087,11 +2070,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2109,11 +2092,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2131,10 +2114,8 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::reset()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
throw future_error(make_error_code(future_errc::no_state));
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@ -2218,11 +2199,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2241,11 +2222,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2264,10 +2245,8 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::reset()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
throw future_error(make_error_code(future_errc::no_state));
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@ -2592,7 +2571,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
}
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<_Rp>
future<_Rp>::share()
{
@ -2600,7 +2579,7 @@ future<_Rp>::share()
}
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<_Rp&>
future<_Rp&>::share()
{
@ -2609,7 +2588,7 @@ future<_Rp&>::share()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<void>
future<void>::share()
{

251
include/inttypes.h Normal file
View File

@ -0,0 +1,251 @@
// -*- C++ -*-
//===--------------------------- inttypes.h -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_INTTYPES_H
#define _LIBCPP_INTTYPES_H
/*
inttypes.h synopsis
This entire header is C99 / C++0X
#include <stdint.h> // <cinttypes> includes <cstdint>
Macros:
PRId8
PRId16
PRId32
PRId64
PRIdLEAST8
PRIdLEAST16
PRIdLEAST32
PRIdLEAST64
PRIdFAST8
PRIdFAST16
PRIdFAST32
PRIdFAST64
PRIdMAX
PRIdPTR
PRIi8
PRIi16
PRIi32
PRIi64
PRIiLEAST8
PRIiLEAST16
PRIiLEAST32
PRIiLEAST64
PRIiFAST8
PRIiFAST16
PRIiFAST32
PRIiFAST64
PRIiMAX
PRIiPTR
PRIo8
PRIo16
PRIo32
PRIo64
PRIoLEAST8
PRIoLEAST16
PRIoLEAST32
PRIoLEAST64
PRIoFAST8
PRIoFAST16
PRIoFAST32
PRIoFAST64
PRIoMAX
PRIoPTR
PRIu8
PRIu16
PRIu32
PRIu64
PRIuLEAST8
PRIuLEAST16
PRIuLEAST32
PRIuLEAST64
PRIuFAST8
PRIuFAST16
PRIuFAST32
PRIuFAST64
PRIuMAX
PRIuPTR
PRIx8
PRIx16
PRIx32
PRIx64
PRIxLEAST8
PRIxLEAST16
PRIxLEAST32
PRIxLEAST64
PRIxFAST8
PRIxFAST16
PRIxFAST32
PRIxFAST64
PRIxMAX
PRIxPTR
PRIX8
PRIX16
PRIX32
PRIX64
PRIXLEAST8
PRIXLEAST16
PRIXLEAST32
PRIXLEAST64
PRIXFAST8
PRIXFAST16
PRIXFAST32
PRIXFAST64
PRIXMAX
PRIXPTR
SCNd8
SCNd16
SCNd32
SCNd64
SCNdLEAST8
SCNdLEAST16
SCNdLEAST32
SCNdLEAST64
SCNdFAST8
SCNdFAST16
SCNdFAST32
SCNdFAST64
SCNdMAX
SCNdPTR
SCNi8
SCNi16
SCNi32
SCNi64
SCNiLEAST8
SCNiLEAST16
SCNiLEAST32
SCNiLEAST64
SCNiFAST8
SCNiFAST16
SCNiFAST32
SCNiFAST64
SCNiMAX
SCNiPTR
SCNo8
SCNo16
SCNo32
SCNo64
SCNoLEAST8
SCNoLEAST16
SCNoLEAST32
SCNoLEAST64
SCNoFAST8
SCNoFAST16
SCNoFAST32
SCNoFAST64
SCNoMAX
SCNoPTR
SCNu8
SCNu16
SCNu32
SCNu64
SCNuLEAST8
SCNuLEAST16
SCNuLEAST32
SCNuLEAST64
SCNuFAST8
SCNuFAST16
SCNuFAST32
SCNuFAST64
SCNuMAX
SCNuPTR
SCNx8
SCNx16
SCNx32
SCNx64
SCNxLEAST8
SCNxLEAST16
SCNxLEAST32
SCNxLEAST64
SCNxFAST8
SCNxFAST16
SCNxFAST32
SCNxFAST64
SCNxMAX
SCNxPTR
Types:
imaxdiv_t
intmax_t imaxabs(intmax_t j);
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <inttypes.h>
#ifdef __cplusplus
#include <stdint.h>
#undef imaxabs
#undef imaxdiv
#endif // __cplusplus
#endif // _LIBCPP_INTTYPES_H

View File

@ -114,9 +114,9 @@ class basic_ios
public:
// types:
typedef charT char_type;
typedef typename traits::int_type int_type;
typedef typename traits::pos_type pos_type;
typedef typename traits::off_type off_type;
typedef typename traits::int_type int_type; // removed in C++17
typedef typename traits::pos_type pos_type; // removed in C++17
typedef typename traits::off_type off_type; // removed in C++17
typedef traits traits_type;
operator unspecified-bool-type() const;
@ -216,7 +216,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__locale>
#include <system_error>
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include <atomic> // for __xindex_
#endif
@ -254,14 +254,12 @@ public:
static const fmtflags floatfield = scientific | fixed;
typedef unsigned int iostate;
typedef iostate io_state;
static const iostate badbit = 0x1;
static const iostate eofbit = 0x2;
static const iostate failbit = 0x4;
static const iostate goodbit = 0x0;
typedef unsigned int openmode;
typedef openmode open_mode;
static const openmode app = 0x01;
static const openmode ate = 0x02;
static const openmode binary = 0x04;
@ -270,10 +268,15 @@ public:
static const openmode trunc = 0x20;
enum seekdir {beg, cur, end};
typedef seekdir seek_dir;
#if _LIBCPP_STD_VER <= 14
typedef iostate io_state;
typedef openmode open_mode;
typedef seekdir seek_dir;
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
#endif
class _LIBCPP_TYPE_VIS Init;
@ -367,7 +370,9 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
static atomic<int> __xindex_;
#else
static int __xindex_;

View File

@ -304,7 +304,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_type>* __sb)
: __gc_(0)
{
@ -314,7 +314,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
: __gc_(__rhs.__gc_)
{
@ -323,7 +323,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
{
@ -339,7 +339,7 @@ basic_istream<_CharT, _Traits>::~basic_istream()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
{
@ -725,7 +725,7 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&))
{
@ -733,7 +733,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
(*__pf)(basic_ios<char_type, traits_type>&))
@ -743,7 +743,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
{
@ -800,7 +800,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
}
template<class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
{
@ -808,7 +808,7 @@ operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
}
template<class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
{
@ -843,7 +843,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
template<class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
{
@ -851,7 +851,7 @@ operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
}
template<class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
{
@ -947,7 +947,7 @@ basic_istream<_CharT, _Traits>::get()
}
template<class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(char_type& __c)
{
@ -1006,7 +1006,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
}
template<class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n)
{
@ -1068,7 +1068,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
}
template<class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb)
{
@ -1129,7 +1129,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
}
template<class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n)
{
@ -1407,6 +1407,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@ -1461,7 +1462,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
{
@ -1503,7 +1504,7 @@ public:
};
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
: basic_istream<_CharT, _Traits>(__sb)
{
@ -1512,14 +1513,14 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
{
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_iostream<_CharT, _Traits>&
basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
{
@ -1535,7 +1536,7 @@ basic_iostream<_CharT, _Traits>::~basic_iostream()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_iostream<_CharT, _Traits>::swap(basic_iostream& __rhs)
{
@ -1644,7 +1645,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
}
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
@ -1655,7 +1656,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
@ -1664,7 +1665,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
}
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)

View File

@ -513,12 +513,12 @@ distance(_InputIter __first, _InputIter __last)
return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
}
template <class _ForwardIter>
template <class _InputIter>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIter
next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
_InputIter
next(_InputIter __x,
typename iterator_traits<_InputIter>::difference_type __n = 1,
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0)
{
_VSTD::advance(__x, __n);
return __x;

View File

@ -191,19 +191,10 @@ template <class _Tp, class _VoidPtr> struct __list_node;
template <class _Tp, class _VoidPtr>
struct __list_node_base
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
#endif
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node_base> __base_pointer;
#else
rebind<__list_node_base>::other __base_pointer;
#endif
typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
pointer;
typedef typename __rebind_pointer<_VoidPtr, __list_node_base>::type
__base_pointer;
pointer __prev_;
pointer __next_;
@ -232,12 +223,8 @@ template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_it
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
#endif
typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
__node_pointer;
__node_pointer __ptr_;
@ -262,13 +249,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef value_type& reference;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@ -365,12 +346,8 @@ public:
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
#endif
typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
__node_pointer;
__node_pointer __ptr_;
@ -392,13 +369,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef const value_type& reference;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY

View File

@ -1888,6 +1888,9 @@ protected:
virtual const string_type& __r() const;
virtual const string_type& __x() const;
virtual const string_type& __X() const;
_LIBCPP_ALWAYS_INLINE
~__time_get_c_storage() {}
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
@ -3773,11 +3776,14 @@ private:
wstring_convert(const wstring_convert& __wc);
wstring_convert& operator=(const wstring_convert& __wc);
public:
_LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
_LIBCPP_ALWAYS_INLINE
wstring_convert(_Codecvt* __pcvt, state_type __state);
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
const wide_string& __wide_err = wide_string());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_ALWAYS_INLINE
wstring_convert(wstring_convert&& __wc);
#endif
~wstring_convert();
@ -3811,7 +3817,7 @@ public:
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@ -3819,7 +3825,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@ -3838,7 +3844,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
@ -4313,18 +4319,9 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir
int __width = __cv_->encoding();
if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
// __width > 0 || __off == 0
switch (__way)
{
case ios_base::beg:
break;
case ios_base::cur:
break;
case ios_base::end:
break;
default:
// __width > 0 || __off == 0, now check __way
if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
return pos_type(off_type(-1));
}
pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
__r.state(__st_);
return __r;

View File

@ -840,6 +840,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
@ -1523,7 +1526,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@ -1696,6 +1699,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{

1419
include/math.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -612,7 +612,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <cassert>
#endif
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
@ -932,6 +932,15 @@ public:
{return _VSTD::addressof(__r);}
};
template <class _From, class _To>
struct __rebind_pointer {
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
typedef typename pointer_traits<_From>::template rebind<_To> type;
#else
typedef typename pointer_traits<_From>::template rebind<_To>::other type;
#endif
};
// allocator_traits
namespace __has_pointer_type_imp
@ -1669,7 +1678,7 @@ private:
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
{return numeric_limits<size_type>::max();}
{return numeric_limits<size_type>::max() / sizeof(value_type);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
@ -1900,6 +1909,10 @@ public:
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
{::new(&*__x_) _Tp(__element); return *this;}
#if _LIBCPP_STD_VER >= 14
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
{::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
#endif
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
{raw_storage_iterator __t(*this); ++__x_; return __t;}
@ -2659,10 +2672,17 @@ public:
: __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
template <class _Up, class _Ep>
_LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
_LIBCPP_INLINE_VISIBILITY
typename enable_if<
!is_array<_Up>::value &&
is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
is_assignable<deleter_type&, _Ep&>::value,
unique_ptr&
>::type
operator=(unique_ptr<_Up, _Ep> __u)
{
reset(__u.release());
__ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
__ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
return *this;
}
@ -3420,7 +3440,7 @@ struct __scalar_hash<_Tp, 2>
{
size_t __a;
size_t __b;
};
} __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@ -3442,7 +3462,7 @@ struct __scalar_hash<_Tp, 3>
size_t __a;
size_t __b;
size_t __c;
};
} __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@ -3465,7 +3485,7 @@ struct __scalar_hash<_Tp, 4>
size_t __b;
size_t __c;
size_t __d;
};
} __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@ -3854,7 +3874,9 @@ private:
struct __nat {int __for_bool_;};
public:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp>
explicit shared_ptr(_Yp* __p,
@ -3867,15 +3889,18 @@ public:
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
_LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
shared_ptr(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp> shared_ptr(shared_ptr<_Yp>&& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -3932,6 +3957,7 @@ public:
~shared_ptr();
_LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3939,8 +3965,10 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3948,6 +3976,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr<_Tp>&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp>&& __r);
template<class _Yp>
typename enable_if
@ -3956,6 +3985,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr
>::type&
_LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@ -3965,6 +3995,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp> __r);
#endif
template <class _Yp, class _Dp>
@ -3975,12 +4006,16 @@ public:
shared_ptr&
>::type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp> __r);
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(shared_ptr& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3988,6 +4023,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p);
template<class _Yp, class _Dp>
typename enable_if
@ -3995,6 +4031,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc>
typename enable_if
@ -4002,6 +4039,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
@ -4103,7 +4141,7 @@ private:
};
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
: __ptr_(0),
@ -4112,7 +4150,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
: __ptr_(0),
@ -4235,7 +4273,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
: __ptr_(__p),
__cntrl_(__r.__cntrl_)
@ -4245,7 +4283,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEX
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -4256,7 +4294,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@ -4270,7 +4308,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -4281,7 +4319,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@ -4568,7 +4606,7 @@ shared_ptr<_Tp>::~shared_ptr()
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
{
@ -4578,7 +4616,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4593,7 +4631,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
{
@ -4603,7 +4641,7 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4617,7 +4655,7 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
!is_array<_Yp>::value &&
@ -4632,7 +4670,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
template<class _Tp>
template <class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
!is_array<_Yp>::value &&
@ -4680,7 +4718,7 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
{
@ -4689,7 +4727,7 @@ shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
shared_ptr<_Tp>::reset() _NOEXCEPT
{
@ -4698,7 +4736,7 @@ shared_ptr<_Tp>::reset() _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4711,7 +4749,7 @@ shared_ptr<_Tp>::reset(_Yp* __p)
template<class _Tp>
template<class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4724,7 +4762,7 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5041,23 +5079,27 @@ private:
__shared_weak_count* __cntrl_;
public:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp> weak_ptr(weak_ptr<_Yp>&& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~weak_ptr();
_LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -5065,10 +5107,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -5076,6 +5120,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -5086,9 +5131,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void swap(weak_ptr& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@ -5112,7 +5160,7 @@ public:
};
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
: __ptr_(0),
@ -5121,7 +5169,7 @@ weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -5132,7 +5180,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5145,7 +5193,7 @@ weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5159,7 +5207,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -5170,7 +5218,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5191,7 +5239,7 @@ weak_ptr<_Tp>::~weak_ptr()
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
{
@ -5201,7 +5249,7 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5216,7 +5264,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
{
@ -5226,7 +5274,7 @@ weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5242,7 +5290,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5255,7 +5303,7 @@ weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
{
@ -5272,7 +5320,7 @@ swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
weak_ptr<_Tp>::reset() _NOEXCEPT
{
@ -5305,7 +5353,11 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
return __r;
}
#if _LIBCPP_STD_VER > 14
template <class _Tp = void> struct owner_less;
#else
template <class _Tp> struct owner_less;
#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
@ -5339,6 +5391,30 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
{return __x.owner_before(__y);}
};
#if _LIBCPP_STD_VER > 14
template <>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<void>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
typedef void is_transparent;
};
#endif
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
{
@ -5381,7 +5457,9 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
class _LIBCPP_TYPE_VIS __sp_mut
{
@ -5507,7 +5585,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
return atomic_compare_exchange_weak(__p, __v, __w);
}
#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
//enum class
struct _LIBCPP_TYPE_VIS pointer_safety
@ -5574,6 +5652,15 @@ template <typename _Alloc>
_LIBCPP_INLINE_VISIBILITY
void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
struct __noexcept_move_assign_container : public integral_constant<bool,
_Traits::propagate_on_container_move_assignment::value
#if _LIBCPP_STD_VER > 14
|| _Traits::is_always_equal::value
#else
&& is_nothrow_move_assignable<_Alloc>::value
#endif
> {};
_LIBCPP_END_NAMESPACE_STD

View File

@ -455,9 +455,13 @@ module std [system] {
export *
}
// FIXME: We don't have modules for the <foo.h> headers, because they might
// be included from the C library's headers, and that would create a #include
// cycle. For the same reason, we don't have a module for __config.
//module __config { header "__config" export * }
// FIXME: These should be private.
module __bit_reference { header "__bit_reference" export * }
module __config { header "__config" export * }
module __debug { header "__debug" export * }
module __functional_base { header "__functional_base" export * }
module __hash_table { header "__hash_table" export * }

View File

@ -179,7 +179,9 @@ template<class Callable, class ...Args>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#ifndef _LIBCPP_HAS_NO_THREADS
#include <sched.h>
#endif
#include <__undef_min_max>

View File

@ -275,7 +275,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_type>* __sb)
{
this->init(__sb);
@ -284,14 +284,14 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
{
this->move(__rhs);
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
{
@ -307,7 +307,7 @@ basic_ostream<_CharT, _Traits>::~basic_ostream()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs)
{
@ -315,7 +315,7 @@ basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&))
{
@ -323,7 +323,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>&
(*__pf)(basic_ios<char_type,traits_type>&))
@ -333,7 +333,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>&
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(ios_base& (*__pf)(ios_base&))
{
@ -989,7 +989,7 @@ basic_ostream<_CharT, _Traits>::flush()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_ostream<_CharT, _Traits>::pos_type
basic_ostream<_CharT, _Traits>::tellp()
{
@ -999,7 +999,7 @@ basic_ostream<_CharT, _Traits>::tellp()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
@ -1013,7 +1013,7 @@ basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
@ -1027,7 +1027,7 @@ basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
endl(basic_ostream<_CharT, _Traits>& __os)
{
@ -1037,7 +1037,7 @@ endl(basic_ostream<_CharT, _Traits>& __os)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
ends(basic_ostream<_CharT, _Traits>& __os)
{
@ -1046,7 +1046,7 @@ ends(basic_ostream<_CharT, _Traits>& __os)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
flush(basic_ostream<_CharT, _Traits>& __os)
{
@ -1057,7 +1057,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Stream, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
!is_lvalue_reference<_Stream>::value &&
@ -1081,7 +1081,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
{
@ -1089,7 +1089,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
}
template<class _CharT, class _Traits, class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
{

View File

@ -3119,6 +3119,7 @@ public:
independent_bits_engine<_Eng, _Wp, _UI>& __x);
private:
_LIBCPP_INLINE_VISIBILITY
result_type __eval(false_type);
result_type __eval(true_type);
@ -3144,7 +3145,7 @@ private:
};
template<class _Engine, size_t __w, class _UIntType>
inline _LIBCPP_INLINE_VISIBILITY
inline
_UIntType
independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
{
@ -3735,7 +3736,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -3765,7 +3766,7 @@ public:
template<class _RealType>
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename uniform_real_distribution<_RealType>::result_type
uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@ -3851,7 +3852,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -3878,7 +3879,7 @@ public:
};
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
bernoulli_distribution::result_type
bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
{
@ -5522,7 +5523,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -5552,7 +5553,7 @@ public:
template <class _RealType>
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
_RealType
cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@ -6044,9 +6045,6 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
discrete_distribution<_IT>& __x)
{
typedef discrete_distribution<_IT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@ -6358,7 +6356,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_constant_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@ -6698,7 +6695,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_linear_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;

View File

@ -62,6 +62,19 @@ typedef ratio< 1000000000000000000, 1> exa;
typedef ratio< 1000000000000000000000, 1> zetta; // not supported
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
// 20.11.5, ratio comparison
template <class R1, class R2> constexpr bool ratio_equal_v
= ratio_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_not_equal_v
= ratio_not_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_v
= ratio_less<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_equal_v
= ratio_less_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_v
= ratio_greater<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_equal_v
= ratio_greater_equal<R1, R2>::value; // C++17
}
*/
@ -485,6 +498,26 @@ struct __ratio_gcd
__static_lcm<_R1::den, _R2::den>::value> type;
};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
= ratio_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
= ratio_not_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
= ratio_less<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
= ratio_less_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
= ratio_greater<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
= ratio_greater_equal<_R1, _R2>::value;
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_RATIO

View File

@ -762,6 +762,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <memory>
#include <vector>
#include <deque>
#include <cassert>
#include <__undef_min_max>
@ -955,6 +956,17 @@ public:
regex_constants::error_type code() const {return __code_;}
};
template <regex_constants::error_type _Ev>
_LIBCPP_ALWAYS_INLINE
void __throw_regex_error()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(_Ev);
#else
assert(!"regex_error");
#endif
}
template <class _CharT>
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
{
@ -1036,6 +1048,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(wchar_t __ch, int __radix) const;
};
@ -1258,7 +1271,7 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
{
@ -1721,6 +1734,8 @@ template <class _CharT>
void
__back_ref<_CharT>::__exec(__state& __s) const
{
if (__mexp_ > __s.__sub_matches_.size())
__throw_regex_error<regex_constants::error_backref>();
sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
if (__sm.matched)
{
@ -2256,10 +2271,8 @@ public:
}
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__b.size() != 1 || __e.size() != 1)
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
if (__icase_)
{
__b[0] = __traits_.translate_nocase(__b[0]);
@ -2952,7 +2965,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
: base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
: base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
virtual void __exec(__state&) const;
};
@ -3012,10 +3025,8 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
case egrep:
__first = __parse_egrep(__first, __last);
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::__re_err_grammar);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_grammar>();
}
return __first;
}
@ -3046,10 +3057,8 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
}
}
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first != __last)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
}
return __first;
}
@ -3062,19 +3071,15 @@ basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
{
__owns_one_state<_CharT>* __sa = __end_;
_ForwardIterator __temp = __parse_ERE_branch(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
__first = __temp;
while (__first != __last && *__first == '|')
{
__owns_one_state<_CharT>* __sb = __end_;
__temp = __parse_ERE_branch(++__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
__push_alternation(__sa, __sb);
__first = __temp;
}
@ -3088,10 +3093,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
_ForwardIterator __last)
{
_ForwardIterator __temp = __parse_ERE_expression(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
do
{
__first = __temp;
@ -3126,10 +3129,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__temp = __parse_extended_reg_exp(++__temp, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__temp;
@ -3194,10 +3195,8 @@ basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
__first = __parse_RE_expression(__temp, __last);
__temp = __parse_Back_close_paren(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
__first = __temp;
}
@ -3511,22 +3510,16 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __min = 0;
__first = __temp;
__temp = __parse_DUP_COUNT(__first, __last, __min);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
if (*__first != ',')
{
__temp = __parse_Back_close_brace(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
__push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
true);
__first = __temp;
@ -3537,18 +3530,14 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __max = -1;
__first = __parse_DUP_COUNT(__first, __last, __max);
__temp = __parse_Back_close_brace(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
if (__max == -1)
__push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
true);
}
@ -3608,15 +3597,11 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __min;
_ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
switch (*__first)
{
case '}':
@ -3631,10 +3616,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
break;
case ',':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
if (*__first == '}')
{
++__first;
@ -3650,20 +3633,14 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __max = -1;
__temp = __parse_DUP_COUNT(__first, __last, __max);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != '}')
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
@ -3673,10 +3650,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
}
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
}
}
break;
@ -3694,10 +3669,8 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
if (__first != __last && *__first == '[')
{
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
bool __negate = false;
if (*__first == '^')
{
@ -3706,29 +3679,23 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
}
__bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
// __ml owned by *this
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
{
__ml->__add_char(']');
++__first;
}
__first = __parse_follow_list(__first, __last, __ml);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
if (*__first == '-')
{
__ml->__add_char('-');
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ']')
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
++__first;
}
return __first;
@ -3848,10 +3815,8 @@ basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
basic_string<_CharT>& __str,
__bracket_expression<_CharT, _Traits>* __ml)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case 0:
@ -3892,10 +3857,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
_ForwardIterator __last,
basic_string<_CharT>* __str)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case '\\':
@ -3963,10 +3926,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
else
__push_char(_CharT(__val));
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
return __first;
}
@ -3982,18 +3943,14 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
value_type _Equal_close[2] = {'=', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close,
_Equal_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [= ... =]
typedef typename _Traits::string_type string_type;
string_type __collate_name =
__traits_.lookup_collatename(__first, __temp);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__collate_name.empty())
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
string_type __equiv_name =
__traits_.transform_primary(__collate_name.begin(),
__collate_name.end());
@ -4009,10 +3966,8 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
case 2:
__ml->__add_digraph(__collate_name[0], __collate_name[1]);
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
}
}
__first = _VSTD::next(__temp, 2);
@ -4031,18 +3986,14 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
value_type _Colon_close[2] = {':', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close,
_Colon_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [: ... :]
typedef typename _Traits::char_class_type char_class_type;
char_class_type __class_type =
__traits_.lookup_classname(__first, __temp, __flags_ & icase);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__class_type == 0)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
__ml->__add_class(__class_type);
__first = _VSTD::next(__temp, 2);
return __first;
@ -4060,22 +4011,17 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
value_type _Dot_close[2] = {'.', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close,
_Dot_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [. ... .]
typedef typename _Traits::string_type string_type;
__col_sym = __traits_.lookup_collatename(__first, __temp);
switch (__col_sym.size())
{
case 1:
case 2:
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
}
__first = _VSTD::next(__temp, 2);
return __first;
@ -4219,10 +4165,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
__marked_count_ += __mexp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@ -4234,10 +4178,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
__marked_count_ += __mexp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@ -4274,19 +4216,15 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
case '(':
{
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
_ForwardIterator __temp = _VSTD::next(__first);
if (__temp != __last && *__first == '?' && *__temp == ':')
{
++__open_count_;
__first = __parse_ecma_exp(++__temp, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
--__open_count_;
++__first;
}
@ -4296,16 +4234,20 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__first = __parse_ecma_exp(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__first;
}
}
break;
case '*':
case '+':
case '?':
case '{':
__throw_regex_error<regex_constants::error_badrepeat>();
break;
default:
__first = __parse_pattern_character(__first, __last);
break;
@ -4360,10 +4302,8 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
unsigned __v = *__first - '0';
for (++__first; '0' <= *__first && *__first <= '9'; ++__first)
__v = 10 * __v + *__first - '0';
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__v > mark_count())
throw regex_error(regex_constants::error_backref);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_backref>();
__push_back_ref(__v);
}
}
@ -4479,62 +4419,42 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(_CharT(*__t % 32));
__first = ++__t;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
break;
case 'u':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
// drop through
case 'x':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
if (__str)
*__str = _CharT(__sum);
@ -4558,10 +4478,8 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(*__first);
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
break;
}
}
@ -5422,8 +5340,8 @@ match_results<_BidirectionalIterator, _Allocator>::match_results(
__unmatched_(),
__prefix_(),
__suffix_(),
__position_start_(),
__ready_(false)
__ready_(false),
__position_start_()
{
}
@ -5648,9 +5566,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
@ -5720,9 +5636,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());
@ -5808,9 +5722,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());

View File

@ -58,6 +58,8 @@ public:
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator() noexcept;
@ -457,6 +459,8 @@ public:
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_VSTD::move(__other)) {}
// scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
// scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY

View File

@ -409,6 +409,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
@ -819,6 +822,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;

45
include/setjmp.h Normal file
View File

@ -0,0 +1,45 @@
// -*- C++ -*-
//===--------------------------- setjmp.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SETJMP_H
#define _LIBCPP_SETJMP_H
/*
setjmp.h synopsis
Macros:
setjmp
Types:
jmp_buf
void longjmp(jmp_buf env, int val);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <setjmp.h>
#ifdef __cplusplus
#ifndef setjmp
#define setjmp(env) setjmp(env)
#endif
#endif // __cplusplus
#endif // _LIBCPP_SETJMP_H

View File

@ -236,7 +236,7 @@ protected:
};
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch)
: __hm_(0),
__mode_(__wch)
@ -245,7 +245,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
ios_base::openmode __wch)
: __hm_(0),
@ -425,7 +425,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
@ -607,7 +607,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
ios_base::openmode __wch)
@ -654,7 +654,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch)
: basic_istream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::in)
@ -662,7 +662,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_istream<_CharT, _Traits>(&__sb_),
@ -673,7 +673,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@ -693,7 +693,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs)
{
@ -702,7 +702,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rh
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
basic_istringstream<_CharT, _Traits, _Allocator>& __y)
@ -711,7 +711,7 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@ -719,7 +719,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, _Traits, _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>::str() const
{
@ -727,7 +727,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
@ -773,7 +773,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch)
: basic_ostream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::out)
@ -781,7 +781,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_ostream<_CharT, _Traits>(&__sb_),
@ -792,7 +792,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@ -812,7 +812,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs)
{
@ -821,7 +821,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rh
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
@ -830,7 +830,7 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@ -838,7 +838,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, _Traits, _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
{
@ -846,7 +846,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
@ -892,7 +892,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch)
: basic_iostream<_CharT, _Traits>(&__sb_),
__sb_(__wch)
@ -900,7 +900,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::op
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_iostream<_CharT, _Traits>(&__sb_),
@ -911,7 +911,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@ -931,7 +931,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
{
@ -940,7 +940,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
basic_stringstream<_CharT, _Traits, _Allocator>& __y)
@ -949,7 +949,7 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@ -957,7 +957,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, _Traits, _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>::str() const
{
@ -965,7 +965,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{

62
include/stddef.h Normal file
View File

@ -0,0 +1,62 @@
// -*- C++ -*-
//===--------------------------- stddef.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_ptrdiff_t) || defined(__need_size_t) || \
defined(__need_wchar_t) || defined(__need_NULL) || defined(__need_wint_t)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stddef.h>
#elif !defined(_LIBCPP_STDDEF_H)
#define _LIBCPP_STDDEF_H
/*
stddef.h synopsis
Macros:
offsetof(type,member-designator)
NULL
Types:
ptrdiff_t
size_t
max_align_t
nullptr_t
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stddef.h>
#ifdef __cplusplus
extern "C++" {
#include <__nullptr>
using std::nullptr_t;
}
// Re-use the compiler's <stddef.h> max_align_t where possible.
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
typedef long double max_align_t;
#endif
#endif
#endif // _LIBCPP_STDDEF_H

127
include/stdio.h Normal file
View File

@ -0,0 +1,127 @@
// -*- C++ -*-
//===---------------------------- stdio.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_FILE) || defined(__need___FILE)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdio.h>
#elif !defined(_LIBCPP_STDIO_H)
#define _LIBCPP_STDIO_H
/*
stdio.h synopsis
Macros:
BUFSIZ
EOF
FILENAME_MAX
FOPEN_MAX
L_tmpnam
NULL
SEEK_CUR
SEEK_END
SEEK_SET
TMP_MAX
_IOFBF
_IOLBF
_IONBF
stderr
stdin
stdout
Types:
FILE
fpos_t
size_t
int remove(const char* filename);
int rename(const char* old, const char* new);
FILE* tmpfile(void);
char* tmpnam(char* s);
int fclose(FILE* stream);
int fflush(FILE* stream);
FILE* fopen(const char* restrict filename, const char* restrict mode);
FILE* freopen(const char* restrict filename, const char * restrict mode,
FILE * restrict stream);
void setbuf(FILE* restrict stream, char* restrict buf);
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
int fprintf(FILE* restrict stream, const char* restrict format, ...);
int fscanf(FILE* restrict stream, const char * restrict format, ...);
int printf(const char* restrict format, ...);
int scanf(const char* restrict format, ...);
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
int sprintf(char* restrict s, const char* restrict format, ...);
int sscanf(const char* restrict s, const char* restrict format, ...);
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
int vprintf(const char* restrict format, va_list arg);
int vscanf(const char* restrict format, va_list arg); // C99
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
va_list arg);
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
int fgetc(FILE* stream);
char* fgets(char* restrict s, int n, FILE* restrict stream);
int fputc(int c, FILE* stream);
int fputs(const char* restrict s, FILE* restrict stream);
int getc(FILE* stream);
int getchar(void);
char* gets(char* s); // removed in C++14
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
int ungetc(int c, FILE* stream);
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
int fseek(FILE* stream, long offset, int whence);
int fsetpos(FILE*stream, const fpos_t* pos);
long ftell(FILE* stream);
void rewind(FILE* stream);
void clearerr(FILE* stream);
int feof(FILE* stream);
int ferror(FILE* stream);
void perror(const char* s);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdio.h>
#ifdef __cplusplus
// snprintf
#if defined(_LIBCPP_MSVCRT)
extern "C++" {
#include "support/win32/support.h"
}
#endif
#undef getc
#undef putc
#undef clearerr
#undef feof
#undef ferror
#endif
#endif // _LIBCPP_STDIO_H

130
include/stdlib.h Normal file
View File

@ -0,0 +1,130 @@
// -*- C++ -*-
//===--------------------------- stdlib.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_malloc_and_calloc)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdlib.h>
#elif !defined(_LIBCPP_STDLIB_H)
#define _LIBCPP_STDLIB_H
/*
stdlib.h synopsis
Macros:
EXIT_FAILURE
EXIT_SUCCESS
MB_CUR_MAX
NULL
RAND_MAX
Types:
size_t
div_t
ldiv_t
lldiv_t // C99
double atof (const char* nptr);
int atoi (const char* nptr);
long atol (const char* nptr);
long long atoll(const char* nptr); // C99
double strtod (const char* restrict nptr, char** restrict endptr);
float strtof (const char* restrict nptr, char** restrict endptr); // C99
long double strtold (const char* restrict nptr, char** restrict endptr); // C99
long strtol (const char* restrict nptr, char** restrict endptr, int base);
long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
int rand(void);
void srand(unsigned int seed);
void* calloc(size_t nmemb, size_t size);
void free(void* ptr);
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);
void abort(void);
int atexit(void (*func)(void));
void exit(int status);
void _Exit(int status);
char* getenv(const char* name);
int system(const char* string);
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
void qsort(void* base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
int abs( int j);
long abs( long j);
long long abs(long long j); // C++0X
long labs( long j);
long long llabs(long long j); // C99
div_t div( int numer, int denom);
ldiv_t div( long numer, long denom);
lldiv_t div(long long numer, long long denom); // C++0X
ldiv_t ldiv( long numer, long denom);
lldiv_t lldiv(long long numer, long long denom); // C99
int mblen(const char* s, size_t n);
int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
int at_quick_exit(void (*func)(void)) // C++11
void quick_exit(int status); // C++11
void *aligned_alloc(size_t alignment, size_t size); // C11
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdlib.h>
#ifdef __cplusplus
extern "C++" {
#ifdef _LIBCPP_MSVCRT
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#undef abs
#undef div
#undef labs
#undef ldiv
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef llabs
#undef lldiv
#endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
} // extern "C++"
#endif // __cplusplus
#endif // _LIBCPP_STDLIB_H

View File

@ -220,7 +220,7 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
locale
basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
{
@ -231,7 +231,7 @@ basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
locale
basic_streambuf<_CharT, _Traits>::getloc() const
{
@ -239,7 +239,7 @@ basic_streambuf<_CharT, _Traits>::getloc() const
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_streambuf<_CharT, _Traits>*
basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
{
@ -247,7 +247,7 @@ basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
ios_base::seekdir __way,
@ -257,7 +257,7 @@ basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
ios_base::openmode __which)
@ -266,7 +266,7 @@ basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
basic_streambuf<_CharT, _Traits>::pubsync()
{
@ -274,7 +274,7 @@ basic_streambuf<_CharT, _Traits>::pubsync()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
streamsize
basic_streambuf<_CharT, _Traits>::in_avail()
{
@ -284,7 +284,7 @@ basic_streambuf<_CharT, _Traits>::in_avail()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::snextc()
{
@ -294,7 +294,7 @@ basic_streambuf<_CharT, _Traits>::snextc()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sbumpc()
{
@ -304,7 +304,7 @@ basic_streambuf<_CharT, _Traits>::sbumpc()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sgetc()
{
@ -314,7 +314,7 @@ basic_streambuf<_CharT, _Traits>::sgetc()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
streamsize
basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
{
@ -322,7 +322,7 @@ basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
{
@ -332,7 +332,7 @@ basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sungetc()
{
@ -342,7 +342,7 @@ basic_streambuf<_CharT, _Traits>::sungetc()
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
{
@ -353,7 +353,7 @@ basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
streamsize
basic_streambuf<_CharT, _Traits>::sputn(const char_type* __s, streamsize __n)
{
@ -411,7 +411,7 @@ basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_streambuf<_CharT, _Traits>::gbump(int __n)
{
@ -419,7 +419,7 @@ basic_streambuf<_CharT, _Traits>::gbump(int __n)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
char_type* __gend)
@ -430,7 +430,7 @@ basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_streambuf<_CharT, _Traits>::pbump(int __n)
{
@ -438,7 +438,7 @@ basic_streambuf<_CharT, _Traits>::pbump(int __n)
}
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
basic_streambuf<_CharT, _Traits>::setp(char_type* __pbeg, char_type* __pend)
{

View File

@ -115,8 +115,8 @@ public:
basic_string& operator=(const basic_string& str);
basic_string& operator=(basic_string&& str)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value ); // C++17
basic_string& operator=(const value_type* s);
basic_string& operator=(value_type c);
basic_string& operator=(initializer_list<value_type>);
@ -517,10 +517,14 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -550,7 +554,7 @@ char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<_CharT>::length(const char_type* __s)
{
@ -561,7 +565,7 @@ char_traits<_CharT>::length(const char_type* __s)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
const _CharT*
char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -595,7 +599,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
_CharT*
char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -607,7 +611,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
_CharT*
char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -726,11 +730,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
_LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -742,10 +752,10 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xDFFF);}
{return int_type(0xFFFF);}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
int
char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@ -759,7 +769,7 @@ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<char16_t>::length(const char_type* __s)
{
@ -769,7 +779,7 @@ char_traits<char16_t>::length(const char_type* __s)
return __len;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
const char16_t*
char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -782,7 +792,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -802,7 +812,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -813,7 +823,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -839,11 +849,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
_LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -858,7 +874,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
{return int_type(0xFFFFFFFF);}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
int
char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@ -872,7 +888,7 @@ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<char32_t>::length(const char_type* __s)
{
@ -882,7 +898,7 @@ char_traits<char32_t>::length(const char_type* __s)
return __len;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
const char32_t*
char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -895,7 +911,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -915,7 +931,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -926,7 +942,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -1185,7 +1201,7 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __basic_string_common<true>)
#pragma warning( pop )
#endif // _LIBCPP_MSVC
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template <class _CharT, size_t = sizeof(_CharT)>
struct __padding
@ -1198,7 +1214,7 @@ struct __padding<_CharT, 1>
{
};
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template<class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_string
@ -1234,7 +1250,7 @@ public:
private:
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
struct __long
{
@ -1294,7 +1310,7 @@ private:
value_type __data_[__min_cap];
};
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
union __ulx{__long __lx; __short __lxx;};
@ -1377,8 +1393,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
basic_string& operator=(value_type __c);
@ -1445,7 +1460,8 @@ public:
_LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
{return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
{return (__is_long() ? __get_long_cap()
: static_cast<size_type>(__min_cap)) - 1;}
void resize(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
@ -1509,6 +1525,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(basic_string&& str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{*this = _VSTD::move(str); return *this;}
#endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
@ -1697,7 +1714,7 @@ private:
const allocator_type& __alloc() const _NOEXCEPT
{return __r_.second();}
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@ -1715,7 +1732,7 @@ private:
{return __r_.first().__s.__size_;}
# endif
#else // _LIBCPP_ALTERNATE_STRING_LAYOUT
#else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@ -1733,7 +1750,7 @@ private:
{return __r_.first().__s.__size_ >> 1;}
# endif
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_long_size(size_type __s) _NOEXCEPT
@ -1785,11 +1802,11 @@ private:
template <size_type __a> static
_LIBCPP_INLINE_VISIBILITY
size_type __align_it(size_type __s) _NOEXCEPT
{return __s + (__a-1) & ~(__a-1);}
{return (__s + (__a-1)) & ~(__a-1);}
enum {__alignment = 16};
static _LIBCPP_INLINE_VISIBILITY
size_type __recommend(size_type __s) _NOEXCEPT
{return (__s < __min_cap ? __min_cap :
{return (__s < __min_cap ? static_cast<size_type>(__min_cap) :
__align_it<sizeof(value_type) < __alignment ?
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
@ -1845,10 +1862,15 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type);
void __move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
_NOEXCEPT;
#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
#endif
#endif
_LIBCPP_INLINE_VISIBILITY
@ -1936,7 +1958,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string()
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
: __r_(__a)
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
#else
_NOEXCEPT
#endif
: __r_(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@ -2425,6 +2452,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__alloc() != __str.__alloc())
assign(__str);
@ -2436,7 +2464,11 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
_NOEXCEPT
#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
#endif
{
clear();
shrink_to_fit();
@ -2449,8 +2481,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@ -3782,7 +3813,11 @@ bool
operator==(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
return __rhs.compare(__lhs) == 0;
typedef basic_string<_CharT, _Traits, _Allocator> _String;
_LIBCPP_ASSERT(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
size_t __lhs_len = _Traits::length(__lhs);
if (__lhs_len != __rhs.size()) return false;
return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
}
template<class _CharT, class _Traits, class _Allocator>
@ -3791,7 +3826,11 @@ bool
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) == 0;
typedef basic_string<_CharT, _Traits, _Allocator> _String;
_LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
size_t __rhs_len = _Traits::length(__rhs);
if (__rhs_len != __lhs.size()) return false;
return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
}
// operator!=

View File

@ -0,0 +1,58 @@
// -*- C++ -*-
//===------------------- support/musl/xlocale.h ------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This adds support for the extended locale functions that are currently
// missing from the Musl C library.
//
// This only works when the specified locale is "C" or "POSIX", but that's
// about as good as we can do without implementing full xlocale support
// in Musl.
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
#define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
#include <cstdlib>
#include <cwchar>
#ifdef __cplusplus
extern "C" {
#endif
static inline long long strtoll_l(const char *nptr, char **endptr, int base,
locale_t) {
return strtoll(nptr, endptr, base);
}
static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
int base, locale_t) {
return strtoull(nptr, endptr, base);
}
static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
int base, locale_t) {
return wcstoll(nptr, endptr, base);
}
static inline unsigned long long wcstoull_l(const wchar_t *nptr,
wchar_t **endptr, int base,
locale_t) {
return wcstoull(nptr, endptr, base);
}
static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
locale_t) {
return wcstold(nptr, endptr);
}
#ifdef __cplusplus
}
#endif
#endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H

View File

@ -371,7 +371,7 @@ public:
error_category() _NOEXCEPT;
#else
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT;
_LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT
#endif
private:
error_category(const error_category&);// = delete;

View File

@ -113,11 +113,38 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class __thread_specific_ptr;
class _LIBCPP_TYPE_VIS __thread_struct;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __assoc_sub_state;
_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
class _LIBCPP_TYPE_VIS __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
template <class _Tp>
class __thread_specific_ptr
{
pthread_key_t __key_;
// Only __thread_local_data() may construct a __thread_specific_ptr
// and only with _Tp == __thread_struct.
static_assert((is_same<_Tp, __thread_struct>::value), "");
__thread_specific_ptr();
friend _LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
@ -125,7 +152,6 @@ class __thread_specific_ptr
public:
typedef _Tp* pointer;
__thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
@ -159,7 +185,10 @@ __thread_specific_ptr<_Tp>::__thread_specific_ptr()
template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{
pthread_key_delete(__key_);
// __thread_specific_ptr is only created with a static storage duration
// so this destructor is only invoked during program termination. Invoking
// pthread_key_delete(__key_) may prevent other threads from deleting their
// thread local data. For this reason we leak the key.
}
template <class _Tp>
@ -289,6 +318,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
_LIBCPP_INLINE_VISIBILITY
thread& operator=(thread&& __t) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -307,26 +337,6 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class _LIBCPP_TYPE_VIS __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args, size_t ..._Indices>
@ -390,7 +400,7 @@ thread::thread(_Fp __f)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
inline
thread&
thread::operator=(thread&& __t) _NOEXCEPT
{

View File

@ -80,28 +80,33 @@ template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // cons
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
template <intsize_t I, class T> class tuple_element; // undefined
template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t _Ip, class ..._Tp>
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14
template <size_t I, class T> class tuple_element; // undefined
template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t I, class T>
using tuple_element_t = typename tuple_element <I, T>::type; // C++14
// 20.4.1.5, element access:
template <intsize_t I, class... T>
template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
typename const tuple_element<I, tuple<T...>>::type &
template <size_t I, class... T>
const typename tuple_element<I, tuple<T...>>::type&
get(const tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
get(tuple<T...>&&) noexcept; // constexpr in C++14
template <size_t I, class... T>
const typename tuple_element<I, tuple<T...>>::type&&
get(const tuple<T...>&&) noexcept; // constexpr in C++14
template <class T1, class... T>
constexpr T1& get(tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14
constexpr const T1& get(const tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
template <class T1, class... T>
constexpr const T1&& get(const tuple<T...>&&) noexcept; // C++14
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
@ -507,6 +512,8 @@ class _LIBCPP_TYPE_VIS_ONLY tuple
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
public:
template <bool _Dummy = true, class = typename enable_if<
@ -766,6 +773,16 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const type&&>(
static_cast<const __tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
#if _LIBCPP_STD_VER > 11
// get by type
template <typename _T1, size_t _Idx, typename... _Args>
@ -822,6 +839,13 @@ constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
template <class _T1, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept
{
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
#endif
// tie

File diff suppressed because it is too large Load Diff

View File

@ -1511,7 +1511,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>

View File

@ -52,6 +52,9 @@ template <class T>
>::type
move_if_noexcept(T& x) noexcept; // constexpr in C++14
template <class T> constexpr add_const<T>_t& as_const(T& t) noexcept; // C++17
template <class T> void as_const(const T&&) = delete; // C++17
template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
template <class T1, class T2>
@ -110,22 +113,41 @@ template<size_t I, class T1, class T2>
get(pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
const typename const tuple_element<I, pair<T1, T2> >::type&
const typename tuple_element<I, pair<T1, T2> >::type&
get(const pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
typename tuple_element<I, pair<T1, T2> >::type&&
get(pair<T1, T2>&&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
const typename tuple_element<I, pair<T1, T2> >::type&&
get(const pair<T1, T2>&&) noexcept; // constexpr in C++14
template<class T1, class T2>
constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1 const& get(pair<T1, T2> const &) noexcept; // C++14
template<class T1, class T2>
constexpr const T1& get(const pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
template<class T1, class T2>
constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1&& get(const pair<T1, T2>&&) noexcept; // C++14
template<class T1, class T2>
constexpr T1& get(pair<T2, T1>&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1& get(const pair<T2, T1>&) noexcept; // C++14
template<class T1, class T2>
constexpr T1&& get(pair<T2, T1>&&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14
// C++14
template<class T, T... I>
@ -242,6 +264,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
return _VSTD::move(__x);
}
#if _LIBCPP_STD_VER > 14
template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
template <class _Tp> void as_const(const _Tp&&) = delete;
#endif
struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
@ -261,6 +288,12 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
// pair(const pair&) = default;
// pair(pair&&) = default;
#ifndef _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
template <bool _Dummy = true, class = typename enable_if<
__dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
__dependent_type<is_default_constructible<_T2>, _Dummy>::value
>::type>
#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@ -388,8 +421,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
__is_nothrow_swappable<second_type>::value)
{
_VSTD::iter_swap(&first, &__p.first);
_VSTD::iter_swap(&second, &__p.second);
using _VSTD::swap;
swap(first, __p.first);
swap(second, __p.second);
}
private:
@ -551,6 +585,12 @@ struct __get_pair<0>
_T1&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T1&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@ -577,6 +617,12 @@ struct __get_pair<1>
_T2&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T2&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@ -606,6 +652,14 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
{
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
@ -630,6 +684,13 @@ constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
return __get_pair<0>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT
{
return __get_pair<0>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
@ -651,6 +712,13 @@ constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
return __get_pair<1>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT
{
return __get_pair<1>::get(_VSTD::move(__p));
}
#endif
#if _LIBCPP_STD_VER > 11
@ -671,6 +739,16 @@ struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
template<size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
struct __make_integer_sequence
{
typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
};
#else
namespace __detail {
template<typename _Tp, size_t ..._Extra> struct __repeat;
@ -724,10 +802,14 @@ struct __make_integer_sequence
{
static_assert(is_integral<_Tp>::value,
"std::make_integer_sequence can only be instantiated with an integral type" );
static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
// Workaround GCC bug by preventing bad installations when 0 <= _Ep
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
#endif
template<class _Tp, _Tp _Np>
using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;

File diff suppressed because it is too large Load Diff

View File

@ -51,8 +51,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@ -175,8 +175,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@ -562,9 +562,7 @@ public:
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@ -687,9 +685,11 @@ public:
_LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace_back(_Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop_back();
iterator insert(const_iterator __position, const_reference __x);
@ -768,6 +768,7 @@ private:
void deallocate() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n);
_LIBCPP_INLINE_VISIBILITY
void __construct_at_end(size_type __n, const_reference __x);
template <class _ForwardIterator>
typename enable_if
@ -787,7 +788,8 @@ private:
void __move_range(pointer __from_s, pointer __from_e, pointer __to);
void __move_assign(vector& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(vector& __c, false_type);
void __move_assign(vector& __c, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{
@ -991,7 +993,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
@ -1303,9 +1305,7 @@ template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__x, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@ -1315,6 +1315,7 @@ vector<_Tp, _Allocator>::operator=(vector&& __x)
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__base::__alloc() != __c.__alloc())
{
@ -1629,7 +1630,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
template <class _Tp, class _Allocator>
template <class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
@ -1650,7 +1651,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::pop_back()
{
@ -1897,9 +1898,11 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
pointer __old_last = this->__end_;
for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
{
__RAII_IncreaseAnnotator __annotator(*this);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
*__first);
++this->__end_;
__annotator.__done();
}
__split_buffer<value_type, allocator_type&> __v(__a);
if (__first != __last)
@ -2211,9 +2214,7 @@ public:
vector(vector&& __v, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __v)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@ -2836,9 +2837,7 @@ template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__v, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());

136
include/wchar.h Normal file
View File

@ -0,0 +1,136 @@
// -*- C++ -*-
//===--------------------------- wchar.h ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_wint_t) || defined(__need_mbstate_t)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <wchar.h>
#elif !defined(_LIBCPP_WCHAR_H)
#define _LIBCPP_WCHAR_H
/*
wchar.h synopsis
Macros:
NULL
WCHAR_MAX
WCHAR_MIN
WEOF
Types:
mbstate_t
size_t
tm
wint_t
int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
int vwprintf(const wchar_t* restrict format, va_list arg);
int vwscanf(const wchar_t* restrict format, va_list arg); // C99
int wprintf(const wchar_t* restrict format, ...);
int wscanf(const wchar_t* restrict format, ...);
wint_t fgetwc(FILE* stream);
wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
wint_t fputwc(wchar_t c, FILE* stream);
int fputws(const wchar_t* restrict s, FILE* restrict stream);
int fwide(FILE* stream, int mode);
wint_t getwc(FILE* stream);
wint_t getwchar();
wint_t putwc(wchar_t c, FILE* stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE* stream);
double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
int wcscmp(const wchar_t* s1, const wchar_t* s2);
int wcscoll(const wchar_t* s1, const wchar_t* s2);
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
const wchar_t* wcschr(const wchar_t* s, wchar_t c);
wchar_t* wcschr( wchar_t* s, wchar_t c);
size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
size_t wcslen(const wchar_t* s);
const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
wchar_t* wcsrchr( wchar_t* s, wchar_t c);
size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
const tm* restrict timeptr);
wint_t btowc(int c);
int wctob(wint_t c);
int mbsinit(const mbstate_t* ps);
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
mbstate_t* restrict ps);
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
mbstate_t* restrict ps);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef __cplusplus
#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
#endif
#include_next <wchar.h>
// Let <cwchar> know if we have const-correct overloads for wcschr and friends.
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
#elif defined(__GLIBC_PREREQ)
# if __GLIBC_PREREQ(2, 10)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# endif
#endif
#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
extern "C++" {
#include <support/win32/support.h> // pull in *swprintf defines
} // extern "C++"
#endif // __cplusplus && _LIBCPP_MSVCRT
#endif // _LIBCPP_WCHAR_H

79
include/wctype.h Normal file
View File

@ -0,0 +1,79 @@
// -*- C++ -*-
//===--------------------------- wctype.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_WCTYPE_H
#define _LIBCPP_WCTYPE_H
/*
wctype.h synopsis
Macros:
WEOF
Types:
wint_t
wctrans_t
wctype_t
int iswalnum(wint_t wc);
int iswalpha(wint_t wc);
int iswblank(wint_t wc); // C99
int iswcntrl(wint_t wc);
int iswdigit(wint_t wc);
int iswgraph(wint_t wc);
int iswlower(wint_t wc);
int iswprint(wint_t wc);
int iswpunct(wint_t wc);
int iswspace(wint_t wc);
int iswupper(wint_t wc);
int iswxdigit(wint_t wc);
int iswctype(wint_t wc, wctype_t desc);
wctype_t wctype(const char* property);
wint_t towlower(wint_t wc);
wint_t towupper(wint_t wc);
wint_t towctrans(wint_t wc, wctrans_t desc);
wctrans_t wctrans(const char* property);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <wctype.h>
#ifdef __cplusplus
#undef iswalnum
#undef iswalpha
#undef iswblank
#undef iswcntrl
#undef iswdigit
#undef iswgraph
#undef iswlower
#undef iswprint
#undef iswpunct
#undef iswspace
#undef iswupper
#undef iswxdigit
#undef iswctype
#undef wctype
#undef towlower
#undef towupper
#undef towctrans
#undef wctrans
#endif // __cplusplus
#endif // _LIBCPP_WCTYPE_H

View File

@ -11,7 +11,7 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
endif()
# Add all the headers to the project for IDEs.
if (MSVC_IDE OR XCODE)
if (LIBCXX_CONFIGURE_IDE)
file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
if(WIN32)
file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h)
@ -24,54 +24,65 @@ if (MSVC_IDE OR XCODE)
endif()
endif()
if (LIBCXX_ENABLE_SHARED)
add_library(cxx SHARED
${LIBCXX_SOURCES}
${LIBCXX_HEADERS}
)
else()
add_library(cxx STATIC
${LIBCXX_SOURCES}
${LIBCXX_HEADERS}
)
if(NOT LIBCXX_INSTALL_LIBRARY)
set(exclude_from_all EXCLUDE_FROM_ALL)
endif()
#if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path.
if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH)
target_link_libraries(cxx "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
if (LIBCXX_ENABLE_SHARED)
add_library(cxx SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
else()
add_library(cxx STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
endif()
if (DEFINED LIBCXX_CXX_ABI_DEPS)
add_dependencies(cxx LIBCXX_CXX_ABI_DEPS)
endif()
set(libraries "")
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
# TODO(ericwf): Remove these GNU specific linker flags and let CMake do the
# configuration. This will be more portable.
list(APPEND libraries "-Wl,--whole-archive" "-Wl,-Bstatic")
list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}")
list(APPEND libraries "-Wl,-Bdynamic" "-Wl,--no-whole-archive")
else()
list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}")
#if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path.
add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,--whole-archive" "-Wl,-Bstatic")
add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" "-Wl,--no-whole-archive")
if (APPLE AND LLVM_USE_SANITIZER)
if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib")
elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined")
set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib")
else()
message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
endif()
if (LIBFILE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=lib OUTPUT_VARIABLE LIBDIR RESULT_VARIABLE Result)
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}")
message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
endif()
set(LIBCXX_SANITIZER_LIBRARY "${LIBDIR}/${LIBFILE}")
set(LIBCXX_SANITIZER_LIBRARY "${LIBCXX_SANITIZER_LIBRARY}" PARENT_SCOPE)
message(STATUS "Manually linking compiler-rt library: ${LIBCXX_SANITIZER_LIBRARY}")
add_library_flags("${LIBCXX_SANITIZER_LIBRARY}")
add_link_flags("-Wl,-rpath,${LIBDIR}")
endif()
endif()
# Generate library list.
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
append_if(libraries LIBCXX_HAS_C_LIB c)
append_if(libraries LIBCXX_HAS_M_LIB m)
append_if(libraries LIBCXX_HAS_RT_LIB rt)
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
if (LIBCXX_COVERAGE_LIBRARY)
target_link_libraries(cxx ${LIBCXX_COVERAGE_LIBRARY})
endif()
target_link_libraries(cxx ${libraries})
add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread)
add_library_flags_if(LIBCXX_HAS_C_LIB c)
add_library_flags_if(LIBCXX_HAS_M_LIB m)
add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
# Setup flags.
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(LIBCXX_LINK_FLAGS LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
add_flags_if_supported(-fPIC)
add_link_flags_if_supported(-nodefaultlibs)
if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"))
@ -80,8 +91,8 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
endif()
if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
list(APPEND LIBCXX_COMPILE_FLAGS "-U__STRICT_ANSI__")
list(APPEND LIBCXX_LINK_FLAGS
add_definitions(-D__STRICT_ANSI__)
add_link_flags(
"-compatibility_version 1"
"-current_version 1"
"-install_name /usr/lib/libc++.1.dylib"
@ -100,10 +111,10 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
"-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
endif()
else()
set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
endif()
list(APPEND LIBCXX_LINK_FLAGS
add_link_flags(
"-compatibility_version 1"
"-install_name /usr/lib/libc++.1.dylib"
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
@ -113,19 +124,64 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
endif()
endif()
string(REPLACE ";" " " LIBCXX_COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}")
string(REPLACE ";" " " LIBCXX_LINK_FLAGS "${LIBCXX_LINK_FLAGS}")
target_link_libraries(cxx ${LIBCXX_LIBRARIES})
split_list(LIBCXX_COMPILE_FLAGS)
split_list(LIBCXX_LINK_FLAGS)
set_target_properties(cxx
PROPERTIES
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
OUTPUT_NAME "c++"
VERSION "1.0"
SOVERSION "1"
VERSION "${LIBCXX_ABI_VERSION}.0"
SOVERSION "${LIBCXX_ABI_VERSION}"
)
install(TARGETS cxx
LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
# Generate a linker script inplace of a libc++.so symlink. Rerun this command
# after cxx builds.
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
# Get the name of the ABI library and handle the case where CXXABI_LIBNAME
# is a target name and not a library. Ex cxxabi_shared.
set(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}")
if (SCRIPT_ABI_LIBNAME STREQUAL "cxxabi_shared")
set(SCRIPT_ABI_LIBNAME "c++abi")
endif()
# Generate a linker script inplace of a libc++.so symlink. Rerun this command
# after cxx builds.
add_custom_command(TARGET cxx POST_BUILD
COMMAND
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py
ARGS
"$<TARGET_LINKER_FILE:cxx>"
"${SCRIPT_ABI_LIBNAME}"
WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
)
endif()
if (LIBCXX_INSTALL_LIBRARY)
install(TARGETS cxx
LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
)
# NOTE: This install command must go after the cxx install command otherwise
# it will not be executed after the library symlinks are installed.
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
# Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
# after we required CMake 3.0.
install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
COMPONENT libcxx)
endif()
endif()
if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR
LIBCXX_INSTALL_HEADERS))
if(LIBCXX_INSTALL_LIBRARY)
set(deps DEPENDS cxx)
endif()
add_custom_target(install-libcxx
${deps}
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=libcxx
-P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
endif()

View File

@ -290,6 +290,16 @@ __ZTISt16invalid_argument
__ZTSSt16invalid_argument
__ZTVSt16invalid_argument
__ZNKSt16bad_array_length4whatEv
__ZNSt16bad_array_lengthC1Ev
__ZNSt16bad_array_lengthC2Ev
__ZNSt16bad_array_lengthD0Ev
__ZNSt16bad_array_lengthD1Ev
__ZNSt16bad_array_lengthD2Ev
__ZTISt16bad_array_length
__ZTSSt16bad_array_length
__ZTVSt16bad_array_length
__ZTSDi
__ZTSDn
__ZTSDs

18
src/any.cpp Normal file
View File

@ -0,0 +1,18 @@
//===---------------------------- any.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/any"
_LIBCPP_BEGIN_NAMESPACE_LFTS
const char* bad_any_cast::what() const _NOEXCEPT {
return "bad any cast";
}
_LIBCPP_END_NAMESPACE_LFTS

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