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

clang 10 -Wimplicit-int-float-conversion fixes #38881

Conversation

kevingranade
Copy link
Member

@kevingranade kevingranade commented Mar 18, 2020

Summary

SUMMARY: None

Purpose of change

Fixes #36510
Fixes #37006
Clang 10 adds a new warning, this corrects our code or silences the warning when "we know better":tm:

Describe the solution

Replace INT_MAX with FLT_MAX in a number of places.
Silence the warning due to the hackery in fastexp().

Describe alternatives you've considered

Could silence more of the warnings, but FLT_MAX seems to be correct in all of those cases.
Could use std::numeric_limits::max() instead, but that's kind of just bikeshedding.

This isn't finished, as the fastexp change in particular is heinous.
@@ -1206,8 +1206,11 @@ float fastexp( float x )
float f;
int i;
} u, v;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably be

Suggested change
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"

or

Suggested change
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, since I opened a PR from someone else's repo, I can't edit it or append a commit in the web interface.

@tycho tycho deleted the fixes/clang-10-implicit-int-float-conversion branch May 21, 2020 07:10
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.

Clang 10 -Wimplicit-int-float-conversion warnings clang 10 compile issue
3 participants