Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings with GCC 10 #2052

Closed
nlohmann opened this issue Apr 19, 2020 · 0 comments · Fixed by #2053
Closed

Warnings with GCC 10 #2052

nlohmann opened this issue Apr 19, 2020 · 0 comments · Fixed by #2053
Assignees
Labels
kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@nlohmann
Copy link
Owner

With GCC 10.0.1 20200405 (experimental), the following warnings appear.

In file included from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/cassert:44,
                 from ../single_include/nlohmann/json.hpp:13540,
                 from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp: In instantiation of 'static uint8_t nlohmann::detail::serializer<BasicJsonType>::decode(uint8_t&, uint32_t&, uint8_t) [with BasicJsonType = nlohmann::basic_json<>; uint8_t = unsigned char; uint32_t = unsigned int]':
../single_include/nlohmann/json.hpp:15002:27:   required from 'void nlohmann::detail::serializer<BasicJsonType>::dump_escaped(const string_t&, bool) [with BasicJsonType = nlohmann::basic_json<>; nlohmann::detail::serializer<BasicJsonType>::string_t = std::__cxx11::basic_string<char>]'
../single_include/nlohmann/json.hpp:14761:25:   required from 'void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType&, bool, bool, unsigned int, unsigned int, bool) [with BasicJsonType = nlohmann::basic_json<>]'
../single_include/nlohmann/json.hpp:17727:19:   required from 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::dump(int, char, bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t, bool) const [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::string_t = std::__cxx11::basic_string<char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t = nlohmann::detail::error_handler_t]'
../single_include/nlohmann/json.hpp:24020:25:   required from here
../single_include/nlohmann/json.hpp:15498:18: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
15498 |         assert(0 <= index and index < 400);
      |                ~~^~~~~~~~


In file included from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/ext/alloc_traits.h:34,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/basic_string.h:40,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/string:55,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/streambuf:41,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/streambuf_iterator.h:35,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/iterator:66,
                 from ../single_include/nlohmann/json.hpp:44,
                 from src/unit-algorithms.cpp:32:
/usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/alloc_traits.h: At global scope:
/usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/alloc_traits.h:504:11: warning: noexcept-expression evaluates to 'false' because of a call to 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::internal_binary_t::internal_binary_t() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]' [-Wnoexcept]
  504 |  noexcept(noexcept(::new((void*)__p) _Up(std::declval<_Args>()...)))
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp:16380:9: note: but 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::internal_binary_t::internal_binary_t() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]' does not throw; perhaps it should be declared 'noexcept'
16380 |         internal_binary_t() : BinaryType() {}
      |         ^~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/x86_64-apple-darwin19/bits/c++allocator.h:33,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/allocator.h:46,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/string:41,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/streambuf:41,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/bits/streambuf_iterator.h:35,
                 from /usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/iterator:66,
                 from ../single_include/nlohmann/json.hpp:44,
                 from src/unit-algorithms.cpp:32:
/usr/local/Cellar/gcc/HEAD-705510a/include/c++/10.0.1/ext/new_allocator.h:149:11: warning: noexcept-expression evaluates to 'false' because of a call to 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::internal_binary_t::internal_binary_t() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]' [-Wnoexcept]
  149 |  noexcept(noexcept(::new((void *)__p)
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  150 |        _Up(std::forward<_Args>(__args)...)))
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp:16380:9: note: but 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::internal_binary_t::internal_binary_t() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]' does not throw; perhaps it should be declared 'noexcept'
16380 |         internal_binary_t() : BinaryType() {}
      |         ^~~~~~~~~~~~~~~~~

src/unit-allocator.cpp: In function 'void _DOCTEST_ANON_FUNC_18()':
src/unit-allocator.cpp:275:24: warning: declaration of 'json' shadows a global declaration [-Wshadow]
  275 |         bad_alloc_json json;
      |                        ^~~~
In file included from src/unit-allocator.cpp:33:
../single_include/nlohmann/json.hpp:2763:7: note: shadowed declaration is here
 2763 | using json = basic_json<>;
      |       ^~~~
nlohmann added a commit that referenced this issue Apr 19, 2020
@nlohmann nlohmann self-assigned this Apr 19, 2020
@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant