Skip to content

Commit 566b51b

Browse files
committed
Fixed static analysis build
1 parent 5df89c6 commit 566b51b

File tree

9 files changed

+465
-449
lines changed

9 files changed

+465
-449
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ repos:
1818
- id: detect-private-key
1919
- id: check-merge-conflict
2020
- repo: https://github.com/Lucas-C/pre-commit-hooks
21-
rev: v1.4.2
21+
rev: v1.5.4
2222
hooks:
2323
- id: forbid-tabs
2424
- id: remove-tabs
2525
args: [--whitespaces-count, '4']
2626
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
27-
rev: v2.7.0
27+
rev: v2.10.0
2828
hooks:
2929
- id: pretty-format-yaml
3030
args: [--autofix, --indent, '2']
@@ -41,7 +41,7 @@ repos:
4141
files: environment.yaml
4242
# Externally provided executables (so we can use them with editors as well).
4343
- repo: https://github.com/pre-commit/mirrors-clang-format
44-
rev: v15.0.7
44+
rev: v16.0.6
4545
hooks:
4646
- id: clang-format
4747
files: .*\.[hc]pp$

include/xtensor/xaccumulator.hpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ namespace xt
221221
// using return_type = std::conditional_t<std::is_same<init_type, void>::value, typename
222222
// std::decay_t<E>::value_type, init_type>;
223223

224-
using return_type = std::decay_t<decltype(std::declval<accumulate_functor_type>(
225-
)(std::declval<init_type>(), std::declval<expr_value_type>()))>;
224+
using return_type = std::decay_t<decltype(std::declval<accumulate_functor_type>()(
225+
std::declval<init_type>(),
226+
std::declval<expr_value_type>()
227+
))>;
226228

227229
using result_type = xaccumulator_return_type_t<std::decay_t<E>, return_type>;
228230

