Skip to content

Commit

Permalink
[libcxx] Remove bad_array_length
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ldionne committed Nov 29, 2018
1 parent 129d529 commit e823b6d
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 200 deletions.
8 changes: 8 additions & 0 deletions libcxx/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 0 additions & 2 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
35 changes: 0 additions & 35 deletions libcxx/include/new
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions libcxx/lib/abi/CHANGELOG.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions libcxx/lib/abi/x86_64-apple-darwin.v1.abilist
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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'}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
18 changes: 0 additions & 18 deletions libcxx/lib/abi/x86_64-apple-darwin.v2.abilist
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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'}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
10 changes: 0 additions & 10 deletions libcxx/lib/libc++abi2.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions libcxx/src/support/runtime/exception_fallback.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
}
Expand Down
5 changes: 0 additions & 5 deletions libcxx/src/support/runtime/exception_glibcxx.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
}
Expand Down
15 changes: 0 additions & 15 deletions libcxx/src/support/runtime/exception_libcxxrt.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 0 additions & 14 deletions libcxx/src/support/runtime/exception_msvc.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

This file was deleted.

30 changes: 0 additions & 30 deletions libcxxabi/src/stdlib_exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e823b6d

Please sign in to comment.