Skip to content

Commit 05e5e68

Browse files
Cleanup product code uses of feature-test macros (#3053)
Co-authored-by: Stephan T. Lavavej <[email protected]>
1 parent 473245c commit 05e5e68

File tree

25 files changed

+187
-192
lines changed

25 files changed

+187
-192
lines changed

stl/inc/chrono

+5-8
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@
3535

3636
#ifdef __cpp_lib_concepts
3737
#include <concepts>
38-
#endif // defined(__cpp_lib_concepts)
39-
40-
#ifdef __cpp_lib_format
4138
#include <format>
4239
#include <iomanip>
43-
#endif // defined(__cpp_lib_format)
40+
#endif // __cpp_lib_concepts
4441
#endif // _HAS_CXX20
4542

4643
#pragma pack(push, _CRT_PACKING)
@@ -1683,7 +1680,7 @@ namespace chrono {
16831680
: runtime_error(_Make_string(_Tp, _Info)) {}
16841681

16851682
private:
1686-
#ifdef __cpp_lib_format
1683+
#ifdef __cpp_lib_concepts
16871684
template <class _Duration>
16881685
_NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info);
16891686
#else // ^^^ no workaround / workaround vvv
@@ -1706,7 +1703,7 @@ namespace chrono {
17061703
: runtime_error(_Make_string(_Tp, _Info)) {}
17071704

17081705
private:
1709-
#ifdef __cpp_lib_format
1706+
#ifdef __cpp_lib_concepts
17101707
template <class _Duration>
17111708
_NODISCARD static string _Make_string(const local_time<_Duration>& _Tp, const local_info& _Info);
17121709
#else // ^^^ no workaround / workaround vvv
@@ -4653,7 +4650,7 @@ namespace chrono {
46534650
}
46544651
} // namespace chrono
46554652

4656-
#ifdef __cpp_lib_format
4653+
#ifdef __cpp_lib_concepts
46574654
// [time.format]
46584655

46594656
template <class _CharT>
@@ -5984,7 +5981,7 @@ namespace chrono {
59845981
return _STD move(_Os).str();
59855982
}
59865983
} // namespace chrono
5987-
#endif // __cpp_lib_format
5984+
#endif // __cpp_lib_concepts
59885985

59895986
inline namespace literals {
59905987
inline namespace chrono_literals {

stl/inc/deque

+12-12
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public:
673673
_Proxy._Release();
674674
}
675675

676-
#ifdef __cpp_lib_containers_ranges
676+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
677677
template <_Container_compatible_range<_Ty> _Rng>
678678
deque(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) {
679679
_Alproxy_ty _Alproxy(_Getal());
@@ -689,7 +689,7 @@ public:
689689
_Construct(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
690690
_Proxy._Release();
691691
}
692-
#endif // __cpp_lib_containers_ranges
692+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
693693

694694
private:
695695
template <class _Iter, class _Sent>
@@ -790,7 +790,7 @@ public:
790790
emplace_front(_STD move(_Val));
791791
}
792792

793-
#ifdef __cpp_lib_containers_ranges
793+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
794794
template <_Container_compatible_range<_Ty> _Rng>
795795
void prepend_range(_Rng&& _Range) {
796796
_Orphan_all();
@@ -815,14 +815,14 @@ public:
815815
}
816816
_Guard._Container = nullptr;
817817
}
818-
#endif // __cpp_lib_containers_ranges
818+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
819819

820820
void push_back(_Ty&& _Val) {
821821
_Orphan_all();
822822
_Emplace_back_internal(_STD move(_Val));
823823
}
824824

825-
#ifdef __cpp_lib_containers_ranges
825+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
826826
template <_Container_compatible_range<_Ty> _Rng>
827827
void append_range(_Rng&& _Range) {
828828
_Orphan_all();
@@ -837,7 +837,7 @@ public:
837837
}
838838
_Guard._Container = nullptr;
839839
}
840-
#endif // __cpp_lib_containers_ranges
840+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
841841

