fix(win): compile cleanly with MinGW GCC#1226
Conversation
Signed-off-by: Oxygen56 <jiangth99@163.com>
|
Thanks for the focused portability cleanup. The code change is technically reasonable and the current reported CI is green, but that CI uses Windows CLANG64 and does not compile with MinGW GCC, so it does not protect the behavior this PR claims. Supporting MinGW GCC is a compiler-support policy decision and would require a maintained compile lane or equivalent durable RED check. The branch is also nine commits behind main. No need to rebase or add infrastructure until the support direction is confirmed. |
|
Thanks for this, and sorry for the delayed first response. Queued for review. MERGEABLE with all 28 checks green and a tidy +30/-25 across four files — nothing blocking on your side. MinGW GCC clean compilation is valuable specifically because it is the toolchain most likely to drift silently; a build that only works under one Windows compiler tends not to stay working. |
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)