Skip to content

Commit

Permalink
[Mechanical] Replace uses of __cpp_lib_concepts
Browse files Browse the repository at this point in the history
The following substitutions are performed:

- `#elif _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#elif _HAS_CXX20`
- `#elif defined(__cpp_lib_concepts)` => `#elif _HAS_CXX20`
- `#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv` => `#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv`
- `#else // ^^^ _HAS_CXX20 && !defined(__cpp_lib_concepts) / !_HAS_CXX20 vvv` => `#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv`
- `#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv` => `#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv`
- `#endif // !_HAS_CXX20 || !defined(__cpp_lib_concepts)` => `#endif // !_HAS_CXX20`
- `#endif // ^^^ !defined(__cpp_lib_concepts) ^^^` => `#endif // ^^^ !_HAS_CXX20 ^^^`
- `#endif // ^^^ defined(__cpp_lib_concepts) ^^^` => `#endif // ^^^ _HAS_CXX20 ^^^`
- `#endif // _HAS_CXX20 && defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX20`
- `#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX23`
- `#endif // _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#endif // _HAS_CXX23`
- `#endif // __cpp_lib_concepts` => `#endif // _HAS_CXX20`
- `#endif // defined(__cpp_lib_concepts)` => `#endif // _HAS_CXX20`
- `#endif // defined(__cpp_lib_concepts) && _HAS_CXX23` => `#endif // _HAS_CXX23`
- `#if !_HAS_CXX20 || !defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#if !_HAS_CXX20`
- `#if !_HAS_CXX23 || !defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#if !_HAS_CXX23`
- `#if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#if _HAS_CXX20`
- `#if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#if _HAS_CXX23`
- `#if _HAS_CXX23 && defined(__cpp_lib_concepts)` => `#if _HAS_CXX23`
- `#if defined(__cpp_lib_concepts) && _HAS_CXX23` => `#if _HAS_CXX23`
- `#if defined(__cpp_lib_concepts) // TRANSITION, microsoftGH-395` => `#if _HAS_CXX20`
- `#if defined(__cpp_lib_concepts)` => `#if _HAS_CXX20`
- `#ifdef __cpp_lib_concepts // TRANSITION, microsoftGH-395` => `#if _HAS_CXX20`
- `#ifdef __cpp_lib_concepts` => `#if _HAS_CXX20`
- `#ifndef __cpp_lib_concepts` => `#if !_HAS_CXX20`
  • Loading branch information
cpplearner committed Jan 4, 2024
1 parent a888880 commit 5e05034
Show file tree
Hide file tree
Showing 83 changed files with 955 additions and 955 deletions.
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
8 changes: 4 additions & 4 deletions stl/inc/__msvc_int128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
{} // Trivial default initialization is not allowed in constexpr functions before C++20.
#endif // ^^^ !_HAS_CXX20 ^^^

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

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
Expand Down Expand Up @@ -308,7 +308,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
2 changes: 1 addition & 1 deletion stl/inc/__msvc_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#ifndef __cpp_lib_concepts // 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

0 comments on commit 5e05034

Please sign in to comment.