Closed
Description
What is the issue you have?
Instantiating the json::basic_json
template and compiling with the CUDA NVCC compiler emits the warnings below.
Please describe the steps to reproduce the issue.
Compile the following with nvcc (observed on 11.2 with MSVC 2019 host):
#include <nlohmann/json.hpp>
int main()
{
nlohmann::ordered_json json = {"Test"};
json.dump();
}
The following warnings are emitted:
_deps/nlohmann_json-src/include\nlohmann/detail/hash.hpp(114): warning: missing return statement at end of non-void function "nlohmann::detail::hash(const BasicJsonType &) [with BasicJsonType=nlohmann::json]"
detected during instantiation of "size_t nlohmann::detail::hash(const BasicJsonType &) [with BasicJsonType=nlohmann::json]"
_deps/nlohmann_json-src/include\nlohmann/json.hpp(8709): here
_deps/nlohmann_json-src/include\nlohmann/detail/output/serializer.hpp(704): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<nlohmann::ordered_map, std::vector, std::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t, std::allocator<uint8_t>>>, NumberType=uint8_t, <unnamed>=0]"
(266): here
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, __nv_bool, __nv_bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<nlohmann::ordered_map, std::vector, std::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t, std::allocator<uint8_t>>>]"
_deps/nlohmann_json-src/include\nlohmann/json.hpp(2281): here
instantiation of "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, __nv_bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t) const [with ObjectType=nlohmann::ordered_map, ArrayType=std::vector, StringType=std::string, BooleanType=__nv_bool, NumberIntegerType=int64_t, NumberUnsignedType=uint64_t, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer, BinaryType=std::vector<uint8_t, std::allocator<uint8_t>>]"
test.cu(2): here
_deps/nlohmann_json-src/include\nlohmann/detail/output/serializer.hpp(704): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<nlohmann::ordered_map, std::vector, std::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t, std::allocator<uint8_t>>>, NumberType=uint64_t, <unnamed>=0]"
(338): here
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, __nv_bool, __nv_bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<nlohmann::ordered_map, std::vector, std::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t, std::allocator<uint8_t>>>]"
_deps/nlohmann_json-src/include\nlohmann/json.hpp(2281): here
instantiation of "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, __nv_bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t) const [with ObjectType=nlohmann::ordered_map, ArrayType=std::vector, StringType=std::string, BooleanType=__nv_bool, NumberIntegerType=int64_t, NumberUnsignedType=uint64_t, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer, BinaryType=std::vector<uint8_t, std::allocator<uint8_t>>]"
test.cu(2): here
Can you provide a small but working code example?
See above.
What is the expected behavior?
No warnings.
And what is the actual behavior instead?
Warnings.
Which compiler and operating system are you using?
- Compiler: NVCC 11.2 + MSVC 2019
- Operating system: Windows 10
Which version of the library did you use?
- latest release version 3.9.1
- other release - please state the version: ___
- the
develop
branch