[libcxx] Remove bad_array_length

Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54804

llvm-svn: 347903
This commit is contained in:
Louis Dionne 2018-11-29 19:44:57 +00:00
parent 129d529ab3
commit e823b6d7e6
13 changed files with 37 additions and 200 deletions

View File

@ -52,3 +52,11 @@ API Changes
std::dynarray was a feature proposed for C++14 that was pulled from the
Standard at the last minute and was never standardized. Since there are no
plans to standardize this facility it is being removed.
- Starting with LLVM 8.0.0, std::bad_array_length has been removed from the
library. std::bad_array_length was a feature proposed for C++14 alongside
std::dynarray, but it never actually made it into the C++ Standard. There
are no plans to standardize this feature at this time. Formally speaking,
this removal constitutes an ABI break because the symbols were shipped in
the shared library. However, on macOS systems, the feature was not usable
because it was hidden behind availability annotations. We do not expect
any actual breakage to happen from this change.

View File

@ -1310,7 +1310,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
__attribute__((availability(watchos,strict,introduced=5.0)))
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
@ -1338,7 +1337,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE

View File

@ -27,12 +27,6 @@ public:
virtual const char* what() const noexcept;
};
class bad_array_length : public bad_alloc // FIXME: Not part of C++
{
public:
bad_array_length() noexcept;
};
class bad_array_new_length : public bad_alloc // C++14
{
public:
@ -156,20 +150,6 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
#if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11)
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
bad_array_length : public bad_alloc {
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
#endif // defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11)
#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
!defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)
#ifndef _LIBCPP_CXX03_LANG
@ -350,21 +330,6 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, s
_DeallocateCaller::__do_deallocate_handle_align(__ptr, __align);
}
#ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_NO_EXCEPTIONS
_LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
#endif
void __throw_bad_array_length()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_array_length();
#else
_VSTD::abort();
#endif
}
#endif
template <class _Tp>
_LIBCPP_NODISCARD_AFTER_CXX17 inline
_LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT

View File

@ -16,6 +16,35 @@ New entries should be added directly below the "Version" header.
Version 8.0
-----------
* rXXXXX - Remove std::bad_array_length
The change removes the definition of std::bad_array_length (which never made
it into the standard) from the headers and the dylib. This is technically an
ABI break because the symbols are shipped starting with mac OSX 10.13, however
users couldn't be relying on the functionality because it is marked as being
unavailable using Clang's availability attribute.
x86_64-apple-darwin16.0
-----------------------
Symbol removed: __ZNKSt16bad_array_length4whatEv
Symbol removed: __ZNKSt16bad_array_length4whatEv
Symbol removed: __ZNSt16bad_array_lengthC1Ev
Symbol removed: __ZNSt16bad_array_lengthC1Ev
Symbol removed: __ZNSt16bad_array_lengthC2Ev
Symbol removed: __ZNSt16bad_array_lengthC2Ev
Symbol removed: __ZNSt16bad_array_lengthD0Ev
Symbol removed: __ZNSt16bad_array_lengthD0Ev
Symbol removed: __ZNSt16bad_array_lengthD1Ev
Symbol removed: __ZNSt16bad_array_lengthD1Ev
Symbol removed: __ZNSt16bad_array_lengthD2Ev
Symbol removed: __ZNSt16bad_array_lengthD2Ev
Symbol removed: __ZTISt16bad_array_length
Symbol removed: __ZTISt16bad_array_length
Symbol removed: __ZTSSt16bad_array_length
Symbol removed: __ZTSSt16bad_array_length
Symbol removed: __ZTVSt16bad_array_length
Symbol removed: __ZTVSt16bad_array_length
* r347395 - Making libc++ build under -fvisibility=hidden on Linux
The change marks several function templates as hidden. This removes symbols

View File

