summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn W. Parent <45471568+johnwparent@users.noreply.github.com>2023-12-15 12:43:08 -0500
committerGitHub <noreply@github.com>2023-12-15 10:43:08 -0700
commit165c6cef08fabc7a869436ca2f06cbab7a52706b (patch)
tree118e808d5df585cb818da0669d07947c71274322
parent0efd5287c4b95eb01441b9552743843f77fbedd7 (diff)
downloadspack-165c6cef08fabc7a869436ca2f06cbab7a52706b.tar.gz
spack-165c6cef08fabc7a869436ca2f06cbab7a52706b.tar.bz2
spack-165c6cef08fabc7a869436ca2f06cbab7a52706b.tar.xz
spack-165c6cef08fabc7a869436ca2f06cbab7a52706b.zip
clingo: patch clingo to allow for build with modern msvc (#41188)
-rw-r--r--var/spack/repos/builtin/packages/clingo/clingo_msc_1938_native_handle.patch30
-rw-r--r--var/spack/repos/builtin/packages/clingo/package.py1
2 files changed, 31 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/clingo/clingo_msc_1938_native_handle.patch b/var/spack/repos/builtin/packages/clingo/clingo_msc_1938_native_handle.patch
new file mode 100644
index 0000000000..774169557c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/clingo/clingo_msc_1938_native_handle.patch
@@ -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)))
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
index eaf4c6ad92..64bc9b700b 100644
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -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