Skip to content

Commit 0fe653a

Browse files
authored
Cleanups for don't-call functions (microsoft#3905)
1 parent cd05c72 commit 0fe653a

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

stl/inc/functional

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -748,17 +748,15 @@ private:
748748
}
749749
}
750750

751-
#if !_HAS_STATIC_RTTI
752-
[[noreturn]]
753-
#endif // !_HAS_STATIC_RTTI
754-
const type_info&
755-
_Target_type() const noexcept override {
756751
#if _HAS_STATIC_RTTI
752+
const type_info& _Target_type() const noexcept override {
757753
return typeid(_Callable);
758-
#else // _HAS_STATIC_RTTI
759-
_CSTD abort();
760-
#endif // _HAS_STATIC_RTTI
761754
}
755+
#else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv
756+
[[noreturn]] const type_info& _Target_type() const noexcept override {
757+
_CSTD abort(); // shouldn't be called, see GH-3888
758+
}
759+
#endif // ^^^ !_HAS_STATIC_RTTI ^^^
762760

763761
const void* _Get() const noexcept override {
764762
return _STD addressof(_Mypair._Myval2);
@@ -813,17 +811,15 @@ private:
813811
}
814812
}
815813

816-
#if !_HAS_STATIC_RTTI
817-
[[noreturn]]
818-
#endif // !_HAS_STATIC_RTTI
819-
const type_info&
820-
_Target_type() const noexcept override {
821814
#if _HAS_STATIC_RTTI
815+
const type_info& _Target_type() const noexcept override {
822816
return typeid(_Callable);
823-
#else // _HAS_STATIC_RTTI
824-
_CSTD abort();
825-
#endif // _HAS_STATIC_RTTI
826817
}
818+
#else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv
819+
[[noreturn]] const type_info& _Target_type() const noexcept override {
820+
_CSTD abort(); // shouldn't be called, see GH-3888
821+
}
822+
#endif // ^^^ !_HAS_STATIC_RTTI ^^^
827823

828824
const void* _Get() const noexcept override {
829825
return _STD addressof(_Callee);

stl/inc/future

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,9 +1410,9 @@ public:
14101410
// Initializes _Fake_no_copy_callable_adapter with a decayed callable object and arguments
14111411
}
14121412

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

14181418
_Fake_no_copy_callable_adapter(_Fake_no_copy_callable_adapter&& _Other) = default;

stl/inc/xutility

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ struct _Projected_impl {
883883
using _Projection = _Proj;
884884

885885
using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
886-
indirect_result_t<_Proj&, _It> operator*() const {
887-
_CSTD abort();
886+
[[noreturn]] indirect_result_t<_Proj&, _It> operator*() const {
887+
_CSTD abort(); // shouldn't be called, see GH-3888
888888
}
889889
};
890890
};

0 commit comments

Comments
 (0)