xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.33k stars 398 forks source link

Various compiler warnings gcc -pedantic #995

Closed tdegeus closed 6 years ago

tdegeus commented 6 years ago

Compiling

#include <iostream>
#include <xtensor/xarray.hpp>
#include <xtensor/xio.hpp>
#include <xtensor/xview.hpp>

int main()
{
  xt::xarray<double> arr1
    {{1.0, 2.0, 3.0},
     {2.0, 5.0, 7.0},
     {2.0, 5.0, 7.0}};

  xt::xarray<double> arr2
    {5.0, 6.0, 7.0};

  xt::xarray<double> res = xt::view(arr1, 1) + arr2;

  std::cout << res;
}

with

g++ -std=c++14 -Wall -pedantic -Wsign-compare -I/data/prog/clone/xtensor/include -I/data/prog/clone/xtl/include test.cpp -o test

results in the following compiler warnings

In file included from /data/prog/clone/xtensor/include/xtensor/xstorage.hpp:22,
                 from /data/prog/clone/xtensor/include/xtensor/xbuffer_adaptor.hpp:20,
                 from /data/prog/clone/xtensor/include/xtensor/xarray.hpp:18,
                 from test.cpp:2:
/data/prog/clone/xtensor/include/xtensor/xutils.hpp:640:6: warning: extra ';' [-Wpedantic]
     };
      ^
/data/prog/clone/xtensor/include/xtensor/xutils.hpp:967:10: warning: extra ';' [-Wpedantic]
         };
          ^
In file included from /data/prog/clone/xtensor/include/xtensor/xcontainer.hpp:23,
                 from /data/prog/clone/xtensor/include/xtensor/xarray.hpp:19,
                 from test.cpp:2:
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:324:49: warning: extra ';' [-Wpedantic]
         XTENSOR_UNSIGNED_ABS_FUNC(unsigned char);
                                                 ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:325:50: warning: extra ';' [-Wpedantic]
         XTENSOR_UNSIGNED_ABS_FUNC(unsigned short);
                                                  ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:326:48: warning: extra ';' [-Wpedantic]
         XTENSOR_UNSIGNED_ABS_FUNC(unsigned int);
                                                ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:327:49: warning: extra ';' [-Wpedantic]
         XTENSOR_UNSIGNED_ABS_FUNC(unsigned long);
                                                 ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:328:54: warning: extra ';' [-Wpedantic]
         XTENSOR_UNSIGNED_ABS_FUNC(unsigned long long);
                                                      ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:687:88: warning: extra ';' [-Wpedantic]
     XTENSOR_REDUCER_FUNCTION(amax, math::maximum, typename std::decay_t<E>::value_type);
                                                                                        ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:691:92: warning: extra ';' [-Wpedantic]
     XTENSOR_MODERN_CLANG_REDUCER(amax, math::maximum, typename std::decay_t<E>::value_type);
                                                                                            ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:705:88: warning: extra ';' [-Wpedantic]
     XTENSOR_REDUCER_FUNCTION(amin, math::minimum, typename std::decay_t<E>::value_type);
                                                                                        ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:709:92: warning: extra ';' [-Wpedantic]
     XTENSOR_MODERN_CLANG_REDUCER(amin, math::minimum, typename std::decay_t<E>::value_type);
                                                                                            ^
In file included from /data/prog/clone/xtensor/include/xtensor/xcontainer.hpp:23,
                 from /data/prog/clone/xtensor/include/xtensor/xarray.hpp:19,
                 from test.cpp:2:
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:1757:103: warning: extra ';' [-Wpedantic]
     XTENSOR_REDUCER_FUNCTION(sum, std::plus, big_promote_type_t<typename std::decay_t<E>::value_type>);
                                                                                                       ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:1761:107: warning: extra ';' [-Wpedantic]
     XTENSOR_MODERN_CLANG_REDUCER(sum, std::plus, big_promote_type_t<typename std::decay_t<E>::value_type>);
                                                                                                           ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:1775:110: warning: extra ';' [-Wpedantic]
     XTENSOR_REDUCER_FUNCTION(prod, std::multiplies, big_promote_type_t<typename std::decay_t<E>::value_type>);
                                                                                                              ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:1779:114: warning: extra ';' [-Wpedantic]
     XTENSOR_MODERN_CLANG_REDUCER(prod, std::multiplies, big_promote_type_t<typename std::decay_t<E>::value_type>);
                                                                                                                  ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2057:100: warning: extra ';' [-Wpedantic]
     XTENSOR_NAN_REDUCER_FUNCTION(nansum, detail::nan_plus, typename std::decay_t<E>::value_type, 0);
                                                                                                    ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2061:96: warning: extra ';' [-Wpedantic]
     MODERN_CLANG_NAN_REDUCER(nansum, detail::nan_plus, typename std::decay_t<E>::value_type, 0);
                                                                                                ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2075:107: warning: extra ';' [-Wpedantic]
     XTENSOR_NAN_REDUCER_FUNCTION(nanprod, detail::nan_multiplies, typename std::decay_t<E>::value_type, 1);
                                                                                                           ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2079:103: warning: extra ';' [-Wpedantic]
     MODERN_CLANG_NAN_REDUCER(nanprod, detail::nan_multiplies, typename std::decay_t<E>::value_type, 1);
                                                                                                       ^
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2201:14: warning: extra ';' [-Wpedantic]
             };
              ^
              -
/data/prog/clone/xtensor/include/xtensor/xmath.hpp:2217:14: warning: extra ';' [-Wpedantic]
             };
              ^
              -
SylvainCorlay commented 6 years ago

Thanks! Don't hesitate to open PRs fixing compiler warnings when you find them!

tdegeus commented 6 years ago

Will do!

tdegeus commented 6 years ago

Closed by #997