fix: match diagnostics by format instead of OS - #339
Merged
Merged
Conversation
The old code picked the regex by os.platform() == 'win32', assuming >> Windows => MSVC and non-Windows => GCC/Clang. This drops every GCC/Clang >> error on Windows (e.g. cross-compilers like riscv32-wch-elf-gcc). >> >> Match by format instead: try the GCC/Clang regex first, then fall back to >> the MSVC regex. This is a no-op for MSVC users (the GCC regex cannot match >> MSVC's 'file(line): error C1234: msg' shape) and fixes GCC/Clang on Windows.
waruqi
pushed a commit
that referenced
this pull request
Aug 18, 2026
Follow-up to #339: format-based regex dispatch is in place, but on Windows the XMAKE_LOGFILE still uses CRLF line endings. splitting on '\n' leaves a trailing '\r' on each line, and the gcc/clang regex ends with '\$' (while '.' does not match '\r'), so diagnostics still fail to match. Split on /\r?\n/ so the trailing \r is consumed.
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.
Problem
ProblemList.diagnose()picks which regex to use based on the OS:This assumes Windows ⇒ MSVC and non-Windows ⇒ GCC/Clang. But on Windows it is common to use a GCC or Clang toolchain (e.g. cross-compilers like
riscv32-wch-elf-gcc,arm-none-eabi-gcc, or plain MinGW/Clang). In that case every GCC/Clang diagnostic line is pushed through the MSVC regex, which cannot matchfile:line:col: error: message, so all errors/warnings are silently dropped from the Problems panel.Fix
Match by format instead of by OS: try the GCC/Clang regex first, then fall back to the MSVC regex.
Why this is safe for MSVC users
The two regexes are mutually exclusive in practice:
:line:col:sequence followed byerror|warning, e.g.file.cpp:12:5: error: ....(line): error C1234: .../warning C1234: ....MSVC's
file(line): error C1234: msgshape has no:line:col:sequence, so the GCC regex never matches it and it still falls through to the MSVC regex — behavior for MSVC users is unchanged. The only behavioral change is that GCC/Clang diagnostics now work on Windows.Validation
npm run compilepasses cleanly.This is the companion fix to the logfile CRLF / control-char fixes already submitted to
xmake-io/xmake(#7711, #7712), which make theXMAKE_LOGFILEcontent parseable. This PR fixes the other half of the pipeline — the regex that consumes it.