Fix zlib old-style-cast build breakage #72768
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Build "Fix zlib old-style-cast build breakage"
Purpose of change
Unbreak the build on at least macOS Sonoma with Xcode 15.2 (15C500b) and zlib 1.3.1 from MacPorts; possibly also on other platform / compiler / zlib combinations:
Describe the solution
Disable
-Wold-style-cast
across the use of zlib'sinflateInit2
macro.Describe alternatives you've considered
That macro uses a C style cast because it lives in a (C++-compatible) C header, so this isn't a bug in zlib, and even if it were, we'd still want to work around (hypothetically) broken zlib versions.
Considered removing either
-Werror
or-Wold-style-cast
from the defaults, but felt that would be a more contentious change than locally disabling-Wold-style-cast
(i.e. the footgunning seems intentional).Testing
Before change: Build was broken. After change: Build was fine. Smoke-tested the resulting binaries and they seem fine.
Additional context
n/a