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

Fix -Wuseless-cast compiler warnings #1145

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Fix -Wuseless-cast compiler warnings #1145

merged 2 commits into from
Aug 13, 2024

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Aug 13, 2024

Issue #:
#973

This warning exists in GCC only (not Clang), and for C++ only (not C)

Description of changes:

  • Add -Wuseless-cast warning to the "header checker"
  • Remove useless casts in array_list.inl
  • Ignore -Wuseless-cast warning in math.inl
    • The tricky part is that SOME platforms (Apple and BSD variants) define size_t as unsigned long and require casting to uint64_t (aka unsigned long long). While other platforms define size_t as unsigned long long and warn about useless casts if you cast it to uint64_t. My first commit attempted to only do casts on those platforms, but it was more complex than simply ignoring the warning.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@graebm graebm mentioned this pull request Aug 13, 2024
@graebm graebm merged commit 672cc00 into main Aug 13, 2024
53 checks passed
@graebm graebm deleted the fix-useless-cast branch August 13, 2024 22: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.

2 participants