Skip to content

Commit d03043b

Browse files
authored
Merge pull request #2251 from adriendelsalle/drop-old-clang-support
Drop support of 3.* Clang versions
2 parents 2ed3b10 + 8534a0b commit d03043b

19 files changed

Lines changed: 13 additions & 588 deletions

docs/source/compilers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Workarounds for this compiler bug arise in various files of the code base.
7070
Everywhere, the handling of `Clang < 3.8` is wrapped with checks for the
7171
``X_OLD_CLANG`` macro.
7272

73+
The support of `Clang < 4.0` is dropped in xtensor 0.22.
74+
7375
GCC < 5.1 and ``std::is_trivially_default_constructible``
7476
---------------------------------------------------------
7577

include/xtensor/xadapt.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -396,21 +396,12 @@ namespace xt
396396
return return_type(buffer_type(pointer, detail::fixed_compute_size<fixed_shape<X...>>::value));
397397
}
398398

399-
#ifndef X_OLD_CLANG
400399
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C, class T, std::size_t N>
401400
inline auto adapt(C&& ptr, const T(&shape)[N])
402401
{
403402
using shape_type = std::array<std::size_t, N>;
404403
return adapt(std::forward<C>(ptr), xtl::forward_sequence<shape_type, decltype(shape)>(shape));
405404
}
406-
#else
407-
template <layout_type L = XTENSOR_DEFAULT_LAYOUT, class C>
408-
inline auto adapt(C&& ptr, std::initializer_list<std::size_t> shape)
409-
{
410-
using shape_type = xt::dynamic_shape<std::size_t>;
411-
return adapt(std::forward<C>(ptr), xtl::forward_sequence<shape_type, decltype(shape)>(shape));
412-
}
413-
#endif
414405

