From 8ad8b454b4916f3cbee9af77a1095ffbf2bc0896 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 18 Aug 2018 08:27:12 +0000 Subject: Vendor import of libc++ release_70 branch r339999: https://llvm.org/svn/llvm-project/libcxx/branches/release_70@339999 --- CMakeLists.txt | 4 +- docs/BuildingLibcxx.rst | 9 +++ docs/DesignDocs/VisibilityMacros.rst | 39 ++++++++++++- include/__config | 66 ++++++++++++++-------- include/__config_site.in | 1 + include/cstdlib | 4 +- include/ctime | 2 +- include/new | 7 --- .../language.support/has_c11_features.pass.cpp | 3 + .../memory/aligned_allocation_macro.pass.cpp | 27 +++++++++ test/std/depr/depr.c.headers/float_h.pass.cpp | 8 ++- .../delete_align_val_t_replace.pass.cpp | 28 ++++++--- .../new.delete.array/new_align_val_t.pass.cpp | 23 +++++--- .../new_align_val_t_nothrow.pass.cpp | 22 ++++++-- .../new_align_val_t_nothrow_replace.pass.cpp | 24 ++++++-- .../new.delete/new.delete.array/new_size.fail.cpp | 25 -------- .../new.delete/new.delete.array/new_size.sh.cpp | 26 +++++++++ .../new.delete.array/new_size_align.fail.cpp | 25 -------- .../new.delete.array/new_size_align.sh.cpp | 26 +++++++++ .../new_size_align_nothrow.fail.cpp | 25 -------- .../new.delete.array/new_size_align_nothrow.sh.cpp | 26 +++++++++ .../new.delete.array/new_size_nothrow.fail.cpp | 25 -------- .../new.delete.array/new_size_nothrow.sh.cpp | 26 +++++++++ .../delete_align_val_t_replace.pass.cpp | 28 ++++++--- .../new.delete.single/new_align_val_t.pass.cpp | 22 ++++++-- .../new_align_val_t_nothrow.pass.cpp | 22 ++++++-- .../new_align_val_t_nothrow_replace.pass.cpp | 24 ++++++-- .../new.delete.single/new_size_align.fail.cpp | 25 -------- .../new.delete.single/new_size_align.sh.cpp | 26 +++++++++ .../new_size_align_nothrow.fail.cpp | 25 -------- .../new_size_align_nothrow.sh.cpp | 26 +++++++++ .../support.limits/c.limits/cfloat.pass.cpp | 8 ++- .../support.runtime/ctime.pass.cpp | 2 +- .../support.start.term/quick_exit.pass.cpp | 2 +- .../support.start.term/quick_exit_check1.fail.cpp | 1 + .../support.start.term/quick_exit_check2.fail.cpp | 2 +- test/std/utilities/time/date.time/ctime.pass.cpp | 2 +- test/support/nasty_macros.hpp | 4 ++ test/support/test_macros.h | 9 ++- utils/libcxx/test/config.py | 3 +- 40 files changed, 448 insertions(+), 254 deletions(-) create mode 100644 test/libcxx/memory/aligned_allocation_macro.pass.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp delete mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp create mode 100644 test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d9bebc592d..acb49565ce97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst index d0b03c675c8b..daf9229a0d05 100644 --- a/docs/BuildingLibcxx.rst +++ b/docs/BuildingLibcxx.rst @@ -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 -------------------------- diff --git a/docs/DesignDocs/VisibilityMacros.rst b/docs/DesignDocs/VisibilityMacros.rst index 878566ea0bc1..ab577df13641 100644 --- a/docs/DesignDocs/VisibilityMacros.rst +++ b/docs/DesignDocs/VisibilityMacros.rst @@ -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. diff --git a/include/__config b/include/__config index 639d06c9f5d7..738d891e3032 100644 --- a/include/__config +++ b/include/__config @@ -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 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 diff --git a/include/__config_site.in b/include/__config_site.in index 8d980ff57cc8..7c7c226c4922 100644 --- a/include/__config_site.in +++ b/include/__config_site.in @@ -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 diff --git a/include/cstdlib b/include/cstdlib index 78c428403c37..00c604e67623 100644 --- a/include/cstdlib +++ b/include/cstdlib @@ -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 diff --git a/include/ctime b/include/ctime index 81cf11a466c2..8264fe33b964 100644 --- a/include/ctime +++ b/include/ctime @@ -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 diff --git a/include/new b/include/new index e70b9c621570..5a658c7a2f24 100644 --- a/include/new +++ b/include/new @@ -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) || \ diff --git a/test/libcxx/language.support/has_c11_features.pass.cpp b/test/libcxx/language.support/has_c11_features.pass.cpp index cdccc00e21b4..4edec534eb98 100644 --- a/test/libcxx/language.support/has_c11_features.pass.cpp +++ b/test/libcxx/language.support/has_c11_features.pass.cpp @@ -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" diff --git a/test/libcxx/memory/aligned_allocation_macro.pass.cpp b/test/libcxx/memory/aligned_allocation_macro.pass.cpp new file mode 100644 index 000000000000..c1a4252aa619 --- /dev/null +++ b/test/libcxx/memory/aligned_allocation_macro.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// aligned allocation functions are not provided prior to macosx10.13 +// XFAIL: macosx10.12 +// XFAIL: macosx10.11 +// XFAIL: macosx10.10 +// XFAIL: macosx10.9 +// XFAIL: macosx10.8 +// XFAIL: macosx10.7 + +#include + + +#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it" +#endif + +int main() { } diff --git a/test/std/depr/depr.c.headers/float_h.pass.cpp b/test/std/depr/depr.c.headers/float_h.pass.cpp index 3001c215cd19..84e89c4dbb84 100644 --- a/test/std/depr/depr.c.headers/float_h.pass.cpp +++ b/test/std/depr/depr.c.headers/float_h.pass.cpp @@ -11,6 +11,8 @@ #include +#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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index 2175e29a040d..52aeea314dd5 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -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 - -// 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 +// UNSUPPORTED: gcc-5, gcc-6 + +// 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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp index 942f5e778b66..1d20b33a0df2 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp index f55ad5bcc84e..60ebdd8e9457 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp index e1ebf86ee176..b09316487f90 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp deleted file mode 100644 index 0dfef2e56fca..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp new file mode 100644 index 000000000000..40632a1bd49b --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp deleted file mode 100644 index ea041aea16ee..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::align_val_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp new file mode 100644 index 000000000000..f7921d2f2c12 --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::align_val_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp deleted file mode 100644 index 99e4f76b312f..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::align_val_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp new file mode 100644 index 000000000000..130148786732 --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::align_val_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp deleted file mode 100644 index 8aae54e83fbe..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new[](std::size_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new[](4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp new file mode 100644 index 000000000000..43295a7e6932 --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new[](std::size_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index 6f1c7511243e..5885218c4661 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -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 - -// 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 +// UNSUPPORTED: gcc-5, gcc-6 + +// 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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp index fae5d3676df6..52db4c56ced4 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp index f22c48994355..a5e40a0d28c8 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp index 565ba9b851bb..de1bd8d82052 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp @@ -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 diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp deleted file mode 100644 index c3cabbdb79d5..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new(std::size_t, std::align_val_t); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new(4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp new file mode 100644 index 000000000000..410c6d7748da --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new(std::size_t, std::align_val_t); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new(4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp deleted file mode 100644 index e987a53478b0..000000000000 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void* operator new(std::size_t, std::align_val_t, std::nothrow_t &); - -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 - -#include - -#include "test_macros.h" - -int main () -{ - ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp new file mode 100644 index 000000000000..1fe104551e1b --- /dev/null +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp @@ -0,0 +1,26 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void* operator new(std::size_t, std::align_val_t, std::nothrow_t &); + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +// REQUIRES: -faligned-allocation +// RUN: %compile %verify -faligned-allocation + +#include + +int main () +{ + ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp index 6e399d0934bf..c1e5be91ef1f 100644 --- a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp +++ b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp @@ -11,6 +11,8 @@ #include +#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 diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp index 908dc480884c..d80bc198293e 100644 --- a/test/std/language.support/support.runtime/ctime.pass.cpp +++ b/test/std/language.support/support.runtime/ctime.pass.cpp @@ -45,7 +45,7 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET) static_assert((std::is_same::value), ""); #endif #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS diff --git a/test/std/language.support/support.start.term/quick_exit.pass.cpp b/test/std/language.support/support.start.term/quick_exit.pass.cpp index bcfdbb75402e..2bf2ea790653 100644 --- a/test/std/language.support/support.start.term/quick_exit.pass.cpp +++ b/test/std/language.support/support.start.term/quick_exit.pass.cpp @@ -6,7 +6,7 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// +// UNSUPPORTED: c++98, c++03 // test quick_exit and at_quick_exit diff --git a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp index 8b9729379163..f42498e3d7b9 100644 --- a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp +++ b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp @@ -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. diff --git a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp index 395914136820..c49704f99aea 100644 --- a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp +++ b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp @@ -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. diff --git a/test/std/utilities/time/date.time/ctime.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp index fe9f38daa3ff..cd1f32be2bca 100644 --- a/test/std/utilities/time/date.time/ctime.pass.cpp +++ b/test/std/utilities/time/date.time/ctime.pass.cpp @@ -47,7 +47,7 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) +#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET) static_assert((std::is_same::value), ""); #endif #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp index 76d8ab0e720f..97a17bb689a4 100644 --- a/test/support/nasty_macros.hpp +++ b/test/support/nasty_macros.hpp @@ -22,7 +22,11 @@ #define _J NASTY_MACRO #define _K NASTY_MACRO #define _L NASTY_MACRO +// Because FreeBSD uses _M in its , and it is hard to avoid +// including that header, only define _M for other operating systems. +#ifndef __FreeBSD__ #define _M NASTY_MACRO +#endif #define _N NASTY_MACRO #define _O NASTY_MACRO #define _P NASTY_MACRO diff --git a/test/support/test_macros.h b/test/support/test_macros.h index ac6ec79b9235..e008b5323003 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -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 diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 6542ceb6fb58..186a273a5b51 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -677,7 +677,8 @@ class Configuration(object): 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' -- cgit v1.2.3