Skip to content

Commit

Permalink
Cleanups for don't-call functions (microsoft#3905)
Browse files Browse the repository at this point in the history
  • Loading branch information
achabense authored Jul 26, 2023
1 parent cd05c72 commit 0fe653a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
28 changes: 12 additions & 16 deletions stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -748,17 +748,15 @@ private:
}
}

#if !_HAS_STATIC_RTTI
[[noreturn]]
#endif // !_HAS_STATIC_RTTI
const type_info&
_Target_type() const noexcept override {
#if _HAS_STATIC_RTTI
const type_info& _Target_type() const noexcept override {
return typeid(_Callable);
#else // _HAS_STATIC_RTTI
_CSTD abort();
#endif // _HAS_STATIC_RTTI
}
#else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv
[[noreturn]] const type_info& _Target_type() const noexcept override {
_CSTD abort(); // shouldn't be called, see GH-3888
}
#endif // ^^^ !_HAS_STATIC_RTTI ^^^

const void* _Get() const noexcept override {
return _STD addressof(_Mypair._Myval2);
Expand Down Expand Up @@ -813,17 +811,15 @@ private:
}
}

#if !_HAS_STATIC_RTTI
[[noreturn]]
#endif // !_HAS_STATIC_RTTI
const type_info&
_Target_type() const noexcept override {
#if _HAS_STATIC_RTTI
const type_info& _Target_type() const noexcept override {
return typeid(_Callable);
#else // _HAS_STATIC_RTTI
_CSTD abort();
#endif // _HAS_STATIC_RTTI
}
#else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv
[[noreturn]] const type_info& _Target_type() const noexcept override {
_CSTD abort(); // shouldn't be called, see GH-3888
}
#endif // ^^^ !_HAS_STATIC_RTTI ^^^

const void* _Get() const noexcept override {
return _STD addressof(_Callee);
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/future
Original file line number Diff line number Diff line change
Expand Up @@ -1410,9 +1410,9 @@ public:
// Initializes _Fake_no_copy_callable_adapter with a decayed callable object and arguments
}

_Fake_no_copy_callable_adapter(const _Fake_no_copy_callable_adapter& _Other)
[[noreturn]] _Fake_no_copy_callable_adapter(const _Fake_no_copy_callable_adapter& _Other)
: _Storage(_STD move(_Other._Storage)) {
_STD terminate(); // Very Bad Things
_CSTD abort(); // shouldn't be called, see GH-3888
}

_Fake_no_copy_callable_adapter(_Fake_no_copy_callable_adapter&& _Other) = default;
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ struct _Projected_impl {
using _Projection = _Proj;

using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
indirect_result_t<_Proj&, _It> operator*() const {
_CSTD abort();
[[noreturn]] indirect_result_t<_Proj&, _It> operator*() const {
_CSTD abort(); // shouldn't be called, see GH-3888
}
};
};
Expand Down

0 comments on commit 0fe653a

Please sign in to comment.