clingo: patch clingo to allow for build with modern msvc (#41188)

This commit is contained in:
John W. Parent 2023-12-15 12:43:08 -05:00 committed by GitHub
parent 0efd5287c4
commit 165c6cef08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From c84b07de81cc24e9ac411fc404c54a9a5120029c Mon Sep 17 00:00:00 2001
From: Benjamin Kaufmann <benjamin.kaufmann@teufel.de>
Date: Wed, 22 Nov 2023 08:13:46 +0100
Subject: [PATCH] mt: Make condition_variable::native_handle() conditional.
* According to the C++ standard, the presence and semantics of
std::condition_variable::native_handle (and native_handle_type) is
implementation-defined. E.g., starting with VS 2022 17.8, Microsoft's
implementation no longer provides them at all.
---
clasp/mt/mutex.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clasp/clasp/mt/mutex.h b/clasp/clasp/mt/mutex.h
index 2439888..ade899c 100644
--- a/clasp/clasp/mt/mutex.h
+++ b/clasp/clasp/mt/mutex.h
@@ -39,7 +39,11 @@ struct condition_variable : private std::condition_variable {
using base_type::notify_one;
using base_type::notify_all;
using base_type::wait;
- using base_type::native_handle;
+
+ template <typename X = std::condition_variable>
+ inline auto native_handle() -> typename X::native_handle_type {
+ return X::native_handle();
+ }
inline bool wait_for(unique_lock<mutex>& lock, double timeInSecs) {
return base_type::wait_for(lock, std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(timeInSecs)))

View File

@ -70,6 +70,7 @@ class Clingo(CMakePackage):
patch("python38.patch", when="@5.3:5.4.0")
patch("size-t.patch", when="%msvc")
patch("vs2022.patch", when="%msvc@19.30:")
patch("clingo_msc_1938_native_handle.patch", when="%msvc@19.38:")
# TODO: Simplify this after Spack 0.21 release. The old concretizer has problems with
# py-setuptools ^python@3.6, so we only apply the distutils -> setuptools patch for Python 3.12