olena-2.0-77-g8ae6c4c Address warnings reported by clang++ in Milena.

* mln/canvas/browsing/diagonal2d.hh (diagonal2d_t::operator()) * mln/clustering/kmean_rgb.hh (internal::kmean_rgb_dispatch) * mln/labeling/value_and_compute.hh (internal::value_and_compute_tests) (impl::process__) * mln/metal/math/root.hh (impl::root<n, x, lo, hi>::value): Add an explicit type conversion of operator<'s the right-hand side operand. * mln/morpho/watershed/topological.hh (topological) * mln/world/rgb/invert.hh (internal::invert_dispatch): Remove unused variables. Do not name unused arguments. * mln/util/object_id.hh (operator==(const object_id<Tag,V>&, const Value<V2>&)): Add an explicit type conversion of the right-hand side operand. * mln/world/rgb/invert.hh, * tests/core/alias/point1d.cc, * tests/make/p_edges_with_mass_centers.cc, * tests/make/p_vertices_with_mass_centers.cc, * tests/value/int_s16.cc, * tests/value/int_u8.cc: Shush the compiler about unused variables. * tests/trait/op/plus.cc (mln::my_image2d<T>): Complete this type to have it comply with the mln::Image concept. (mln::dummy_t): New (dummy) type. (dummy): New (dummy) value. (main): Do not use uninitialized pointers. --- milena/ChangeLog | 32 ++++++++++++++++ milena/mln/canvas/browsing/diagonal2d.hh | 6 +-- milena/mln/clustering/kmean_rgb.hh | 18 +++++----- milena/mln/labeling/value_and_compute.hh | 14 +++---- milena/mln/metal/math/root.hh | 5 ++- milena/mln/morpho/watershed/topological.hh | 4 +- milena/mln/util/object_id.hh | 4 +- milena/mln/world/rgb/invert.hh | 6 ++-- milena/tests/algebra/h_vec.cc | 7 +++- milena/tests/core/alias/point1d.cc | 10 +++--- milena/tests/make/p_edges_with_mass_centers.cc | 3 +- milena/tests/make/p_vertices_with_mass_centers.cc | 3 +- milena/tests/trait/op/plus.cc | 41 ++++++++++++++++++++- milena/tests/value/int_s16.cc | 5 ++- milena/tests/value/int_u8.cc | 5 ++- 15 files changed, 116 insertions(+), 47 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 63ecfc1..7d7f92a 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,35 @@ +2013-02-07 Roland Levillain <roland@lrde.epita.fr> + + Address warnings reported by clang++ in Milena. + + * mln/canvas/browsing/diagonal2d.hh (diagonal2d_t::operator()) + * mln/clustering/kmean_rgb.hh (internal::kmean_rgb_dispatch) + * mln/labeling/value_and_compute.hh + (internal::value_and_compute_tests) + (impl::process__) + * mln/metal/math/root.hh (impl::root<n, x, lo, hi>::value): Add an + explicit type conversion of operator<'s the right-hand side + operand. + * mln/morpho/watershed/topological.hh (topological) + * mln/world/rgb/invert.hh (internal::invert_dispatch): + Remove unused variables. + Do not name unused arguments. + * mln/util/object_id.hh + (operator==(const object_id<Tag,V>&, const Value<V2>&)): + Add an explicit type conversion of the right-hand side operand. + * mln/world/rgb/invert.hh, + * tests/core/alias/point1d.cc, + * tests/make/p_edges_with_mass_centers.cc, + * tests/make/p_vertices_with_mass_centers.cc, + * tests/value/int_s16.cc, + * tests/value/int_u8.cc: + Shush the compiler about unused variables. + * tests/trait/op/plus.cc (mln::my_image2d<T>): Complete this type + to have it comply with the mln::Image concept. + (mln::dummy_t): New (dummy) type. + (dummy): New (dummy) value. + (main): Do not use uninitialized pointers. + 2013-02-06 Roland Levillain <roland@lrde.epita.fr> Disambiguate operator- overload resolution with a pow_int_ operand. diff --git a/milena/mln/canvas/browsing/diagonal2d.hh b/milena/mln/canvas/browsing/diagonal2d.hh index 0dc2cf7..f4ec023 100644 --- a/milena/mln/canvas/browsing/diagonal2d.hh +++ b/milena/mln/canvas/browsing/diagonal2d.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development +// Copyright (C) 2007, 2008, 2009, 2010, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -123,9 +123,7 @@ namespace mln mln_deduce(I, psite, delta) diag; - psite - pmin = f.input.domain().pmin(), - pmax = f.input.domain().pmax(); + psite pmin = f.input.domain().pmin(); f.p = pmin; diff --git a/milena/mln/clustering/kmean_rgb.hh b/milena/mln/clustering/kmean_rgb.hh index daf6499..99baa6c 100644 --- a/milena/mln/clustering/kmean_rgb.hh +++ b/milena/mln/clustering/kmean_rgb.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -966,8 +966,8 @@ namespace mln const unsigned k_center, const unsigned watch_dog, const unsigned n_times, - const value::rgb<n>&, - const point2d&) + const value::rgb<n>& /* v */, + const point2d& /* p */) { return impl::kmean_image2d_rgb<T,n>(img, k_center, watch_dog, n_times); } @@ -975,12 +975,12 @@ namespace mln template <typename T, unsigned n, typename I, typename V, typename P> inline mln_ch_value(I,value::label_8) - kmean_rgb_dispatch(const Image<I>& img, - const unsigned k_center, - const unsigned watch_dog, - const unsigned n_times, - const V&, - const P&) + kmean_rgb_dispatch(const Image<I>& /* img */, + const unsigned /* k_center */, + const unsigned /* watch_dog */, + const unsigned /* n_times */, + const V& /* v */, + const P& /* p */) { // No kmean implementation found. mlc_abort(I)::check(); diff --git a/milena/mln/labeling/value_and_compute.hh b/milena/mln/labeling/value_and_compute.hh index d93fce9..3993cd3 100644 --- a/milena/mln/labeling/value_and_compute.hh +++ b/milena/mln/labeling/value_and_compute.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -71,18 +71,16 @@ namespace mln template <typename I, typename N, typename L, typename A> void - value_and_compute_tests(const Image<I>& input, const mln_value(I)& val, - const Neighborhood<N>& nbh, L& nlabels, - const Accumulator<A>& accu) + value_and_compute_tests(const Image<I>& input, + const mln_value(I)& /* val */, + const Neighborhood<N>& nbh, L& /* nlabels */, + const Accumulator<A>& /* accu */) { mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid()); - (void) accu; (void) input; - (void) val; (void) nbh; - (void) nlabels; } } // end of namespace mln::labeling::internal @@ -190,7 +188,7 @@ namespace mln template <typename V> inline - void process__(const V&, const mln_site(I)&, const L& l) + void process__(const V&, const mln_site(I)&, const L& /* l */) { mlc_abort(V)::check(); } diff --git a/milena/mln/metal/math/root.hh b/milena/mln/metal/math/root.hh index 6667edd..3b34658 100644 --- a/milena/mln/metal/math/root.hh +++ b/milena/mln/metal/math/root.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -60,7 +61,7 @@ namespace mln val_lo = root<n, x, lo, mid-1>::value, val_hi = root<n, x, mid, hi>::value }; - enum { value = x < mlc_pow_int(mid, n) ? val_lo : val_hi }; + enum { value = x < unsigned(mlc_pow_int(mid, n)) ? val_lo : val_hi }; }; template<unsigned n, unsigned x, unsigned m> diff --git a/milena/mln/morpho/watershed/topological.hh b/milena/mln/morpho/watershed/topological.hh index b06e6ab..d17ece1 100644 --- a/milena/mln/morpho/watershed/topological.hh +++ b/milena/mln/morpho/watershed/topological.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -692,7 +693,6 @@ namespace mln p_priority< mln_value(I), p_queue_fast<mln_site(I)> > l; // p_queue < site > m; std::queue<mln_site(I)> m; - mln_value(I) min = mln_min(mln_value(I)); std::cout << "Init" << std::endl; diff --git a/milena/mln/util/object_id.hh b/milena/mln/util/object_id.hh index 525ff15..54c12ff 100644 --- a/milena/mln/util/object_id.hh +++ b/milena/mln/util/object_id.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -209,7 +209,7 @@ namespace mln bool operator==(const object_id<Tag,V>& lhs, const Value<V2>& rhs) { - return lhs.value() == exact(rhs).to_equiv(); + return lhs.value() == static_cast<V>(exact(rhs).to_equiv()); } template <typename Tag, typename V> diff --git a/milena/mln/world/rgb/invert.hh b/milena/mln/world/rgb/invert.hh index 62ee5bf..3c7b0d9 100644 --- a/milena/mln/world/rgb/invert.hh +++ b/milena/mln/world/rgb/invert.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -130,9 +130,9 @@ namespace mln inline void invert_dispatch(trait::image::speed::any, const mln_value(I)&, - const I& input, O& output) + const I& /* input*/ , O& /* output */) { - // No implementation found. May be input is not a RGB image? + // No implementation found. Maybe `input' is not an RGB image? mlc_abort(I)::check(); } diff --git a/milena/tests/algebra/h_vec.cc b/milena/tests/algebra/h_vec.cc index 8b833c5..4319068 100644 --- a/milena/tests/algebra/h_vec.cc +++ b/milena/tests/algebra/h_vec.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -28,6 +29,8 @@ using namespace mln; +/* FIXME: Complete or at least describe the purpose of these empty + functions. */ void run_in_3d(const algebra::vec<3, float>&) { @@ -45,9 +48,9 @@ void foo(const mln::algebra::h_vec<3,float>&) int main() { - algebra::vec<3, def::coord> x; algebra::h_vec<3, def::coord> w = x.to_h_vec(); + (void) w; typedef algebra::h_vec<3, def::coord> p3d; p3d p; diff --git a/milena/tests/core/alias/point1d.cc b/milena/tests/core/alias/point1d.cc index 1326ddd..15373fd 100644 --- a/milena/tests/core/alias/point1d.cc +++ b/milena/tests/core/alias/point1d.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -25,6 +26,7 @@ #include <mln/core/alias/point1d.hh> +#include <mln/math/abs.hh> int main() @@ -33,19 +35,17 @@ int main() point1d p, q; - // assignment - p[0] = 4; algebra::vec<1,float> v = p; + mln_assertion(v[0] == 4); p.ind() += 1; mln_assertion(p.ind() == 5 && p[0] == 5); - // construction q.ind() = 5; mln_assertion(p == q); q.set_all(0); - for (unsigned i = 0; i < p.dim; ++i) + for (unsigned i = 0; i < q.dim; ++i) mln_assertion(q[i] == 0); } diff --git a/milena/tests/make/p_edges_with_mass_centers.cc b/milena/tests/make/p_edges_with_mass_centers.cc index 4bc5b35..afb34e7 100644 --- a/milena/tests/make/p_edges_with_mass_centers.cc +++ b/milena/tests/make/p_edges_with_mass_centers.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -59,7 +59,6 @@ int main() g.add_edge(4,3); g.add_edge(4,2); - L nbasins = 4; typedef p_edges<G,fun::i2v::array<util::site_pair<point2d> > > pe_t; pe_t pe = make::p_edges_with_mass_centers(wst, g); diff --git a/milena/tests/make/p_vertices_with_mass_centers.cc b/milena/tests/make/p_vertices_with_mass_centers.cc index 58dfd5a..cb30707 100644 --- a/milena/tests/make/p_vertices_with_mass_centers.cc +++ b/milena/tests/make/p_vertices_with_mass_centers.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -57,7 +57,6 @@ int main() g.add_edge(4,3); g.add_edge(4,2); - L nbasins = 4; typedef p_vertices<G,fun::i2v::array<point2d> > pv_t; pv_t pv = make::p_vertices_with_mass_centers(wst, g); diff --git a/milena/tests/trait/op/plus.cc b/milena/tests/trait/op/plus.cc index df7877f..6639a43 100644 --- a/milena/tests/trait/op/plus.cc +++ b/milena/tests/trait/op/plus.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -32,11 +33,46 @@ namespace mln { + struct dummy_t {}; + dummy_t dummy; template <typename T> struct my_image2d : Image< my_image2d<T> > { void m() {} + + + // Dummy typedefs and methods added to comply with interface + // requirements of concept Image. + + typedef dummy_t domain_t; + typedef dummy_t site; + typedef dummy_t psite; + typedef dummy_t piter; + typedef dummy_t fwd_piter; + typedef dummy_t bkd_piter; + + bool has(const psite& /* p */) const { return false; } + bool is_valid() const { return true; } + + typedef dummy_t t_eligible_values_set; + const t_eligible_values_set& values_eligible() const { return dummy; } + + typedef dummy_t t_values_space; + const t_values_space& values_space() const { return dummy; } + + typedef dummy_t value; + typedef dummy_t rvalue; + typedef dummy_t lvalue; + + rvalue operator()(const psite& /* p */) const { return dummy; } + lvalue operator()(const psite& /* p */) { return dummy; } + + const domain_t& domain() const { return dummy; } + + typedef dummy_t skeleton; + + void init_(const dummy_t&) {}; }; @@ -82,7 +118,8 @@ int main() tmp = 5.1f; } { - my_image2d<float>* ptr; + my_image2d<float> ima; + my_image2d<float>* ptr = &ima; mln_trait_op_plus_(my_image2d<int>, my_image2d<float>) tmp = *ptr; tmp.m(); } diff --git a/milena/tests/value/int_s16.cc b/milena/tests/value/int_s16.cc index a6ee332..d2fbba6 100644 --- a/milena/tests/value/int_s16.cc +++ b/milena/tests/value/int_s16.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -192,7 +193,7 @@ int main() mln_assertion(c == 100); int_s16 d = 2; - c /= 2; + c /= d; mln_assertion(c == 50); } diff --git a/milena/tests/value/int_u8.cc b/milena/tests/value/int_u8.cc index 7993679..fe606aa 100644 --- a/milena/tests/value/int_u8.cc +++ b/milena/tests/value/int_u8.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -176,7 +177,7 @@ int main() sym_compare_assert(c, ==, 100.f); int_u8 d = 2; - c /= 2; + c /= d; sym_compare_assert(c, ==, 50.f); // FIXME: Triggers a warning about signed vs unsigned comparison. -- 1.7.2.5
participants (1)
-
Roland Levillain