Skip to content

Commit 5caa64d

Browse files
Alex-PLACETCopilot
andauthored
Update CI: Add clang 22 (#2905)
# Checklist - [x] The title and commit message(s) are descriptive. - [x] Small commits made to fix your PR have been squashed to avoid history pollution. - [x] Tests have been added for new features or bug fixes. - [x] API of new functions and classes are documented. # Description Add clang 22 and gcc 15 in the CI --------- Co-authored-by: Alexis Placet <2400067+Alex-PLACET@users.noreply.github.com> Co-authored-by: Copilot <copilot@github.com>
1 parent 42d124c commit 5caa64d

6 files changed

Lines changed: 31 additions & 19 deletions

File tree

.github/workflows/linux.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,25 @@ jobs:
2323
- {compiler: clang, version: '19', name: assert, flags: -DXTENSOR_ENABLE_ASSERT=ON}
2424
- {compiler: clang, version: '20', name: column-major, flags: -DDEFAULT_COLUMN_MAJOR=ON}
2525
- {compiler: clang, version: '21', name: assert, flags: -DXTENSOR_ENABLE_ASSERT=ON}
26+
- {compiler: clang, version: '21', name: column-major, flags: -DDEFAULT_COLUMN_MAJOR=ON}
27+
- {compiler: clang, version: '22', name: assert, flags: -DXTENSOR_ENABLE_ASSERT=ON}
28+
- {compiler: clang, version: '22', name: column-major, flags: -DDEFAULT_COLUMN_MAJOR=ON}
2629
- {compiler: gcc, version: '11', name: openmp, flags: -DXTENSOR_USE_OPENMP=ON}
2730
- {compiler: gcc, version: '11', name: noexcept, flags: -DXTENSOR_DISABLE_EXCEPTIONS=ON}
2831
- {compiler: gcc, version: '12', name: xsimd, flags: -DXTENSOR_USE_XSIMD=ON}
2932
- {compiler: gcc, version: '13', name: xsimd-tbb, flags: -DXTENSOR_USE_XSIMD=ON -DXTENSOR_USE_TBB=ON}
3033
- {compiler: gcc, version: '13', name: tbb, flags: -DXTENSOR_USE_TBB=ON -DTBB_INCLUDE_DIR=$CONDA_PREFIX/include -DTBB_LIBRARY=$CONDA_PREFIX/lib}
3134
- {compiler: gcc, version: '14', name: xsimd-tbb, flags: -DXTENSOR_USE_XSIMD=ON -DXTENSOR_USE_TBB=ON}
3235
- {compiler: gcc, version: '14', name: tbb, flags: -DXTENSOR_USE_TBB=ON -DTBB_INCLUDE_DIR=$CONDA_PREFIX/include -DTBB_LIBRARY=$CONDA_PREFIX/lib}
36+
# TODO: Activate following gcc versions when switching github runner to ubuntu 26.04
37+
# - {compiler: gcc, version: '15', name: xsimd-tbb, flags: -DXTENSOR_USE_XSIMD=ON -DXTENSOR_USE_TBB=ON}
38+
# - {compiler: gcc, version: '15', name: tbb, flags: -DXTENSOR_USE_TBB=ON -DTBB_INCLUDE_DIR=$CONDA_PREFIX/include -DTBB_LIBRARY=$CONDA_PREFIX/lib}
39+
# - {compiler: gcc, version: '16', name: xsimd-tbb, flags: -DXTENSOR_USE_XSIMD=ON -DXTENSOR_USE_TBB=ON}
40+
# - {compiler: gcc, version: '16', name: tbb, flags: -DXTENSOR_USE_TBB=ON -DTBB_INCLUDE_DIR=$CONDA_PREFIX/include -DTBB_LIBRARY=$CONDA_PREFIX/lib}
3341
steps:
3442
- name: Install GCC
3543
if: matrix.sys.compiler == 'gcc'
36-
uses: egor-tensin/setup-gcc@v1
44+
uses: egor-tensin/setup-gcc@v2
3745
with:
3846
version: ${{matrix.sys.version}}
3947
platform: x64
@@ -53,7 +61,7 @@ jobs:
5361
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-${{matrix.sys.version}}
5462
5563
- name: Checkout code
56-
uses: actions/checkout@v4
64+
uses: actions/checkout@v6
5765

5866
- name: Set conda environment
5967
uses: mamba-org/setup-micromamba@main

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
14-
- uses: pre-commit/action@v3.0.0
13+
- uses: actions/checkout@v6
14+
- uses: pre-commit/action@v3.0.1
1515

1616
include-check:
1717
runs-on: ubuntu-latest

include/xtensor/generators/xbuilder.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,18 +574,18 @@ namespace xt
574574
}
575575
const auto& shape = arr.shape();
576576
const size_t stride = std::accumulate(
577-
shape.begin() + i + 1,
577+
shape.begin() + static_cast<std::ptrdiff_t>(i) + 1,
578578
shape.end(),
579-
1,
579+
size_t(1),
580580
std::multiplies<size_t>()
581581
);
582-
const auto len = (*(first + i + after_axis));
582+
const auto len = (*(first + static_cast<std::ptrdiff_t>(i + after_axis)));
583583
offset += len * stride;
584584
}
585-
const auto element = arr.begin() + offset;
585+
const auto element = arr.begin() + static_cast<std::ptrdiff_t>(offset);
586586
return *element;
587587
};
588-
size_type i = *(first + axis);
588+
size_type i = *(first + static_cast<std::ptrdiff_t>(axis));
589589
return apply<value_type>(i, get_item, t);
590590
}
591591
};

