Skip to content

jsoncpp: Define JSON_USE_INT64_DOUBLE_CONVERSION for clang as well. #1002

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

Merged
merged 1 commit into from
Sep 16, 2019
Merged

Conversation

m-gupta
Copy link
Contributor

@m-gupta m-gupta commented Aug 15, 2019

The current check to define JSON_USE_INT64_DOUBLE_CONVERSION
works for GCC but not clang.

Clang does define GNUC but with a value 4 which misses
the check for >= 6.

This avoids the -Wimplicit-int-float-conversion warning
when jsoncpp is built with a recent version of clang.

Signed-off-by: Manoj Gupta manojgupta@google.com

The current check to define JSON_USE_INT64_DOUBLE_CONVERSION
works for GCC but not clang.

Clang does define __GNUC__ but with a value 4 which misses
the check for >= 6.

This avoids the -Wimplicit-int-float-conversion warning
when jsoncpp is built with a recent version of clang.

Signed-off-by: Manoj Gupta <manojgupta@google.com>
@@ -104,7 +104,9 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
#define JSONCPP_OP_EXPLICIT
#endif

#if defined(__GNUC__) && (__GNUC__ >= 6)
#if defined(__clang__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove duplicate #define lines with:

#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6)) {

@baylesj baylesj merged commit 3013ed4 into open-source-parsers:master Sep 16, 2019
@m-gupta
Copy link
Contributor Author

m-gupta commented Sep 17, 2019

Thanks a lot!

dawesc pushed a commit to EFTlab/jsoncpp that referenced this pull request Sep 25, 2019
…pen-source-parsers#1002)

The current check to define JSON_USE_INT64_DOUBLE_CONVERSION
works for GCC but not clang.

Clang does define __GNUC__ but with a value 4 which misses
the check for >= 6.

This avoids the -Wimplicit-int-float-conversion warning
when jsoncpp is built with a recent version of clang.

Signed-off-by: Manoj Gupta <manojgupta@google.com>
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

Successfully merging this pull request may close these issues.

2 participants