瀏覽代碼

xtensor: Fix 0.25.0 build failure with clang 19 (#8544)

* add patch for 0.25.0

* trigger ci for 0.25.0

* fix patch

* update xmake.lua, ci works well
Willaaaaaaa 1 月之前
父節點
當前提交
1a2fd0a3de
共有 2 個文件被更改,包括 51 次插入0 次删除
  1. 49 0
      packages/x/xtensor/patches/0.25.0/clang19_build.patch
  2. 2 0
      packages/x/xtensor/xmake.lua

+ 49 - 0
packages/x/xtensor/patches/0.25.0/clang19_build.patch

@@ -0,0 +1,49 @@
+diff --git a/include/xtensor/xexpression_traits.hpp b/include/xtensor/xexpression_traits.hpp
+index 205de67a..61f6620b 100644
+--- a/include/xtensor/xexpression_traits.hpp
++++ b/include/xtensor/xexpression_traits.hpp
+@@ -103,16 +103,14 @@ namespace xt
+             using type = xarray<T, L>;
+         };
+ 
+-#if defined(__GNUC__) && (__GNUC__ > 6)
+-#if __cplusplus == 201703L
++#ifdef __cpp_template_template_args
+         template <template <class, std::size_t, class, bool> class S, class X, std::size_t N, class A, bool Init>
+         struct xtype_for_shape<S<X, N, A, Init>>
+         {
+             template <class T, layout_type L>
+             using type = xarray<T, L>;
+         };
+-#endif  // __cplusplus == 201703L
+-#endif  // __GNUC__ && (__GNUC__ > 6)
++#endif  // __cpp_template_template_args
+ 
+         template <template <class, std::size_t> class S, class X, std::size_t N>
+         struct xtype_for_shape<S<X, N>>
+diff --git a/include/xtensor/xstorage.hpp b/include/xtensor/xstorage.hpp
+index ac179a85..39fb21c6 100644
+--- a/include/xtensor/xstorage.hpp
++++ b/include/xtensor/xstorage.hpp
+@@ -1638,7 +1638,7 @@ namespace xt
+     }
+ 
+ // Workaround for rebind_container problems on GCC 8 with C++17 enabled
+-#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
++#ifdef __cpp_template_template_args
+     template <class X, class T, std::size_t N>
+     struct rebind_container<X, aligned_array<T, N>>
+     {
+diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp
+index 137d0e70..d718bdce 100644
+--- a/include/xtensor/xutils.hpp
++++ b/include/xtensor/xutils.hpp
+@@ -872,7 +872,7 @@ namespace xt
+         using type = C<X, allocator>;
+     };
+ 
+-#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
++#ifdef __cpp_template_template_args
+     template <class X, class T, std::size_t N>
+     struct rebind_container<X, std::array<T, N>>
+     {

+ 2 - 0
packages/x/xtensor/xmake.lua

@@ -17,6 +17,8 @@ package("xtensor")
     add_versions("0.24.0", "37738aa0865350b39f048e638735c05d78b5331073b6329693e8b8f0902df713")
     add_versions("0.23.10", "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c")
 
+    add_patches("0.25.0", "patches/0.25.0/clang19_build.patch", "b40ef789b39dad40d8f97b73793a5d0377e6165f99a49a8fddde45ff66ed87a2")
+
     add_configs("simd", {description = "Enable SIMD acceleration ", default = true, type = "boolean"})
     add_configs("tbb", {description = "Enable parallelization using intel TBB", default = false, type = "boolean"})
     add_configs("openmp", {description = "Enable parallelization using OpenMP", default = false, type = "boolean"})