@ -8,8 +8,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt13bad_exception4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt13runtime_error4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt13runtime_error4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt19bad_optional_access4whatEv'}
@ -527,16 +525,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNSt15underflow_errorD1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt15underflow_errorD2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt15underflow_errorD2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthC1Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthC1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthC2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthC2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD0Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD0Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD1Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16invalid_argumentD0Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16invalid_argumentD0Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16invalid_argumentD1Ev'}
@ -1804,8 +1792,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTISt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTISt16nested_exception', 'size': 0}
@ -2059,8 +2045,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTSSt16nested_exception', 'size': 0}
@ -2251,8 +2235,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTVSt16nested_exception', 'size': 0}

View File

@ -8,8 +8,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt13bad_exception4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt13runtime_error4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt13runtime_error4whatEv'}
{'type': 'U', 'is_defined': False, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'I', 'is_defined': True, 'name': '__ZNKSt16bad_array_length4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt16nested_exception14rethrow_nestedEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt18bad_variant_access4whatEv'}
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNKSt19bad_optional_access4whatEv'}
@ -530,16 +528,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZNSt15underflow_errorD1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt15underflow_errorD2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt15underflow_errorD2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthC1Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthC1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthC2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthC2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD0Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD0Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD1Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD1Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16bad_array_lengthD2Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16bad_array_lengthD2Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16invalid_argumentD0Ev'}
{'type': 'I', 'is_defined': True, 'name': '__ZNSt16invalid_argumentD0Ev'}
{'type': 'U', 'is_defined': False, 'name': '__ZNSt16invalid_argumentD1Ev'}
@ -1721,8 +1709,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTISt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTISt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTISt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTISt16nested_exception', 'size': 0}
@ -2013,8 +1999,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTSSt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTSSt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTSSt16nested_exception', 'size': 0}
@ -2206,8 +2190,6 @@
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt14overflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt15underflow_error'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt15underflow_error'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt16bad_array_length'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt16bad_array_length'}
{'type': 'U', 'is_defined': False, 'name': '__ZTVSt16invalid_argument'}
{'type': 'I', 'is_defined': True, 'name': '__ZTVSt16invalid_argument'}
{'type': 'OBJECT', 'is_defined': True, 'name': '__ZTVSt16nested_exception', 'size': 0}

View File

@ -283,16 +283,6 @@ __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

View File

@ -134,22 +134,6 @@ bad_array_new_length::what() const _NOEXCEPT
return "bad_array_new_length";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
bad_cast::bad_cast() _NOEXCEPT
{
}

View File

@ -22,11 +22,6 @@ bad_array_new_length::bad_array_new_length() _NOEXCEPT
{
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_cast::bad_cast() _NOEXCEPT
{
}

View File

@ -23,19 +23,4 @@ const char* bad_exception::what() const _NOEXCEPT
return "std::bad_exception";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
} // namespace std

View File

@ -83,20 +83,6 @@ int uncaught_exceptions() _NOEXCEPT {
return __uncaught_exceptions();
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
#if defined(_LIBCPP_NO_VCRUNTIME)
bad_cast::bad_cast() _NOEXCEPT
{

View File

@ -1,37 +0,0 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: availability
// XFAIL: availability=macosx10.12
// XFAIL: availability=macosx10.11
// XFAIL: availability=macosx10.10
// XFAIL: availability=macosx10.9
// XFAIL: availability=macosx10.7
// XFAIL: availability=macosx10.8
// test bad_array_length
#include <new>
#include <type_traits>
#include <cassert>
int main()
{
static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
"std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
static_assert(std::is_polymorphic<std::bad_array_length>::value,
"std::is_polymorphic<std::bad_array_length>::value");
std::bad_array_length b;
std::bad_array_length b2 = b;
b2 = b;
const char* w = b2.what();
assert(w);
}

View File

@ -69,34 +69,4 @@ bad_array_new_length::what() const _NOEXCEPT
return "bad_array_new_length";
}
// bad_array_length
#ifndef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
class _LIBCPP_EXCEPTION_ABI bad_array_length
: public bad_alloc
{
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
#endif // _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
} // std