Closed mfvargo closed 3 years ago
Duplicate #1861, see https://github.com/nlohmann/json/issues/1861#issuecomment-745998713.
The gist: this is not an issue in the library, but a note from GCC. You can ignore the warning or upgrade your GCC.
Thank you. sorry to open a duplicate issue.
No worries! Maybe it’s time to put this into an FAQ.
What is the issue you have?
Compiling on Rapsberry Pi OS creates a large number of warnings. Code seems to still work but it's unnerving. Build on ubuntu produces no warnings. Software on both systems works the same (as far as I can tell)
Here are a first few warnings. They are all similar:
Please describe the steps to reproduce the issue.
Compile this source code (cppversion.cpp)
with this command build code
Program Output ( ./a.out )
What is the expected behavior?
It should compile with no warnings.
And what is the actual behavior instead?
You get a ton of warnings.
Which compiler and operating system are you using?
cat /etc/os-release on Pi
gcc -version on Pi
Which version of the library did you use?
Licensed under the MIT License http://opensource.org/licenses/MIT. SPDX-License-Identifier: MIT Copyright (c) 2013-2019 Niels Lohmann http://nlohmann.me.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
In file included from /usr/include/c++/8/map:61, from json.hpp:61, from cppversion.cpp:2: /usr/include/c++/8/bits/stl_map.h: In member function ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::cxx11::basic_string; _Tp = nlohmann::basic_json<>; _Compare = std::less; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string, nlohmann::basic_json<> > >]’:
/usr/include/c++/8/bits/stl_map.h:518:8: note: parameter passing for argument of type ‘std::_Rb_tree<std:: cxx11::basic_string, std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> > >, std::less, std::allocator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > > >::const_iterator’ {aka ‘std::_Rb_tree_const_iterator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > >’} changed in GCC 7.1
i = _M_t._M_emplace_hint_unique(i, std::piecewise_construct,
In file included from /usr/include/c++/8/vector:69,
from json.hpp:47,
from cppversion.cpp:2:
/usr/include/c++/8/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]’:
/usr/include/c++/8/bits/vector.tcc:74:12: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>>’ changed in GCC 7.1
pointer tmp = _M_allocate_and_copy(n,
^~~~~
In file included from /usr/include/c++/8/map:60,
from json.hpp:61,
from cppversion.cpp:2:
/usr/include/c++/8/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator >&&>, std::tuple<>}; _Key = std::cxx11::basic_string; _Val = std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> >; _KeyOfValue = std::_Select1st<std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> > >; _Compare = std::less; _Alloc = std::allocator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > >]’:
/usr/include/c++/8/bits/stl_tree.h:2411:7: note: parameter passing for argument of type ‘std::_Rb_tree<std:: cxx11::basic_string, std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> > >, std::less, std::allocator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > > >::const_iterator’ {aka ‘std::_Rb_tree_const_iterator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > >’} changed in GCC 7.1
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
^, nlohmann::basic_json<> > >]’:
/usr/include/c++/8/bits/stl_iterator_base_funcs.h:213:5: note: parameter passing for argument of type ‘std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string, nlohmann::basic_json<> > >’ changed in GCC 7.1
next(_InputIterator x, typename
^~~~
In file included from /usr/include/c++/8/vector:64,
from json.hpp:47,
from cppversion.cpp:2:
/usr/include/c++/8/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<nlohmann::basic_json<> >; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]’:
/usr/include/c++/8/bits/stl_vector.h:1395:2: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>>’ changed in GCC 7.1
_M_allocate_and_copy(size_type __n,
^
~~~~~~~~~~In file included from /usr/include/c++/8/bits/stl_algobase.h:66, from /usr/include/c++/8/bits/char_traits.h:39, from /usr/include/c++/8/ios:40, from /usr/include/c++/8/ostream:38, from /usr/include/c++/8/iostream:39, from cppversion.cpp:1: /usr/include/c++/8/bits/stl_iterator_base_funcs.h: In function ‘_InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type) [with _InputIterator = std::_Rb_tree_const_iterator<std::pair<const std::cxx11::basic_string~~~~~~~ /usr/include/c++/8/bits/stl_vector.h:1395:2: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>>’ changed in GCC 7.1 /usr/include/c++/8/bits/stl_vector.h:1401:35: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>*>’ changed in GCC 7.1 std::uninitialized_copy_a(first, last, result,In file included from /usr/include/c++/8/map:60, from json.hpp:61, from cppversion.cpp:2: /usr/include/c++/8/bits/stl_tree.h: In member function ‘std::pair<std::_Rb_tree_node_base, std::_Rb_tree_node_base> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_hint_unique_pos(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, const key_type&) [with _Key = std::cxx11::basic_string; _Val = std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> >; _KeyOfValue = std::_Select1st<std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> > >; _Compare = std::less; _Alloc = std::allocator<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > >]’:
/usr/include/c++/8/bits/stl_tree.h:2146:5: note: parameter passing for argument of type ‘std::_Rb_tree<std::cxx11::basic_string, std::pair<const std::__cxx11::basic_string, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std:: cxx11::basic_string, nlohmann::basic_json<> > >, std::less, std::allocator<std::pair<const std::cxx11::basic_string, nlohmann::basic_json<> > > >::const_iterator’ {aka ‘std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string, nlohmann::basic_json<> > >’} changed in GCC 7.1
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
^ uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<nlohmann::basic_json<>>; _ForwardIterator = nlohmann::basic_json<>; _Tp = nlohmann::basic_json<>]’:
/usr/include/c++/8/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>>’ changed in GCC 7.1
uninitialized_copy_a(_InputIterator __first, _InputIterator last,
^
~~~~~~~~~~In file included from /usr/include/c++/8/memory:65, from json.hpp:43, from cppversion.cpp:2: /usr/include/c++/8/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::~~~~~ /usr/include/c++/8/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>>’ changed in GCC 7.1 /usr/include/c++/8/bits/stl_uninitialized.h:289:37: note: parameter passing for argument of type ‘std::move_iterator<nlohmann::basic_json<>*>’ changed in GCC 7.1 { return std::uninitialized_copy(first, last, __result); }__uninit_copy(first, last, __result);
(_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(first), ^
~~~~~~~~~~~~~ _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(last), result, alloc);