415406
/*****************************
416407
* smart_ptr adapter builder *
@@ -514,7 +505,6 @@ namespace xt
514505
);
515506
}
516507

517-
#ifndef X_OLD_CLANG
518508
/**
519509
* Adapt a smart pointer to a typed memory block (unique_ptr or shared_ptr)
520510
*
@@ -608,7 +598,6 @@ namespace xt
608598
l
609599
);
610600
}
611-
#endif
612601
}
613602

614603
#endif

include/xtensor/xbroadcast.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ namespace xt
3838
template <class E, class S>
3939
auto broadcast(E&& e, const S& s);
4040

41-
#ifdef X_OLD_CLANG
42-
template <class E, class I>
43-
auto broadcast(E&& e, std::initializer_list<I> s);
44-
#else
4541
template <class E, class I, std::size_t L>
4642
auto broadcast(E&& e, const I (&s)[L]);
47-
#endif
4843

4944
/*************************
5045
* xbroadcast extensions *
@@ -243,23 +238,13 @@ namespace xt
243238
return broadcast_type(std::forward<E>(e), xtl::forward_sequence<shape_type, decltype(s)>(s));
244239
}
245240

246-
#ifdef X_OLD_CLANG
247-
template <class E, class I>
248-
inline auto broadcast(E&& e, std::initializer_list<I> s)
249-
{
250-
using broadcast_type = xbroadcast<const_xclosure_t<E>, std::vector<std::size_t>>;
251-
using shape_type = typename broadcast_type::shape_type;
252-
return broadcast_type(std::forward<E>(e), xtl::forward_sequence<shape_type, decltype(s)>(s));
253-
}
254-
#else
255241
template <class E, class I, std::size_t L>
256242
inline auto broadcast(E&& e, const I (&s)[L])
257243
{
258244
using broadcast_type = xbroadcast<const_xclosure_t<E>, std::array<std::size_t, L>>;
259245
using shape_type = typename broadcast_type::shape_type;
260246
return broadcast_type(std::forward<E>(e), xtl::forward_sequence<shape_type, decltype(s)>(s));
261247
}
262-
#endif
263248

264249
/*****************************
265250
* xbroadcast implementation *

include/xtensor/xbuilder.hpp

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
#include <functional>
2222
#include <utility>
2323
#include <vector>
24-
#ifdef X_OLD_CLANG
25-
#include <initializer_list>
26-
#endif
2724

2825
#include <xtl/xclosure.hpp>
2926
#include <xtl/xsequence.hpp>
@@ -51,19 +48,11 @@ namespace xt
5148
return broadcast(T(1), std::forward<S>(shape));
5249
}
5350

54-
#ifdef X_OLD_CLANG
55-
template <class T, class I>
56-
inline auto ones(std::initializer_list<I> shape) noexcept
57-
{
58-
return broadcast(T(1), shape);
59-
}
60-
#else
6151
template <class T, class I, std::size_t L>
6252
inline auto ones(const I (&shape)[L]) noexcept
6353
{
6454
return broadcast(T(1), shape);
6555
}
66-
#endif
6756

6857
/*********
6958
* zeros *
@@ -79,19 +68,11 @@ namespace xt
7968
return broadcast(T(0), std::forward<S>(shape));
8069
}
8170

82-
#ifdef X_OLD_CLANG
83-
template <class T, class I>
84-
inline auto zeros(std::initializer_list<I> shape) noexcept
85-
{
86-
return broadcast(T(0), shape);
87-
}
88-
#else
8971
template <class T, class I, std::size_t L>
9072
inline auto zeros(const I (&shape)[L]) noexcept
9173
{
9274
return broadcast(T(0), shape);
9375
}
94-
#endif
9576

9677
/**
9778
* Create a xcontainer (xarray, xtensor or xtensor_fixed) with uninitialized values of
@@ -117,20 +98,12 @@ namespace xt
11798
return xtensor<T, N, L>(xtl::forward_sequence<shape_type, decltype(shape)>(shape));
11899
}
119100

120-
#ifndef X_OLD_CLANG
121101
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, class I, std::size_t N>
122102
inline xtensor<T, N, L> empty(const I(&shape)[N])
123103
{
124104
using shape_type = typename xtensor<T, N>::shape_type;
125105
return xtensor<T, N, L>(xtl::forward_sequence<shape_type, decltype(shape)>(shape));
126106
}
127-
#else
128-
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, class I>
129-
inline xarray<T, L> empty(const std::initializer_list<I>& init)
130-
{
131-
return xarray<T, L>::from_shape(init);
132-
}
133-
#endif
134107

135108
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, std::size_t... N>
136109
inline xtensor_fixed<T, fixed_shape<N...>, L> empty(const fixed_shape<N...>& /*shape*/)
@@ -900,7 +873,7 @@ namespace xt
900873
template <std::size_t... I, class... E>
901874
inline auto meshgrid_impl(std::index_sequence<I...>, E&&... e) noexcept
902875
{
903-
#if defined X_OLD_CLANG || defined _MSC_VER
876+
#if defined _MSC_VER
904877
const std::array<std::size_t, sizeof...(E)> shape = {e.shape()[0]...};
905878
return std::make_tuple(
906879
detail::make_xgenerator(

include/xtensor/xgenerator.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,23 +484,13 @@ namespace xt
484484

485485
namespace detail
486486
{
487-
#ifdef X_OLD_CLANG
488-
template <class Functor, class I>
489-
inline auto make_xgenerator(Functor&& f, std::initializer_list<I> shape) noexcept
490-
{
491-
using shape_type = std::vector<std::size_t>;
492-
using type = xgenerator<Functor, typename Functor::value_type, shape_type>;
493-
return type(std::forward<Functor>(f), xtl::forward_sequence<shape_type, decltype(shape)>(shape));
494-
}
495-
#else
496487
template <class Functor, class I, std::size_t L>
497488
inline auto make_xgenerator(Functor&& f, const I (&shape)[L]) noexcept
498489
{
499490
using shape_type = std::array<std::size_t, L>;
500491
using type = xgenerator<Functor, typename Functor::value_type, shape_type>;
501492
return type(std::forward<Functor>(f), xtl::forward_sequence<shape_type, decltype(shape)>(shape));
502493
}
503-
#endif
504494

505495
template <class Functor, class S>
506496
inline auto make_xgenerator(Functor&& f, S&& shape) noexcept

include/xtensor/xindex_view.hpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -753,26 +753,13 @@ namespace xt
753753
using view_type = xindex_view<xclosure_t<E>, std::decay_t<I>>;
754754
return view_type(std::forward<E>(e), std::forward<I>(indices));
755755
}
756-
#ifdef X_OLD_CLANG
757-
template <class E, class I>
758-
inline auto index_view(E&& e, std::initializer_list<std::initializer_list<I>> indices) noexcept
759-
{
760-
std::vector<xindex> idx;
761-
for (auto it = indices.begin(); it != indices.end(); ++it)
762-
{
763-
idx.emplace_back(xindex(it->begin(), it->end()));
764-
}
765-
using view_type = xindex_view<xclosure_t<E>, std::vector<xindex>>;
766-
return view_type(std::forward<E>(e), std::move(idx));
767-
}
768-
#else
756+
769757
template <class E, std::size_t L>
770758
inline auto index_view(E&& e, const xindex (&indices)[L]) noexcept
771759
{
772760
using view_type = xindex_view<xclosure_t<E>, std::array<xindex, L>>;
773761
return view_type(std::forward<E>(e), to_array(indices));
774762
}
775-
#endif
776763

777764
/**
778765
* @brief creates a view into \a e filtered by \a condition.

include/xtensor/xmanipulation.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -238,20 +238,11 @@ namespace xt
238238
}
239239

240240
/// @cond DOXYGEN_INCLUDE_SFINAE
241-
#ifdef X_OLD_CLANG
242-
template <class E, class I, class Tag = check_policy::none>
243-
inline auto transpose(E&& e, std::initializer_list<I> permutation, Tag check_policy = Tag())
244-
{
245-
dynamic_shape<I> perm(permutation);
246-
return detail::transpose_impl(std::forward<E>(e), std::move(perm), check_policy);
247-
}
248-
#else
249241
template <class E, class I, std::size_t N, class Tag = check_policy::none>
250242
inline auto transpose(E&& e, const I(&permutation)[N], Tag check_policy = Tag())
251243
{
252244
return detail::transpose_impl(std::forward<E>(e), permutation, check_policy);
253245
}
254-
#endif
255246
/// @endcond
256247

257248
/************************************
@@ -449,21 +440,12 @@ namespace xt
449440
}
450441

451442
/// @cond DOXYGEN_INCLUDE_SFINAE
452-
#ifdef X_OLD_CLANG
453-
template <class E, class I, class Tag = check_policy::none>
454-
inline auto squeeze(E&& e, std::initializer_list<I> axis, Tag check_policy = Tag())
455-
{
456-
dynamic_shape<I> ax(axis);
457-
return detail::squeeze_impl(std::forward<E>(e), std::move(ax), check_policy);
458-
}
459-
#else
460443
template <class E, class I, std::size_t N, class Tag = check_policy::none>
461444
inline auto squeeze(E&& e, const I(&axis)[N], Tag check_policy = Tag())
462445
{
463446
using arr_t = std::array<I, N>;
464447
return detail::squeeze_impl(std::forward<E>(e), xtl::forward_sequence<arr_t, decltype(axis)>(axis), check_policy);
465448
}
466-
#endif
467449

468450
template <class E, class Tag = check_policy::none>
469451
inline auto squeeze(E&& e, std::size_t axis, Tag check_policy = Tag())

0 commit comments

Comments
 (0)