From 4c9c94be5f42805e6e2a3256a145604f92832952 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Mon, 21 Nov 2022 18:29:10 +0800 Subject: [PATCH 1/4] Add missing includes for GCC 12 --- cppwinrt/pch.h | 1 + cppwinrt/text_writer.h | 1 + strings/base_includes.h | 1 + 3 files changed, 3 insertions(+) diff --git a/cppwinrt/pch.h b/cppwinrt/pch.h index 335324767..e6a31443e 100644 --- a/cppwinrt/pch.h +++ b/cppwinrt/pch.h @@ -1,5 +1,6 @@ #pragma once +#include #include "cmd_reader.h" #include #include "task_group.h" diff --git a/cppwinrt/text_writer.h b/cppwinrt/text_writer.h index 50e6e6b15..3e210db83 100644 --- a/cppwinrt/text_writer.h +++ b/cppwinrt/text_writer.h @@ -6,6 +6,7 @@ #include #include #include +#include namespace cppwinrt { diff --git a/strings/base_includes.h b/strings/base_includes.h index 10518a705..6a1af2e0e 100644 --- a/strings/base_includes.h +++ b/strings/base_includes.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include From b34c5e008d6b032640bbe4d337ace7678b274b6b Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Mon, 21 Nov 2022 18:29:15 +0800 Subject: [PATCH 2/4] Fix coroutine support check for GCC 12 and improve error reporting `#include ` is needed before using `__cpp_lib_coroutine`, but it is technically only available since C++20. --- strings/base_includes.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/strings/base_includes.h b/strings/base_includes.h index 6a1af2e0e..54edca841 100644 --- a/strings/base_includes.h +++ b/strings/base_includes.h @@ -21,6 +21,10 @@ #include #include +#if __has_include() +#include +#endif + #if __has_include() #define WINRT_IMPL_NUMERICS #include @@ -51,7 +55,7 @@ namespace winrt::impl using suspend_never = std::suspend_never; } -#else +#elif __has_include() #include @@ -64,4 +68,6 @@ namespace winrt::impl using suspend_never = std::experimental::suspend_never; } +#else +#error C++/WinRT requires coroutine support, which is currently missing. Try enabling C++20 in your compiler. #endif From 59e4607f87939b82c8c33aa6570e6985aff6f294 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Mon, 21 Nov 2022 18:30:42 +0800 Subject: [PATCH 3/4] winrt::clock: Add time_point_cast for GCC 12 --- strings/base_chrono.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/base_chrono.h b/strings/base_chrono.h index e8e5a1ee4..151246d46 100644 --- a/strings/base_chrono.h +++ b/strings/base_chrono.h @@ -47,7 +47,7 @@ WINRT_EXPORT namespace winrt static time_point from_time_t(time_t time) noexcept { - return from_sys(std::chrono::system_clock::from_time_t(time)); + return std::chrono::time_point_cast(from_sys(std::chrono::system_clock::from_time_t(time))); } static file_time to_file_time(time_point const& time) noexcept From 70a9a4e855528bf9e8f00e38503ba3d6e4071944 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Mon, 21 Nov 2022 18:30:51 +0800 Subject: [PATCH 4/4] Specify std namespace when using nullptr_t --- strings/base_string_operators.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/base_string_operators.h b/strings/base_string_operators.h index f9701aa4b..b00150f92 100644 --- a/strings/base_string_operators.h +++ b/strings/base_string_operators.h @@ -55,9 +55,9 @@ WINRT_EXPORT namespace winrt return left < std::wstring_view(right); } - bool operator<(hstring const& left, nullptr_t) = delete; + bool operator<(hstring const& left, std::nullptr_t) = delete; - bool operator<(nullptr_t, hstring const& right) = delete; + bool operator<(std::nullptr_t, hstring const& right) = delete; inline bool operator!=(hstring const& left, hstring const& right) noexcept { return !(left == right); } inline bool operator>(hstring const& left, hstring const& right) noexcept { return right < left; } inline bool operator<=(hstring const& left, hstring const& right) noexcept { return !(right < left); }