842842
iterator insert(const_iterator _Where, _Ty&& _Val) {
843843
return emplace(_Where, _STD move(_Val));
@@ -1240,12 +1240,12 @@ public:
12401240
_Assign_range(_Get_unwrapped(_First), _Get_unwrapped(_Last));
12411241
}
12421242

1243-
#ifdef __cpp_lib_containers_ranges
1243+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
12441244
template <_Container_compatible_range<_Ty> _Rng>
12451245
void assign_range(_Rng&& _Range) {
12461246
_Assign_range(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
12471247
}
1248-
#endif // __cpp_lib_containers_ranges
1248+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
12491249

12501250
void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { // assign _Count * _Val
12511251
_Orphan_all();
@@ -1381,7 +1381,7 @@ public:
13811381
_Off, _Get_unwrapped(_First), _Get_unwrapped(_Last));
13821382
}
13831383

1384-
#ifdef __cpp_lib_containers_ranges
1384+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
13851385
template <_Container_compatible_range<_Ty> _Rng>
13861386
iterator insert_range(const_iterator _Where, _Rng&& _Range) {
13871387
const size_type _Off = static_cast<size_type>(_Where - begin());
@@ -1393,7 +1393,7 @@ public:
13931393
return _Insert_range<_Is_bidi::_No>(_Off, _RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
13941394
}
13951395
}
1396-
#endif // __cpp_lib_containers_ranges
1396+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
13971397

13981398
iterator erase(const_iterator _Where) noexcept(is_nothrow_move_assignable_v<value_type>) /* strengthened */ {
13991399
return erase(_Where, _Next_iter(_Where));
@@ -1690,11 +1690,11 @@ template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>,
16901690
deque(_Iter, _Iter, _Alloc = _Alloc()) -> deque<_Iter_value_t<_Iter>, _Alloc>;
16911691
#endif // _HAS_CXX17
16921692

1693-
#ifdef __cpp_lib_containers_ranges
1693+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
16941694
template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>,
16951695
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
16961696
deque(from_range_t, _Rng&&, _Alloc = _Alloc()) -> deque<_RANGES range_value_t<_Rng>, _Alloc>;
1697-
#endif // __cpp_lib_containers_ranges
1697+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
16981698

16991699
template <class _Ty, class _Alloc>
17001700
void swap(deque<_Ty, _Alloc>& _Left, deque<_Ty, _Alloc>& _Right) noexcept /* strengthened */ {

stl/inc/expected

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#define _EXPECTED_
99
#include <yvals.h>
1010
#if _STL_COMPILER_PREPROCESSOR
11-
#ifndef __cpp_lib_expected
11+
#if !_HAS_CXX23 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395
1212
_EMIT_STL_WARNING(STL4038, "The contents of <expected> are available only with C++23 or later.");
13-
#else // ^^^ !__cpp_lib_expected / __cpp_lib_expected vvv
13+
#else // ^^^ not supported / supported language mode vvv
1414
#include <exception>
1515
#include <initializer_list>
1616
#include <type_traits>
@@ -1083,6 +1083,6 @@ _STD_END
10831083
_STL_RESTORE_CLANG_WARNINGS
10841084
#pragma warning(pop)
10851085
#pragma pack(pop)
1086-
#endif // __cpp_lib_expected
1086+
#endif // ^^^ supported language mode ^^^
10871087
#endif // _STL_COMPILER_PREPROCESSOR
10881088
#endif // _EXPECTED_

stl/inc/format

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
#define _FORMAT_
4040
#include <yvals_core.h>
4141
#if _STL_COMPILER_PREPROCESSOR
42-
#ifndef __cpp_lib_format
42+
#ifndef __cpp_lib_concepts
4343
_EMIT_STL_WARNING(STL4038, "The contents of <format> are available only with C++20 or later.");
44-
#else // ^^^ !defined(__cpp_lib_format) / defined(__cpp_lib_format) vvv
44+
#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv
4545

4646
#include <__msvc_format_ucd_tables.hpp>
4747
#include <algorithm>
@@ -3606,6 +3606,6 @@ _STL_RESTORE_CLANG_WARNINGS
36063606
#pragma warning(pop)
36073607
#pragma pack(pop)
36083608

3609-
#endif // __cpp_lib_format
3609+
#endif // __cpp_lib_concepts
36103610
#endif // _STL_COMPILER_PREPROCESSOR
36113611
#endif // _FORMAT_

stl/inc/forward_list

+10-10
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ public:
607607
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
608608
}
609609

610-
#ifdef __cpp_lib_containers_ranges
610+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
611611
template <_Container_compatible_range<_Ty> _Rng>
612612
forward_list(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) {
613613
_Flist_insert_after_op2<_Alnode> _Insert_op(_Getal());
@@ -623,7 +623,7 @@ public:
623623
_Alloc_proxy();
624624
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
625625
}
626-
#endif // __cpp_lib_containers_ranges
626+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
627627

628628
forward_list(forward_list&& _Right) noexcept // strengthened
629629
: _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) {
@@ -915,12 +915,12 @@ public:
915915
_Insert_after(_Mypair._Myval2._Before_head(), _Val);
916916
}
917917

918-
#ifdef __cpp_lib_containers_ranges
918+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
919919
template <_Container_compatible_range<_Ty> _Rng>
920920
void prepend_range(_Rng&& _Range) {
921921
_Insert_range_after(_Mypair._Myval2._Before_head(), _RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
922922
}
923-
#endif // __cpp_lib_containers_ranges
923+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
924924

925925
void pop_front() noexcept /* strengthened */ {
926926
_Erase_after(_Mypair._Myval2._Before_head());
@@ -960,12 +960,12 @@ public:
960960
_Assign_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last));
961961
}
962962

963-
#ifdef __cpp_lib_containers_ranges
963+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
964964
template <_Container_compatible_range<_Ty> _Rng>
965965
void assign_range(_Rng&& _Range) {
966966
_Assign_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
967967
}
968-
#endif // __cpp_lib_containers_ranges
968+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
969969

970970
void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) {
971971
clear();
@@ -1022,7 +1022,7 @@ public:
10221022
return _Insert_range_after(_Where._Ptr, _Get_unwrapped(_First), _Get_unwrapped(_Last));
10231023
}
10241024

1025-
#ifdef __cpp_lib_containers_ranges
1025+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
10261026
template <_Container_compatible_range<_Ty> _Rng>
10271027
iterator insert_range_after(const_iterator _Where, _Rng&& _Range) {
10281028
#if _ITERATOR_DEBUG_LEVEL == 2
@@ -1031,7 +1031,7 @@ public:
10311031
#endif // _ITERATOR_DEBUG_LEVEL == 2
10321032
return _Insert_range_after(_Where._Ptr, _RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
10331033
}
1034-
#endif // __cpp_lib_containers_ranges
1034+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
10351035

10361036
private:
10371037
void _Erase_after(_Nodeptr _Pnode) noexcept { // erase element after _Pnode
@@ -1555,11 +1555,11 @@ template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>,
15551555
forward_list(_Iter, _Iter, _Alloc = _Alloc()) -> forward_list<_Iter_value_t<_Iter>, _Alloc>;
15561556
#endif // _HAS_CXX17
15571557

1558-
#ifdef __cpp_lib_containers_ranges
1558+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
15591559
template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>,
15601560
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
15611561
forward_list(from_range_t, _Rng&&, _Alloc = _Alloc()) -> forward_list<_RANGES range_value_t<_Rng>, _Alloc>;
1562-
#endif // __cpp_lib_containers_ranges
1562+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
15631563

15641564
template <class _Ty, class _Alloc>
15651565
void swap(forward_list<_Ty, _Alloc>& _Left, forward_list<_Ty, _Alloc>& _Right) noexcept /* strengthened */ {

stl/inc/list

+12-12
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ public:
882882
_Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last));
883883
}
884884

885-
#ifdef __cpp_lib_containers_ranges
885+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
886886
template <_Container_compatible_range<_Ty> _Rng>
887887
list(from_range_t, _Rng&& _Range) : _Mypair(_Zero_then_variadic_args_t{}) {
888888
_Construct_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
@@ -892,7 +892,7 @@ public:
892892
list(from_range_t, _Rng&& _Range, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) {
893893
_Construct_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
894894
}
895-
#endif // __cpp_lib_containers_ranges
895+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
896896

897897
list(list&& _Right) : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) {
898898
_Alloc_sentinel_and_proxy();
@@ -1235,14 +1235,14 @@ public:
12351235
_Emplace(_Mypair._Myval2._Myhead->_Next, _Val);
12361236
}
12371237

