fix(win): compile cleanly with MinGW GCC#1226
Open
Oxygen56 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Oxygen56 <jiangth99@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1225
What does this PR do?
Makes the Windows sources compile cleanly with MinGW GCC when warnings are treated as errors.
DWORDrange comparison that GCC reports as always false on 64-bit Windows. The existingMAXDWORDguard keeps the subsequent+1safe, whilecallocretains allocation-overflow handling.void (*)(void)function-pointer type before assigning their concrete signatures.Root cause
MinGW defines
FARPROCas an unspecified-parameter function pointer. Direct casts from it to concrete Win32 function signatures trigger-Wcast-function-type. Separately, aDWORDcan never exceed the 64-bitSIZE_MAX-based bound, so-Wtype-limitsrejects that comparison under-Werror.Verification
origin/mainreproduced both warning classes withx86_64-w64-mingw32-gcc 16.1.0 -Wall -Wextra -Werror.-Wno-stringop-overflowwas used only to isolate pre-existing unrelated diagnostics in that file.make -f Makefile.cbm test— 6776 passed, 4 skipped.make -f Makefile.cbm lint-ci— passed.scripts/check-dco.sh origin/main..HEAD— passed.Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)