1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00

Vendor import of libc++ release_70 branch r339999:

https://llvm.org/svn/llvm-project/libcxx/branches/release_70@339999
This commit is contained in:
Dimitry Andric 2018-08-18 08:27:12 +00:00
parent 4504f4f22a
commit 8ad8b454b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/libc++/dist-release_70/; revision=338005
svn path=/vendor/libc++/libc++-release_70-r339999/; revision=338006; tag=vendor/libc++/libc++-release_70-r339999
35 changed files with 336 additions and 142 deletions

View File

@ -120,6 +120,7 @@ set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc+
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
option(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT "Enable per TU ABI insulation by default. To be used by vendors." OFF)
set(LIBCXX_ABI_DEFINES "" CACHE STRING "A semicolon separated list of ABI macros to define in the site config header.")
option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
@ -175,7 +176,7 @@ cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY
cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
"Statically link the ABI library to shared library" ON
"LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
"LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF)
# Generate and install a linker script inplace of libc++.so. The linker script
# will link libc++ to the correct ABI library. This option is on by default
@ -662,6 +663,7 @@ endif()
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
config_define_if(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT)
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)

View File

@ -332,6 +332,15 @@ libc++ Feature Options
Use the specified GCC toolchain and standard library when building the native
stdlib benchmark tests.
.. option:: LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT:BOOL
**Default**: ``OFF``
Pick the default for whether to constrain ABI-unstable symbols to
each individual translation unit. This setting controls whether
`_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined by default --
see the documentation of that macro for details.
libc++ ABI Feature Options
--------------------------

View File

@ -42,9 +42,42 @@ Visibility Macros
**_LIBCPP_HIDE_FROM_ABI**
Mark a function as not being part of the ABI of any final linked image that
uses it, and also as being internal to each TU that uses that function. In
other words, the address of a function marked with this attribute is not
guaranteed to be the same across translation units.
uses it.
**_LIBCPP_HIDE_FROM_ABI_PER_TU**
This macro controls whether symbols hidden from the ABI with `_LIBCPP_HIDE_FROM_ABI`
are local to each translation unit in addition to being local to each final
linked image. This macro is defined to either 0 or 1. When it is defined to
1, translation units compiled with different versions of libc++ can be linked
together, since all non ABI-facing functions are local to each translation unit.
This allows static archives built with different versions of libc++ to be linked
together. This also means that functions marked with `_LIBCPP_HIDE_FROM_ABI`
are not guaranteed to have the same address across translation unit boundaries.
When the macro is defined to 0, there is no guarantee that translation units
compiled with different versions of libc++ can interoperate. However, this
leads to code size improvements, since non ABI-facing functions can be
deduplicated across translation unit boundaries.
This macro can be defined by users to control the behavior they want from
libc++. The default value of this macro (0 or 1) is controlled by whether
`_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined, which is intended to
be used by vendors only (see below).
**_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT**
This macro controls the default value for `_LIBCPP_HIDE_FROM_ABI_PER_TU`.
When the macro is defined, per TU ABI insulation is enabled by default, and
`_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 1 unless overriden by users.
Otherwise, per TU ABI insulation is disabled by default, and
`_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 0 unless overriden by users.
This macro is intended for vendors to control whether they want to ship
libc++ with per TU ABI insulation enabled by default. Users can always
control the behavior they want by defining `_LIBCPP_HIDE_FROM_ABI_PER_TU`
appropriately.
By default, this macro is not defined, which means that per TU ABI insulation
is not provided unless explicitly overriden by users.
**_LIBCPP_TYPE_VIS**
Mark a type's typeinfo, vtable and members as having default visibility.

View File

