Skip to content

Make gcc diagnostics color output work the same as for rustc - #2758

Merged
sylvestre merged 1 commit into
mozilla:mainfrom
jwidauer:fix-gcc-color-output
Jul 1, 2026
Merged

sylvestre merged 1 commit into
mozilla:mainfrom
jwidauer:fix-gcc-color-output

Conversation

@jwidauer

@jwidauer jwidauer commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

When using sccache with gcc using the -fdiagnostics-color=auto flag, there is currently no color output being shown.
This is due to gcc not outputting colors, when standard error is not a terminal, which is the case when using sccache.

This PR addresses this behavior, by making sccache behave similarly for gcc as for rustc. When the -fdiagnostics-color flag is specified, it will remove this flag from the arguments and add it back as -fdiagnostics-color=always, if the color_mode is set to On or Auto.

Please let me know if there is anything I should change or might not have considered!

@codecov-commenter

codecov-commenter commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.19%. Comparing base (68cd330) to head (105a89b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2758      +/-   ##
==========================================
+ Coverage   74.18%   74.19%   +0.01%     
==========================================
  Files          71       71              
  Lines       40491    40505      +14     
==========================================
+ Hits        30037    30052      +15     
+ Misses      10454    10453       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jwidauer
jwidauer force-pushed the fix-gcc-color-output branch from 13a6c08 to 105a89b Compare July 1, 2026 14:31
@sylvestre
sylvestre merged commit 3a85b1a into mozilla:main Jul 1, 2026
51 checks passed
@jwidauer
jwidauer deleted the fix-gcc-color-output branch July 2, 2026 15:43
lkwilson pushed a commit to lkwilson/red that referenced this pull request Jul 30, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [mozilla/sccache](https://github.com/mozilla/sccache) | minor | `0.16.0` → `0.17.0` |

---

### Release Notes

<details>
<summary>mozilla/sccache (mozilla/sccache)</summary>

### [`v0.17.0`](https://github.com/mozilla/sccache/releases/tag/v0.17.0)

[Compare Source](mozilla/sccache@v0.16.0...v0.17.0)

##### sccache 0.17.0

##### Summary

sccache 0.17.0 is a significant release: it introduces a **new client-side architecture**.

Until now, every compilation was handed off to the long-lived sccache server, which did the cache
lookup and ran the compiler. In client-side mode, the client process does that work itself - the
server is only consulted for the shared state it owns (compiler info, dist client, stats). This
removes a round-trip and the server-side bottleneck, and gives noticeably better results on
developer workstations.

Client-side mode is opt-in for now: enable it with the `SCCACHE_CLIENT_SIDE` environment variable
(or the `client_side_mode` config key). See [docs/Architecture.md](https://github.com/mozilla/sccache/blob/main/docs/Architecture.md#client-side-mode-sccache_client_side)
for the details.

Other highlights:

- **Response files**: gcc/clang builds using quoted `@response` files are now cached and
  distributed correctly ([#&#8203;2755](mozilla/sccache#2755), [#&#8203;2772](mozilla/sccache#2772)), and Rust `@argfile` arguments are supported ([#&#8203;2782](mozilla/sccache#2782)).
- **Distributed compilation**: compile tasks and their subprocesses are now aborted when a client
  disconnects, instead of running to completion on the build server ([#&#8203;2761](mozilla/sccache#2761), [#&#8203;2774](mozilla/sccache#2774)). The
  `ToolchainPackager` cfg gate was fixed so the dist code builds on ppc64le and s390x ([#&#8203;2749](mozilla/sccache#2749)).
- **S3 SSE-KMS**: server-side encryption with KMS keys is now supported ([#&#8203;2770](mozilla/sccache#2770)).
- **Diagnostics**: gcc color diagnostics now behave the same way as rustc's ([#&#8203;2758](mozilla/sccache#2758)).
- **Preprocessor correctness**: `-ivfsoverlay` is treated as a preprocessor-only argument ([#&#8203;2767](mozilla/sccache#2767)).

Welcome to 4 new contributors!

##### Client-side mode

- Initial client-side implementation by [@&#8203;glandium](https://github.com/glandium) in [#&#8203;2735](mozilla/sccache#2735)
- doc: document client-side and direct modes in Architecture.md by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2752](mozilla/sccache#2752)

##### Features

- gcc/clang: cache and distribute builds using quoted [@&#8203;response](https://github.com/response) files by [@&#8203;avikivity](https://github.com/avikivity) in [#&#8203;2755](mozilla/sccache#2755)
- Add support for arg files in Rust by [@&#8203;ranger-ross](https://github.com/ranger-ross) in [#&#8203;2782](mozilla/sccache#2782)
- feat: support S3 SSE-KMS by [@&#8203;jpadilla](https://github.com/jpadilla) in [#&#8203;2770](mozilla/sccache#2770)
- Make gcc diagnostics color output work the same as for rustc by [@&#8203;jwidauer](https://github.com/jwidauer) in [#&#8203;2758](mozilla/sccache#2758)
- Abort compile tasks and associated subprocesses when a client disconnects by [@&#8203;trxcllnt](https://github.com/trxcllnt) in [#&#8203;2761](mozilla/sccache#2761)

##### Fixes

- Fix ToolchainPackager cfg gate to build on ppc64le/s390x by [@&#8203;cryptomilk](https://github.com/cryptomilk) in [#&#8203;2749](mozilla/sccache#2749)
- treat -ivfsoverlay as a preprocessor-only argument by [@&#8203;glandium](https://github.com/glandium) in [#&#8203;2767](mozilla/sccache#2767)
- gcc: refine response-file tokenizer visibility and whitespace handling by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2772](mozilla/sccache#2772)
- Fix description of Unix socket-based Redis connection by [@&#8203;Toorero](https://github.com/Toorero) in [#&#8203;2769](mozilla/sccache#2769)

##### Cleanup

- Simplify the code from pr [#&#8203;2761](mozilla/sccache#2761) by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2774](mozilla/sccache#2774)
- tests: pin libc in the dist test crate by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2784](mozilla/sccache#2784)
- Release 0.17.0 by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2783](mozilla/sccache#2783)

##### New Contributors

- [@&#8203;jwidauer](https://github.com/jwidauer) made their first contribution in [#&#8203;2758](mozilla/sccache#2758)
- [@&#8203;jpadilla](https://github.com/jpadilla) made their first contribution in [#&#8203;2770](mozilla/sccache#2770)
- [@&#8203;ranger-ross](https://github.com/ranger-ross) made their first contribution in [#&#8203;2782](mozilla/sccache#2782)
- [@&#8203;Toorero](https://github.com/Toorero) made their first contribution in [#&#8203;2769](mozilla/sccache#2769)

**Full Changelog**: <mozilla/sccache@v0.16.0...v0.17.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

---------

Co-authored-by: Renovate Bot <renovate@endsy.me>
Reviewed-on: https://gitea.endsy.me/op/red/pulls/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants