Repository navigation
Test _WIN32 with defined() instead of by value - #1088
Merged
Jason Sandlin (jasonsandlin) merged 1 commit intoNov 30, 2026
Merged
Jason Sandlin (jasonsandlin) merged 1 commit into
Jason Sandlin (jasonsandlin) merged 1 commit into
Conversation
Eight preprocessor conditionals used `#if _WIN32`. Non-Windows toolchains don't define _WIN32, so clang/gcc report -Wundef for each. pal.h is included by every public header, so every consumer TU got the warning and -Werror builds failed. Use `#if defined(_WIN32)` like the rest of the codebase; behavior is identical on every platform. Sites: Include/httpClient/pal.h, Source/Common/utils.h, Source/Logger/trace.cpp and five in Source/Task/AsyncLib.cpp. Extend the public header check with -Werror=undef so the public headers stay -Wundef clean on the native and Generic platforms. Fixes #1085 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Andy McCalib (amccalib)
approved these changes
Nov 30, 2026
Jason Sandlin (jasonsandlin)
merged commit Nov 30, 2026
dbc25ba
into
user/jasonsa/pal-msvc-only-pragmas
2 checks passed
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
28bf9b1d988afec00764f285bb66c557b62487fd#if _WIN32to#if defined(_WIN32); identical semantics everywhere.↑ Header check with -Werror=undef passes for native and Generic; portable suite 242/242; MSVC TE build warning-free.
↓ CI legs beyond Linux clang and MSVC x64 Debug not yet observed.
pal.h:21:5 '_WIN32' is not defineddiagnostic._WIN32diagnostics (all 8 listed sites).↓ Not verified with the actual PS5 SDK toolchain.
Fixes #1085
Stacked on #1087 (reuses its public-header check). Review/merge #1087 first; this PR then retargets to
main.Problem
Eight conditionals tested
_WIN32by value (#if _WIN32). Non-Windows toolchains don't define it, so clang/gcc report-Wundef.pal.his included by every public header, so every consumer TU got the warning and-Werrorbuilds failed.Fix
#if _WIN32→#if defined(_WIN32)at all sites listed in the issue:Include/httpClient/pal.h,Source/Common/utils.h,Source/Logger/trace.cpp, and five inSource/Task/AsyncLib.cpp. No bare#if _WIN32remains underInclude/orSource/.Test (red → green)
Adds
-Werror=undefto thelibHttpClient.PublicHeaderCheck.*options from #1087.pal.h:21:5: error: '_WIN32' is not defined, evaluates to 0 [-Werror,-Wundef].Source/sites aren't in the public headers, so I checked them with a full-Wundefbuild of the library: zero_WIN32diagnostics, down from about 160. Other internal-Wundefhits (HC_UWP_API,_MSC_VER,_MSVC_LANG,HC_NOZLIB) are out of scope here and don't reach consumers.