1

I'm moving some c++ code written for "g++ (Debian 8.3.0-6) 8.3.0" to "g++ (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110" and getting some strange looking warnings.

I could just ignore them or turn them off, I'd prefer to understand what's happening and fix it.

The warnings are coming from the stl header files. I've reduced the code needed to demonstrate it to the following:

#include <vector>
std::vector <double> dv;
  
int main(int argc, char *argv[]) {
  double d = 1.;
  dv.push_back(d);
}

When I compile with "g++ test.cpp", I get...

In file included from /usr/include/c++/10/vector:67,
                 from test.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<double*, std::vector<double> >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/10/vector:72,
                 from test.cpp:1:
/usr/include/c++/10/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const double&}; _Tp = double; _Alloc = std::allocator<double>]’:
/usr/include/c++/10/bits/vector.tcc:426:7: note: parameter passing for argument of type ‘std::vector<double>::iterator’ changed in GCC 7.1
  426 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/vector:66,
                 from test.cpp:1:
/usr/include/c++/10/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = double*; _ForwardIterator = double*; _Allocator = std::allocator<double>]’:
/usr/include/c++/10/bits/stl_uninitialized.h:347:2: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  346 |       return std::__uninitialized_copy_a
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  347 |  (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  348 |   _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/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++/10/bits/stl_uninitialized.h:323:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  323 |     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
      |     ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_uninitialized.h:323:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
/usr/include/c++/10/bits/stl_uninitialized.h:325:37: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  325 |     { return std::uninitialized_copy(__first, __last, __result); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<double*>; _ForwardIterator = double*]’:
/usr/include/c++/10/bits/stl_uninitialized.h:125:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  125 |     uninitialized_copy(_InputIterator __first, _InputIterator __last,
      |     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_uninitialized.h:125:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
/usr/include/c++/10/bits/stl_uninitialized.h:150:15: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  147 |       return std::__uninitialized_copy<__is_trivial(_ValueType1)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148 |            && __is_trivial(_ValueType2)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149 |            && __assignable>::
      |            ~~~~~~~~~~~~~~~~~~
  150 |  __uninit_copy(__first, __last, __result);
      |  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_uninitialized.h: In static member function ‘static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<double*>; _ForwardIterator = double*]’:
/usr/include/c++/10/bits/stl_uninitialized.h:107:9: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  107 |         __uninit_copy(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_uninitialized.h:107:9: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
/usr/include/c++/10/bits/stl_uninitialized.h:109:27: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  109 |         { return std::copy(__first, __last, __result); }
      |                  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/vector:60,
                 from test.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h: In function ‘_OI std::copy(_II, _II, _OI) [with _II = std::move_iterator<double*>; _OI = double*]’:
/usr/include/c++/10/bits/stl_algobase.h:560:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
  560 |     copy(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/10/bits/stl_algobase.h:560:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from test.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h: In function ‘decltype (std::__miter_base(__it.base())) std::__miter_base(std::move_iterator<_IteratorL>) [with _Iterator = double*]’:
/usr/include/c++/10/bits/stl_iterator.h:2198:5: note: parameter passing for argument of type ‘std::move_iterator<double*>’ changed in GCC 7.1
 2198 |     __miter_base(move_iterator<_Iterator> __it)
      |     ^~~~~~~~~~~~

Any suggestions? Thanks.

0 Answers0