Skip to content

Commit 9c68fbd

Browse files
committed
Fix various compiler warnings
These solve warnings when compiled with gcc 14 using a set of warnings enabled that we use in one of our projects: -Wall -Wnon-virtual-dtor -Wzero-as-null-pointer-constant -Wduplicated-branches -Wundef -Wvla -Wpointer-arith -Wextra -Wno-unused-parameter
1 parent ae52796 commit 9c68fbd

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

include/xtensor/xassign.hpp

+15-10
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,21 @@ namespace xt
456456
constexpr bool simd_strided_assign = traits::simd_strided_assign();
457457
if (linear_assign)
458458
{
459-
if (simd_linear_assign || traits::simd_linear_assign(de1, de2))
460-
{
461-
// Do not use linear_assigner<true> here since it will make the compiler
462-
// instantiate this branch even if the runtime condition is false, resulting
463-
// in compilation error for expressions that do not provide a SIMD interface.
464-
// simd_assign is true if simd_linear_assign() or simd_linear_assign(de1, de2)
465-
// is true.
466-
linear_assigner<simd_assign>::run(de1, de2);
467-
}
468-
else
459+
// Do not use linear_assigner<true> here since it will make the compiler
460+
// instantiate this branch even if the runtime condition is false, resulting
461+
// in compilation error for expressions that do not provide a SIMD interface.
462+
// simd_assign is true if simd_linear_assign() or simd_linear_assign(de1, de2)
463+
// is true.
464+
if constexpr(simd_assign) {
465+
if(simd_linear_assign || traits::simd_linear_assign(de1, de2))
466+
{
467+
linear_assigner<true>::run(de1, de2);
468+
}
469+
else
470+
{
471+
linear_assigner<false>::run(de1, de2);
472+
}
473+
} else
469474
{
470475
linear_assigner<false>::run(de1, de2);
471476
}

include/xtensor/xfixed.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ namespace xt
153153
(L == layout_type::row_major) || (L == layout_type::column_major),
154154
"Layout not supported for fixed array"
155155
);
156-
#if (_MSC_VER >= 1910)
156+
#if (defined(_MSC_VER_) && _MSC_VER >= 1910)
157157
using temp_type = std::index_sequence<X...>;
158158
return R({workaround::get_computed_strides<L, I, temp_type>(shape[I] == 1)...});
159159
#else

include/xtensor/xsort.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,6 @@ namespace xt
12421242
template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL, class E>
12431243
inline auto argmin(const xexpression<E>& e)
12441244
{
1245-
using value_type = typename E::value_type;
12461245
auto&& ed = eval(e.derived_cast());
12471246
auto begin = ed.template begin<L>();
12481247
auto end = ed.template end<L>();
@@ -1272,7 +1271,6 @@ namespace xt
12721271
template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL, class E>
12731272
inline auto argmax(const xexpression<E>& e)
12741273
{
1275-
using value_type = typename E::value_type;
12761274
auto&& ed = eval(e.derived_cast());
12771275
auto begin = ed.template begin<L>();
12781276
auto end = ed.template end<L>();

0 commit comments

Comments
 (0)