eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
659 stars 411 forks source link

Remove unused-result message when compiling #637

Closed g-vidal closed 6 years ago

g-vidal commented 6 years ago

warning messages about unused result occur. This commit enables to remove the messages uding the option -DWUNUSED=on which makes a cleaner log

Signed-off-by: g-vidal gerard.vidal@ens-lyon.fr

pylbert commented 6 years ago

@g-vidal, can you post a snippet of the unused warnings that you're encountering?

I suspect these are in the bindings (python, java, or javascript). If so, maybe we can get away suppressing them there without adding another option to the top-level CMakeLists.txt?

g-vidal commented 6 years ago

You are right @pylbert ! but maybe not for all... Most of the warnings come from the bindings with few errors repeated again and again. Towards the end of the compilation I get huge messages. The first examples come from the beginning of the compilation the last one from further. I have made a new cleaner PR after comments from @jtrulson #642.


/home/vidal/Logiciels/IoT/upm/build/src/interfaces/interfacesJAVASCRIPT_wrap.cxx: In function ‘void SWIGV8_AddStaticVariable(v8::Handle<v8::Object>, const char*, SwigV8AccessorGetterCallback, SwigV8AccessorSetterCallback)’:
/home/vidal/Logiciels/IoT/upm/build/src/interfaces/interfacesJAVASCRIPT_wrap.cxx:1505:87: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::SetAccessor(v8::Local<v8::Context>, v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::MaybeLocal<v8::Value>, v8::AccessControl, v8::PropertyAttribute)’, declared with attribute warn_unused_result [-Wunused-result]
   obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
                                                                                       ^
In file included from /usr/local/include/node/node.h:63:0,
                 from /home/vidal/Logiciels/IoT/upm/build/src/interfaces/interfacesJAVASCRIPT_wrap.cxx:171:
/usr/local/include/node/v8.h:3240:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(Local<Context> context,
/home/vidal/Logiciels/IoT/upm/build/src/grovescam/grovescamJAVASCRIPT_wrap.cxx: In function ‘void SWIGV8_AddStaticVariable(v8::Handle<v8::Object>, const char*, SwigV8AccessorGetterCallback, SwigV8AccessorSetterCallback)’:
/home/vidal/Logiciels/IoT/upm/build/src/grovescam/grovescamJAVASCRIPT_wrap.cxx:1505:87: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::SetAccessor(v8::Local<v8::Context>, v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::MaybeLocal<v8::Value>, v8::AccessControl, v8::PropertyAttribute)’, declared with attribute warn_unused_result [-Wunused-result]
   obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
                                                                                       ^
In file included from /usr/local/include/node/node.h:63:0,
                 from /home/vidal/Logiciels/IoT/upm/build/src/grovescam/grovescamJAVASCRIPT_wrap.cxx:171:
/usr/local/include/node/v8.h:3240:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(Local<Context> context,
                                     ^~~~~~~~~~~
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/string:40,
                 from /usr/include/c++/7/stdexcept:39,
                 from /home/vidal/Logiciels/IoT/upm/build/src/lcm1602/python3.6/lcm1602PYTHON_wrap.cxx:3075:
/usr/include/c++/7/bits/stl_algobase.h: In function ‘void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >; _Tp = double]’:
/usr/include/c++/7/bits/stl_algobase.h:724:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >’ changed in GCC 7.1
     fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
     ^~~~
/usr/include/c++/7/bits/stl_algobase.h:724:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >’ changed in GCC 7.1
In file included from /usr/include/c++/7/vector:63:0,
                 from /home/vidal/Logiciels/IoT/upm/build/src/lcm1602/python3.6/lcm1602PYTHON_wrap.cxx:3709:
/usr/include/c++/7/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<double*>; _ForwardIterator = double*; _Tp = double]’:
/usr/include/c++/7/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
     ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
/usr/include/c++/7/bits/stl_uninitialized.h:289:63: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
     { return std::uninitialized_copy(__first, __last, __result); }
/home/vidal/Logiciels/IoT/upm/build/src/bmg160/python2.7/bmg160PYTHON_wrap.cxx: In function ‘void std_vector_Sl_double_Sg__insert__SWIG_1(std::vector<double, std::allocator<double> >*, std::vector<double, std::allocator<double> >::iterator, std::vector<double, std::allocator<double> >::size_type, const value_type&)’:
/home/vidal/Logiciels/IoT/upm/build/src/bmg160/python2.7/bmg160PYTHON_wrap.cxx:5573:17: note: parameter passing for argument of type ‘std::vector<double, std::allocator<double> >::iterator {aka __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >}’ changed in GCC 7.1
 SWIGINTERN void std_vector_Sl_double_Sg__insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); }
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vidal/Logiciels/IoT/upm/build/src/bmg160/python2.7/bmg160PYTHON_wrap.cxx:5573:213: note: parameter passing for argument of type ‘std::vector<double, std::allocator<double> >::const_iterator {aka __gnu_cxx::__normal_iterator<const double*, std::vector<double, std::allocator<double> > >}’ changed in GCC 7.1
 __insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); }
                                                                                                                                                                  ~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/local/include/node/v8.h:23,
                 from /usr/local/include/node/node.h:63,
                 from /home/vidal/Logiciels/IoT/upm/build/src/bma250e/bma250eJAVASCRIPT_wrap.cxx:171:
/usr/include/c++/7/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = double; _Alloc = std::allocator<double>]’:
/usr/include/c++/7/bits/vector.tcc:73:12: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
    pointer __tmp = _M_allocate_and_copy(__n,
            ^~~~~
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/local/include/node/v8.h:23,
                 from /usr/local/include/node/node.h:63,
                 from /home/vidal/Logiciels/IoT/upm/build/src/bma250e/bma250eJAVASCRIPT_wrap.cxx:171:
/usr/include/c++/7/bits/stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = double; _Alloc = std::allocator<double>]’:
/usr/include/c++/7/bits/stl_vector.h:948:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<double*, std::vector<double> >’ changed in GCC 7.1
    _M_realloc_insert(end(), __x);
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h: In member function ‘std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::move_iterator<double*>; _Tp = double; _Alloc = std::allocator<double>]’:
/usr/include/c++/7/bits/stl_vector.h:1257:2: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  _M_allocate_and_copy(size_type __n,
  ^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:1257:2: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
/usr/include/c++/7/bits/stl_vector.h:1263:35: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
        std::__uninitialized_copy_a(__first, __last, __result,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
        _M_get_Tp_allocator());
        ~~~~~~~~~~~~~~~~~~~~~~      
pylbert commented 6 years ago

@g-vidal, this helps, however are there two different issues here?

  1. Suppressing the warnings added from the V8_WARN_UNUSED_RESULT macro
  2. An ABI change in GCC 7.1 for arm.

If we can, I would like to suppress the unused results in the Javascript wrappers by adding -Wno-unused-result at the SWIG-level.

https://github.com/intel-iot-devkit/upm/blob/306872619a413bfbfaced453e11ab024237684d2/src/CMakeLists.txt#L6-L10

For those other notes about the change in 7.1 - I wouldn't imagine the -Wno-unused-result gets rid of these. Have you found a way around them?