-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Compiling with icpc #755
Comments
Thanks for reporting! I shall have a look at the warnings. Apparently, we seem to "recognize" a GCC here. Could you please post the output of the |
Here is the output of {
"compiler": {
"c++": "201103",
"family": "icc",
"version": 1700
},
"copyright": "(C) 2013-2017 Niels Lohmann",
"name": "JSON for Modern C++",
"platform": "linux",
"url": "https://github.com/nlohmann/json",
"version": {
"major": 2,
"minor": 1,
"patch": 1,
"string": "2.1.1"
}
} |
Thanks! I shall have a look. I maybe just need to exclude ICC from the GCC version check. By the way: do you know whether there is a free version of ICC so that I could use it in the CI test suite? |
@nlohmann Great, thanks! I have compiled with the latest ...json/json.hpp(6663): warning #186: pointless comparison of unsigned integer with zero
const bool is_negative = x < 0;
^
detected during:
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>, NumberType=uint64_t={unsigned long}, <unnamed>=0]" at line 6290
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, bool, bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>]" at line 8995
instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(int, char, bool) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool,
NumberIntegerType=int64_t={long}, NumberUnsignedType=uint64_t={unsigned long}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer]" at line 14655 |
Meanwhile, I tried to get ICC running on Travis (see https://travis-ci.org/nlohmann/json/jobs/282297971), but it fails to compile so far. Maybe someone has an idea how to fix this. |
Maybe this would help:
|
@gregmarr Thanks! |
@tdegeus Did the last change fix the last warning? If so, I would close this issue. |
@nlohmann and @gregmarr Unfortunately the warning is persistent: json.hpp(6659): warning #186: pointless comparison of unsigned integer with zero
const bool is_negative = std::is_same<NumberType, number_integer_t>::value and (x < 0);
^
detected during:
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>, NumberType=uint64_t={unsigned long}, <unnamed>=0]" at line 6286
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, bool, bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>]" at line 8976
instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(int, char, bool) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool,
NumberIntegerType=int64_t={long}, NumberUnsignedType=uint64_t={unsigned long}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer]" at line 14636 |
Maybe we can fake it out a bit by doing the test in two parts:
@tdegeus Can you try with that and see if it works? |
@gregmarr I can confirms this fix. I am now left with the following compiler warnings: remark #11074: Inlining inhibited by limit max-size
remark #11074: Inlining inhibited by limit max-total-size
remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo |
Awesome. I would expect that you'll need to disable those messages on your end. https://software.intel.com/en-us/forums/intel-c-compiler/topic/600543 |
Great! (As for the Intel specific warnings. It seems that switching of the limits lets the memory usage of the compiler explode. At the moment I don't know which part of my code is most responsible. Disabling the warnings seems to be impossible in combination with keeping other compiler warnings) |
Thanks everybody! |
Just FYI, gcc-5.2 reports on this:
|
I changed to this and it makes compiler happy const bool is_negative = !(x>=0); |
Hi! I still have this issue (although with an old unsupported clang 3.3.1 based compiler) but I managed to remove the warning by creating these templates:
and in
I don't know exactly where to put these templates to make a proper pull request. Right now I just put them above Would a change like this break something else? If not, can someone help me to find the proper place for the templates and I'll make a pull request out of it. |
I would like to compile with the Intel C++ compiler, in particular this one
But currently this results in
When I remove the checks, I'm able to successfully compile and run. Compiling with
-Wall -Wextra -pendantic
only results in the following warningsThe text was updated successfully, but these errors were encountered: