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

Compiler warnings? #372

Closed
davidbernstein opened this issue Nov 29, 2016 · 7 comments
Closed

Compiler warnings? #372

davidbernstein opened this issue Nov 29, 2016 · 7 comments

Comments

@davidbernstein
Copy link

Hi, When I include json.hpp I get many compiler warnings like

//usr/local/include/nlohmann/json.hpp(3006): warning: type qualifier is meaningless on cast type

Is there a way to suppress these? I'm on OS X with Xcode 7.2 (stuck on that version for other reasons).

Thanks,
Dave

@davidbernstein
Copy link
Author

warnings.txt

Attached is the full set of warnings I get. Clang sadly does not tell you the compiler flags to set to ignore the warnings in some cases.

@nlohmann
Copy link
Owner

Thanks for reporting. I had a look at the warnings:

  • "warning: template parameter "T" is not used in declaring the parameter types of function template" in json.hpp(1335) and json.hpp(1430): The template parameter T is in fact not used inside the function, but only to remove the function if number_integer_t/number_unsigned_t is the same as int. I am not sure how to silence this warning.
  • "unused type alias 'pointee_t'": pointee_t is used in a static_assert - I have no idea why the compiler warns about this.
  • "warning: unused type alias 'PointerType'": in fact, PointerType is used in the next line auto ptr = obj.template get_ptr<PointerType>();

These warnings look odd...

@davidbernstein
Copy link
Author

Yes I noticed that 2 and 3 were warnings about unused things that are actually used. I'm assuming this is probably some clang flakiness. One of these can be ignored with the flag -Wno-unused-local-typedef. If I can find flags for the other two I'll post them here.

@gregmarr
Copy link
Contributor

FYI XCode 7.2 uses Clang 7.0.2.

@davidbernstein
Copy link
Author

Yes, that could be the problem. I'm stuck on 7.2 since this is for a CUDA project and the nvidia toolkit is not compatible with the latest Xcode.

@nlohmann
Copy link
Owner

This really seems to be a quirk of the Clang version: Apple LLVM version 8.0.0 (clang-800.0.42.1) compiles without warning when called with -Wunused-local-typedef.

@davidbernstein
Copy link
Author

davidbernstein commented Nov 30, 2016

Ok then it's just me! Thanks for checking that out. We can close the issue. Other than the warnings the package is working great, it's exactly what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants