Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable __cpp_lib_concepts for EDG, part 3 #4298

Merged
merged 18 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5e05034
[Mechanical] Replace uses of `__cpp_lib_concepts`
cpplearner Jan 3, 2024
ded27f5
Cleanup mentions of GH-395
cpplearner Jan 3, 2024
221218d
Remove another use of __cpp_lib_concepts
cpplearner Jan 3, 2024
7687eec
Remove redundant preprocessor conditions
cpplearner Jan 3, 2024
ba1dd83
Remove even more redundant preprocessor conditions
cpplearner Jan 3, 2024
730bca0
Remove even more redundant preprocessor conditions in tests
cpplearner Jan 4, 2024
e303104
Remove still more redundant preprocessor conditions in tests
cpplearner Jan 4, 2024
6f0a1fc
Clang-format
cpplearner Jan 4, 2024
4830861
Merge branch 'main' into edg-concepts-3
cpplearner Feb 2, 2024
796bf7d
Remove newly-introduced `__cpp_lib_concepts`
cpplearner Feb 2, 2024
76890e5
Remove stray `#else`
cpplearner Feb 2, 2024
bb1fd88
Fix mechanical replacement damage in VSO_0157762_feature_test_macros.
StephanTLavavej Feb 4, 2024
0be9d75
Cleanup: Fuse adjacent Standard mode regions.
StephanTLavavej Feb 4, 2024
b2e9939
Cleanup: Fuse `_HAS_CXX20 / !_HAS_CXX20` blocks in `__msvc_int128.hpp`.
StephanTLavavej Feb 4, 2024
ddc7acd
Cleanup: Fuse 3 `_HAS_CXX20 / !_HAS_CXX20` blocks in `P1522R1_differe…
StephanTLavavej Feb 4, 2024
546837b
Cleanup: Fuse `operator!=` with the other `!_HAS_CXX20` operators.
StephanTLavavej Feb 4, 2024
d275c20
Cleanup: Adjust the Standard mode warning in `<concepts>` to the usua…
StephanTLavavej Feb 4, 2024
e656fba
Cleanup: Consistently comment `_HAS_CXXnn` instead of `implementing R…
StephanTLavavej Feb 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ namespace chrono {
return !(_Left < _Right);
}

#ifdef __cpp_lib_concepts
#if _HAS_CXX20
_EXPORT_STD template <class _Rep1, class _Period1, class _Rep2, class _Period2>
requires three_way_comparable<typename common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>::rep>
_NODISCARD constexpr auto operator<=>(const duration<_Rep1, _Period1>& _Left,
Expand All @@ -414,7 +414,7 @@ namespace chrono {
using _CT = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
return _CT(_Left).count() <=> _CT(_Right).count();
}
#endif // defined(__cpp_lib_concepts)
#endif // _HAS_CXX20

_EXPORT_STD template <class _To, class _Rep, class _Period, enable_if_t<_Is_duration_v<_To>, int> /* = 0 */>
_NODISCARD constexpr _To duration_cast(const duration<_Rep, _Period>& _Dur) noexcept(
Expand Down Expand Up @@ -593,14 +593,14 @@ namespace chrono {
return !(_Left < _Right);
}

#ifdef __cpp_lib_concepts
#if _HAS_CXX20
_EXPORT_STD template <class _Clock, class _Duration1, three_way_comparable_with<_Duration1> _Duration2>
_NODISCARD constexpr auto
operator<=>(const time_point<_Clock, _Duration1>& _Left, const time_point<_Clock, _Duration2>& _Right) noexcept(
is_arithmetic_v<typename _Duration1::rep> && is_arithmetic_v<typename _Duration2::rep>) /* strengthened */ {
return _Left.time_since_epoch() <=> _Right.time_since_epoch();
}
#endif // defined(__cpp_lib_concepts)
#endif // _HAS_CXX20

_EXPORT_STD template <class _To, class _Clock, class _Duration, enable_if_t<_Is_duration_v<_To>, int> = 0>
_NODISCARD constexpr time_point<_Clock, _To> time_point_cast(const time_point<_Clock, _Duration>& _Time) noexcept(
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/__msvc_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX20 || !defined(__cpp_lib_concepts) // TRANSITION, GH-395
#if !_HAS_CXX20
#error The contents of <format> are only available with C++20. (Also, you should not include this internal header.)
#endif // !_HAS_CXX20 || !defined(__cpp_lib_concepts)
#endif // !_HAS_CXX20

#include <concepts>
#include <cstddef>
Expand Down
12 changes: 4 additions & 8 deletions stl/inc/__msvc_int128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@

#if _HAS_CXX20
#include <compare>
#include <concepts>
#define _TEMPLATE_CLASS_INTEGRAL(type) template <integral type>
#define _ZERO_OR_NO_INIT
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
#define _TEMPLATE_CLASS_INTEGRAL(type) template <class type, enable_if_t<is_integral_v<type>, int> = 0>
#define _ZERO_OR_NO_INIT \
{} // Trivial default initialization is not allowed in constexpr functions before C++20.
#endif // ^^^ !_HAS_CXX20 ^^^

#ifdef __cpp_lib_concepts
#include <concepts>
#define _TEMPLATE_CLASS_INTEGRAL(type) template <integral type>
#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv
#define _TEMPLATE_CLASS_INTEGRAL(type) template <class type, enable_if_t<is_integral_v<type>, int> = 0>
#endif // ^^^ !defined(__cpp_lib_concepts) ^^^

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down Expand Up @@ -308,7 +304,7 @@ struct

_TEMPLATE_CLASS_INTEGRAL(_Ty)
constexpr _Base128(const _Ty _Val) noexcept : _Word{static_cast<uint64_t>(_Val)} {
#ifdef __cpp_lib_concepts
#if _HAS_CXX20
if constexpr (signed_integral<_Ty>)
#else
if constexpr (is_signed_v<_Ty>)
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/__msvc_iter_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ _EXPORT_STD struct bidirectional_iterator_tag : forward_iterator_tag {};

_EXPORT_STD struct random_access_iterator_tag : bidirectional_iterator_tag {};

#ifdef __cpp_lib_concepts
#if _HAS_CXX20
_EXPORT_STD struct contiguous_iterator_tag : random_access_iterator_tag {};

template <class _Ty>
Expand Down Expand Up @@ -482,7 +482,7 @@ template <class _It, class _Se, ranges::subrange_kind _Ki>
struct tuple_element<1, const ranges::subrange<_It, _Se, _Ki>> {
using type = _Se;
};
#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
template <class, class = void>
struct _Iterator_traits_base {}; // empty for non-iterators

Expand Down Expand Up @@ -515,7 +515,7 @@ struct iterator_traits : _Iterator_traits_base<_Iter> {}; // get traits from ite

template <class _Ty>
struct iterator_traits<_Ty*> : _Iterator_traits_pointer_base<_Ty> {}; // get traits from pointer, if possible
#endif // ^^^ !defined(__cpp_lib_concepts) ^^^
#endif // ^^^ !_HAS_CXX20 ^^^
_STD_END

#pragma pop_macro("new")
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/__msvc_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#ifndef __cpp_lib_concepts // note: <format> includes this header in C++20 mode
#if !_HAS_CXX20 // note: <format> includes this header in C++20 mode
#error The contents of <print> are available only with C++23. (Also, you should not include this internal header.)
#endif // ^^^ !defined(__cpp_lib_concepts) ^^^
#endif // ^^^ !_HAS_CXX20 ^^^

#include <cstdio>
#include <xfilesystem_abi.h>
Expand Down
Loading