1238-
#ifdef __cpp_lib_containers_ranges
1238+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
12391239
template <_Container_compatible_range<_Ty> _Rng>
12401240
void prepend_range(_Rng&& _Range) {
12411241
_List_node_insert_op2<_Alnode> _Op(_Getal());
12421242
_Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
12431243
_Op._Attach_before(_Mypair._Myval2, _Mypair._Myval2._Myhead->_Next);
12441244
}
1245-
#endif // __cpp_lib_containers_ranges
1245+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
12461246

12471247
void pop_front() noexcept /* strengthened */ {
12481248
#if _CONTAINER_DEBUG_LEVEL > 0
@@ -1256,14 +1256,14 @@ public:
12561256
_Emplace(_Mypair._Myval2._Myhead, _Val);
12571257
}
12581258

1259-
#ifdef __cpp_lib_containers_ranges
1259+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
12601260
template <_Container_compatible_range<_Ty> _Rng>
12611261
void append_range(_Rng&& _Range) {
12621262
_List_node_insert_op2<_Alnode> _Op(_Getal());
12631263
_Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
12641264
_Op._Attach_at_end(_Mypair._Myval2);
12651265
}
1266-
#endif // __cpp_lib_containers_ranges
1266+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
12671267

12681268
void pop_back() noexcept /* strengthened */ {
12691269
#if _CONTAINER_DEBUG_LEVEL > 0
@@ -1333,12 +1333,12 @@ public:
13331333
_Assign_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last));
13341334
}
13351335

1336-
#ifdef __cpp_lib_containers_ranges
1336+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
13371337
template <_Container_compatible_range<_Ty> _Rng>
13381338
void assign_range(_Rng&& _Range) {
13391339
_Assign_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
13401340
}
1341-
#endif // __cpp_lib_containers_ranges
1341+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
13421342

13431343
void assign(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { // assign _Count * _Val
13441344
const auto _Myend = _Mypair._Myval2._Myhead;
@@ -1392,7 +1392,7 @@ public:
13921392
return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr));
13931393
}
13941394

1395-
#ifdef __cpp_lib_containers_ranges
1395+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
13961396
template <_Container_compatible_range<_Ty> _Rng>
13971397
iterator insert_range(const_iterator _Where, _Rng&& _Range) {
13981398
#if _ITERATOR_DEBUG_LEVEL == 2
@@ -1402,7 +1402,7 @@ public:
14021402
_Op._Append_range_unchecked(_RANGES _Ubegin(_Range), _RANGES _Uend(_Range));
14031403
return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr));
14041404
}
1405-
#endif // __cpp_lib_containers_ranges
1405+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
14061406

14071407
iterator erase(const const_iterator _Where) noexcept /* strengthened */ {
14081408
#if _ITERATOR_DEBUG_LEVEL == 2
@@ -1858,11 +1858,11 @@ template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>,
18581858
list(_Iter, _Iter, _Alloc = _Alloc()) -> list<_Iter_value_t<_Iter>, _Alloc>;
18591859
#endif // _HAS_CXX17
18601860

1861-
#ifdef __cpp_lib_containers_ranges
1861+
#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395
18621862
template <_RANGES input_range _Rng, class _Alloc = allocator<_RANGES range_value_t<_Rng>>,
18631863
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
18641864
list(from_range_t, _Rng&&, _Alloc = _Alloc()) -> list<_RANGES range_value_t<_Rng>, _Alloc>;
1865-
#endif // __cpp_lib_containers_ranges
1865+
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)
18661866

18671867
template <class _Ty, class _Alloc>
18681868
void swap(list<_Ty, _Alloc>& _Left, list<_Ty, _Alloc>& _Right) noexcept /* strengthened */ {

0 commit comments

Comments
 (0)