include/xtensor/views/index_mapper.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,9 @@ namespace xt
402402
{
403403
constexpr size_t n_indices_full = n_indices_full_v<FirstIndice, OtherIndices...>;
404404

405-
constexpr size_t underlying_n_dimensions = xt::static_dimension<
406-
typename std::decay_t<UnderlyingContainer>::shape_type>::value;
405+
constexpr size_t underlying_n_dimensions = static_cast<size_t>(
406+
xt::static_dimension<typename std::decay_t<UnderlyingContainer>::shape_type>::value
407+
);
407408

408409
// If there is too many indices, we need to drop the first ones.
409410
// If the number of dimensions of the underlying container is known at compile time we can drop them
@@ -462,7 +463,9 @@ namespace xt
462463
const view_type& view
463464
) const -> conditional_reference<IS_CONST>
464465
{
465-
constexpr size_t n_indices_full = n_indices_full_v<>;
466+
// Work around compilers failing to deduce nb_integral_slices as a non-type template argument inline
467+
// (error: use of variable template 'n_indices_full_v' requires template arguments)
468+
constexpr size_t n_indices_full = nb_integral_slices;
466469

467470
return map_all_indices(
468471
is_const,
@@ -517,8 +520,9 @@ namespace xt
517520
}
518521
else
519522
{
523+
using slice_size_type = typename current_slice::size_type;
520524
assert(i < slice.size());
521-
return size_t(slice(i));
525+
return size_t(slice(static_cast<slice_size_type>(i)));
522526
}
523527
}
524528
else

include/xtensor/views/xslice.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ namespace xt
708708

709709
type operator()(T t)
710710
{
711-
return (xtl::is_integral<T>::value) ? static_cast<type>(t) : t;
711+
return static_cast<type>(t);
712712
}
713713
};
714714

@@ -770,7 +770,7 @@ namespace xt
770770
{
771771
if constexpr (is_xslice<S>::value)
772772
{
773-
return slice.size();
773+
return static_cast<std::size_t>(slice.size());
774774
}
775775
else
776776
{
@@ -787,7 +787,7 @@ namespace xt
787787
{
788788
if constexpr (is_xslice<S>::value)
789789
{
790-
return slice.step_size(idx);
790+
return static_cast<std::size_t>(slice.step_size(idx));
791791
}
792792
else
793793
{
@@ -800,7 +800,7 @@ namespace xt
800800
{
801801
if constexpr (is_xslice<S>::value)
802802
{
803-
return slice.step_size(idx, n);
803+
return static_cast<std::size_t>(slice.step_size(idx, n));
804804
}
805805
else
806806
{
@@ -818,7 +818,7 @@ namespace xt
818818
if constexpr (is_xslice<S>::value)
819819
{
820820
using ST = typename S::size_type;
821-
return slice(static_cast<ST>(i));
821+
return static_cast<std::size_t>(slice(static_cast<ST>(i)));
822822
}
823823
else
824824
{

include/xtensor/views/xstrided_view.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ namespace xt
833833
if (iter != std::end(shape))
834834
{
835835
const auto total = std::accumulate(shape.cbegin(), shape.cend(), -1, std::multiplies<int>{});
836-
const auto missing_dimension = size / total;
836+
const auto missing_dimension = size / static_cast<size_t>(total);
837837
(*iter) = static_cast<value_type>(missing_dimension);
838838
}
839839
}

0 commit comments

Comments
 (0)