@ -328,6 +328,31 @@
# define _LIBCPP_NO_CFI
#endif
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
# if defined(__FreeBSD__)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_C11_FEATURES
# elif defined(__Fuchsia__)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_TIMESPEC_GET
# define _LIBCPP_HAS_C11_FEATURES
# elif defined(__linux__)
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
# define _LIBCPP_HAS_QUICK_EXIT
# endif
# if _LIBCPP_GLIBC_PREREQ(2, 17)
# define _LIBCPP_HAS_C11_FEATURES
# define _LIBCPP_HAS_TIMESPEC_GET
# endif
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_TIMESPEC_GET
# define _LIBCPP_HAS_C11_FEATURES
# endif
# endif // __linux__
#endif
#if defined(_LIBCPP_COMPILER_CLANG)
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
@ -430,28 +455,6 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
# if defined(__FreeBSD__)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_C11_FEATURES
# elif defined(__Fuchsia__)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_C11_FEATURES
# elif defined(__linux__)
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
# define _LIBCPP_HAS_QUICK_EXIT
# endif
# if _LIBCPP_GLIBC_PREREQ(2, 17)
# define _LIBCPP_HAS_C11_FEATURES
# endif
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
# define _LIBCPP_HAS_QUICK_EXIT
# define _LIBCPP_HAS_C11_FEATURES
# endif
# endif // __linux__
#endif
#if !(__has_feature(cxx_noexcept))
#define _LIBCPP_HAS_NO_NOEXCEPT
#endif
@ -801,8 +804,20 @@ namespace std {
# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE
#endif
#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU
# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0
# else
# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1
# endif
#endif
#ifndef _LIBCPP_HIDE_FROM_ABI
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
# if _LIBCPP_HIDE_FROM_ABI_PER_TU
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
# else
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE
# endif
#endif
// Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually.
@ -991,6 +1006,11 @@ template <unsigned> struct __static_assert_check {};
# endif
#endif // defined(__APPLE__)
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
!defined(_LIBCPP_BUILDING_LIBRARY) && \
(!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE

View File

@ -14,6 +14,7 @@
#cmakedefine _LIBCPP_ABI_UNSTABLE
#cmakedefine _LIBCPP_ABI_FORCE_ITANIUM
#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
#cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#cmakedefine _LIBCPP_HAS_NO_STDIN
#cmakedefine _LIBCPP_HAS_NO_STDOUT

View File

@ -151,11 +151,11 @@ using ::mbtowc;
using ::wctomb;
using ::mbstowcs;
using ::wcstombs;
#ifdef _LIBCPP_HAS_QUICK_EXIT
#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
using ::at_quick_exit;
using ::quick_exit;
#endif
#ifdef _LIBCPP_HAS_C11_FEATURES
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
using ::aligned_alloc;
#endif

View File

@ -73,7 +73,7 @@ using ::gmtime;
using ::localtime;
#endif
using ::strftime;
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
using ::timespec_get;
#endif

View File

@ -108,13 +108,6 @@ void operator delete[](void* ptr, void*) noexcept;
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
(!(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER > 14 || \
(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif
#if !__has_builtin(__builtin_operator_new) || \
__has_builtin(__builtin_operator_new) < 201802L || \
defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \

View File

@ -14,6 +14,9 @@
// _LIBCPP_HAS_C11_FEATURES - which is defined in <__config>
// They should always be the same
#include <__config>
#include "test_macros.h"
#ifdef TEST_HAS_C11_FEATURES
# ifndef _LIBCPP_HAS_C11_FEATURES
# error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is not"

View File

@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
// aligned allocation functions are not provided prior to macosx10.13
// XFAIL: macosx10.12
// XFAIL: macosx10.11
// XFAIL: macosx10.10
// XFAIL: macosx10.9
// XFAIL: macosx10.8
// XFAIL: macosx10.7
#include <new>
#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it"
#endif
int main() { }

View File

@ -11,6 +11,8 @@
#include <float.h>
#include "test_macros.h"
#ifndef FLT_ROUNDS
#error FLT_ROUNDS not defined
#endif
@ -23,7 +25,7 @@
#error FLT_RADIX not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_HAS_SUBNORM
#error FLT_HAS_SUBNORM not defined
#endif
@ -53,7 +55,7 @@
#error DECIMAL_DIG not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_DECIMAL_DIG
#error FLT_DECIMAL_DIG not defined
#endif
@ -163,7 +165,7 @@
#error LDBL_MIN not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_TRUE_MIN
#error FLT_TRUE_MIN not defined
#endif

View File

@ -12,17 +12,27 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
// Older Clang versions do not support this
// XFAIL: clang-3, apple-clang-7, apple-clang-8
// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
// None of the current GCC compilers support this.
// XFAIL: gcc-5, gcc-6
// UNSUPPORTED: gcc-5, gcc-6
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not

View File

@ -15,13 +15,22 @@
// FIXME change this to XFAIL.
// UNSUPPORTED: no-aligned-allocation && !gcc
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not

View File

@ -15,12 +15,22 @@
// FIXME turn this into an XFAIL
// UNSUPPORTED: no-aligned-allocation && !gcc
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not

View File

@ -10,12 +10,24 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: sanitizer-new-delete
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so our
// custom aligned allocation functions are not called and the test fails
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Our custom aligned allocation functions are not called when deploying to
// platforms older than macosx10.13, since those platforms don't support
// aligned allocation.
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// XFAIL: no-aligned-allocation && !gcc

View File

@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include "test_macros.h"
#include <new>
int main ()
{
::operator new[](4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -0,0 +1,26 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <new>
// void* operator new[](std::size_t, std::align_val_t);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include <new>
int main ()
{
::operator new[](4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include "test_macros.h"
#include <new>
int main ()
{
::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include "test_macros.h"
#include <new>
int main ()
{
::operator new[](4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -11,17 +11,27 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
// Older Clang versions do not support this
// XFAIL: clang-3, apple-clang-7, apple-clang-8
// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
// None of the current GCC compilers support this.
// XFAIL: gcc-5, gcc-6
// UNSUPPORTED: gcc-5, gcc-6
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not

View File

@ -9,12 +9,22 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

View File

@ -9,12 +9,22 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Using aligned allocation functions is a compiler error when deploying to
// platforms older than macosx10.13
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

View File

@ -10,12 +10,24 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: sanitizer-new-delete
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
// dylibs shipped before macosx10.13 do not provide aligned allocation, so our
// custom aligned allocation functions are not called and the test fails
// UNSUPPORTED: with_system_cxx_lib=macosx10.12
// UNSUPPORTED: with_system_cxx_lib=macosx10.11
// UNSUPPORTED: with_system_cxx_lib=macosx10.10
// UNSUPPORTED: with_system_cxx_lib=macosx10.9
// UNSUPPORTED: with_system_cxx_lib=macosx10.8
// UNSUPPORTED: with_system_cxx_lib=macosx10.7
// Our custom aligned allocation functions are not called when deploying to
// platforms older than macosx10.13, since those platforms don't support
// aligned allocation.
// UNSUPPORTED: macosx10.12
// UNSUPPORTED: macosx10.11
// UNSUPPORTED: macosx10.10
// UNSUPPORTED: macosx10.9
// UNSUPPORTED: macosx10.8
// UNSUPPORTED: macosx10.7
// NOTE: gcc doesn't provide -faligned-allocation flag to test for
// XFAIL: no-aligned-allocation && !gcc

View File

@ -1,25 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <new>
// void* operator new(std::size_t, std::align_val_t);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
#include "test_macros.h"
int main ()
{
::operator new(4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -10,16 +10,17 @@
// <new>
// void* operator new[](std::size_t, std::align_val_t);
// void* operator new(std::size_t, std::align_val_t);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include "test_macros.h"
#include <new>
int main ()
{
::operator new[](4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
::operator new(4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <new>
// REQUIRES: -faligned-allocation
// RUN: %compile %verify -faligned-allocation
#include "test_macros.h"
#include <new>
int main ()
{
::operator new(4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
::operator new(4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}

View File

@ -11,6 +11,8 @@
#include <cfloat>
#include "test_macros.h"
#ifndef FLT_ROUNDS
#error FLT_ROUNDS not defined
#endif
@ -23,7 +25,7 @@
#error FLT_RADIX not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_HAS_SUBNORM
#error FLT_HAS_SUBNORM not defined
#endif
@ -53,7 +55,7 @@
#error DECIMAL_DIG not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_DECIMAL_DIG
#error FLT_DECIMAL_DIG not defined
#endif
@ -163,7 +165,7 @@
#error LDBL_MIN not defined
#endif
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_TRUE_MIN
#error FLT_TRUE_MIN not defined
#endif

View File

@ -45,7 +45,7 @@ int main()
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS

View File

@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
// test quick_exit and at_quick_exit

View File

@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
// test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.

View File

@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
// test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.

View File

@ -47,7 +47,7 @@ int main()
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS

View File

@ -22,7 +22,11 @@
#define _J NASTY_MACRO
#define _K NASTY_MACRO
#define _L NASTY_MACRO
// Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid
// including that header, only define _M for other operating systems.
#ifndef __FreeBSD__
#define _M NASTY_MACRO
#endif
#define _N NASTY_MACRO
#define _O NASTY_MACRO
#define _P NASTY_MACRO

View File

@ -124,22 +124,29 @@
// Sniff out to see if the underling C library has C11 features
// Note that at this time (July 2018), MacOS X and iOS do NOT.
#if __ISO_C_VISIBLE >= 2011
// This is cribbed from __config; but lives here as well because we can't assume libc++
#if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11
# if defined(__FreeBSD__)
// Specifically, FreeBSD does NOT have timespec_get, even though they have all
// the rest of C11 - this is PR#38495
# define TEST_HAS_C11_FEATURES
# elif defined(__Fuchsia__)
# define TEST_HAS_C11_FEATURES
# define TEST_HAS_TIMESPEC_GET
# elif defined(__linux__)
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
# if _LIBCPP_GLIBC_PREREQ(2, 17)
# define TEST_HAS_TIMESPEC_GET
# define TEST_HAS_C11_FEATURES
# endif
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
# define TEST_HAS_C11_FEATURES
# define TEST_HAS_TIMESPEC_GET
# endif
# elif defined(_WIN32)
# if defined(_MSC_VER) && !defined(__MINGW32__)
# define TEST_HAS_C11_FEATURES // Using Microsoft's C Runtime library
# define TEST_HAS_TIMESPEC_GET
# endif
# endif
#endif

View File

@ -677,7 +677,8 @@ def parse_config_site_and_add_features(self, header):
if feature_macros[m]:
define += '=%s' % (feature_macros[m])
self.cxx.compile_flags += [define]
if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS':
if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS' or \
m == '_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT':
continue
if m == '_LIBCPP_ABI_VERSION':
self.config.available_features.add('libcpp-abi-version-v%s'