@@ -281,8 +283,10 @@ namespace xt
281283
{
282284
for (std::size_t j = 0; j < inner_loop_size; ++j)
283285
{
284-
res.storage()[pos + inner_stride] = xt::get<0>(f
285-
)(res.storage()[pos], res.storage()[pos + inner_stride]);
286+
res.storage()[pos + inner_stride] = xt::get<0>(f)(
287+
res.storage()[pos],
288+
res.storage()[pos + inner_stride]
289+
);
286290

287291
pos += outer_stride;
288292
}
@@ -298,8 +302,10 @@ namespace xt
298302
using init_type = typename F::init_value_type;
299303
using expr_value_type = typename std::decay_t<E>::value_type;
300304
using accumulate_functor_type = typename F::accumulate_functor_type;
301-
using return_type = std::decay_t<decltype(std::declval<accumulate_functor_type>(
302-
)(std::declval<init_type>(), std::declval<expr_value_type>()))>;
305+
using return_type = std::decay_t<decltype(std::declval<accumulate_functor_type>()(
306+
std::declval<init_type>(),
307+
std::declval<expr_value_type>()
308+
))>;
303309
// using return_type = std::conditional_t<std::is_same<init_type, void>::value, typename
304310
// std::decay_t<E>::value_type, init_type>;
305311

include/xtensor/xfunction.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ namespace xt
146146
struct xcontainer_inner_types<xfunction<F, CT...>>
147147
{
148148
// Added indirection for MSVC 2017 bug with the operator value_type()
149-
using func_return_type = typename meta_identity<decltype(std::declval<F>(
150-
)(std::declval<xvalue_type_t<std::decay_t<CT>>>()...))>::type;
149+
using func_return_type = typename meta_identity<
150+
decltype(std::declval<F>()(std::declval<xvalue_type_t<std::decay_t<CT>>>()...))>::type;
151151
using value_type = std::decay_t<func_return_type>;
152152
using reference = func_return_type;
153153
using const_reference = reference;

include/xtensor/xhistogram.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,9 @@ namespace xt
531531
XTENSOR_THROW(std::runtime_error, "Data argument for bincount can only contain positive integers!");
532532
}
533533

534-
xt::xtensor<result_value_type, 1> res = xt::zeros<result_value_type>({(std::max
535-
)(minlength, std::size_t(left_right[1] + 1))});
534+
xt::xtensor<result_value_type, 1> res = xt::zeros<result_value_type>(
535+
{(std::max)(minlength, std::size_t(left_right[1] + 1))}
536+
);
536537

537538
for (size_type i = 0; i < data.size(); ++i)
538539
{

include/xtensor/xmath.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,8 +1757,8 @@ namespace xt
17571757
auto d = math::abs(internal_type(a) - internal_type(b));
17581758
return d <= m_atol
17591759
|| d <= m_rtol
1760-
* double((std::max
1761-
)(math::abs(internal_type(a)), math::abs(internal_type(b))));
1760+
* double((std::max)(math::abs(internal_type(a)), math::abs(internal_type(b)))
1761+
);
17621762
}
17631763

17641764
private:

include/xtensor/xreducer.hpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ namespace xt
301301
using reduce_functor_type = typename std::decay_t<F>::reduce_functor_type;
302302
using init_functor_type = typename std::decay_t<F>::init_functor_type;
303303
using expr_value_type = typename std::decay_t<E>::value_type;
304-
using result_type = std::decay_t<decltype(std::declval<reduce_functor_type>(
305-
)(std::declval<init_functor_type>()(), std::declval<expr_value_type>()))>;
304+
using result_type = std::decay_t<decltype(std::declval<reduce_functor_type>()(
305+
std::declval<init_functor_type>()(),
306+
std::declval<expr_value_type>()
307+
))>;
306308

307309
using options_t = reducer_options<result_type, std::decay_t<O>>;
308310
options_t options(raw_options);
@@ -767,8 +769,10 @@ namespace xt
767769
using init_functor_type = typename std::decay_t<F>::init_functor_type;
768770
using merge_functor_type = typename std::decay_t<F>::merge_functor_type;
769771
using substepper_type = typename xexpression_type::const_stepper;
770-
using raw_value_type = std::decay_t<decltype(std::declval<reduce_functor_type>(
771-
)(std::declval<init_functor_type>()(), *std::declval<substepper_type>()))>;
772+
using raw_value_type = std::decay_t<decltype(std::declval<reduce_functor_type>()(
773+
std::declval<init_functor_type>()(),
774+
*std::declval<substepper_type>()
775+
))>;
772776
using value_type = typename detail::evaluated_value_type_t<raw_value_type, is_xexpression<raw_value_type>::value>;
773777

774778
using reference = value_type;
@@ -926,8 +930,10 @@ namespace xt
926930

927931
using reduce_functor_type = typename std::decay_t<F>::reduce_functor_type;
928932
using init_functor_type = typename std::decay_t<F>::init_functor_type;
929-
using value_type = std::decay_t<decltype(std::declval<reduce_functor_type>(
930-
)(std::declval<init_functor_type>()(), *std::declval<typename std::decay_t<E>::const_stepper>()))>;
933+
using value_type = std::decay_t<decltype(std::declval<reduce_functor_type>()(
934+
std::declval<init_functor_type>()(),
935+
*std::declval<typename std::decay_t<E>::const_stepper>()
936+
))>;
931937
using evaluated_value_type = evaluated_value_type_t<value_type, is_xexpression<value_type>::value>;
932938

933939
using reducer_type = xreducer<

include/xtensor/xstrides.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,9 @@ namespace xt
488488
inline offset_type element_offset(const S& strides, It first, It last) noexcept
489489
{
490490
using difference_type = typename std::iterator_traits<It>::difference_type;
491-
auto size = static_cast<difference_type>((std::min
492-
)(static_cast<typename S::size_type>(std::distance(first, last)), strides.size()));
491+
auto size = static_cast<difference_type>(
492+
(std::min)(static_cast<typename S::size_type>(std::distance(first, last)), strides.size())
493+
);
493494
return std::inner_product(last - size, last, strides.cend() - size, offset_type(0));
494495
}
495496

include/xtensor/xview.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,8 +1680,9 @@ namespace xt
16801680
inline auto xview<CT, S...>::sliced_access(const xslice<T>& slice, Arg arg, Args... args) const -> size_type
16811681
{
16821682
using ST = typename T::size_type;
1683-
return static_cast<size_type>(slice.derived_cast(
1684-
)(argument<I>(static_cast<ST>(arg), static_cast<ST>(args)...)));
1683+
return static_cast<size_type>(
1684+
slice.derived_cast()(argument<I>(static_cast<ST>(arg), static_cast<ST>(args)...))
1685+
);
16851686
}
16861687

16871688
template <class CT, class... S>
@@ -1707,8 +1708,9 @@ namespace xt
17071708
return xt::value(s, 0);
17081709
};
17091710

1710-
auto s = static_cast<diff_type>((std::min
1711-
)(static_cast<size_type>(std::distance(first, last)), this->dimension()));
1711+
auto s = static_cast<diff_type>(
1712+
(std::min)(static_cast<size_type>(std::distance(first, last)), this->dimension())
1713+
);
17121714
auto first_copy = last - s;
17131715
for (size_type i = 0; i != m_e.dimension(); ++i)
17141716
{

0 commit comments

Comments
 (0)