Skip to content

frontend: Fix the macOS build: copy QJsonArray elements in the GPU status loops - #1035

Merged
zackees merged 1 commit into
masterfrom
fix/gpu-status-range-loop
Oct 16, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/gpu-status-range-loop

Conversation

@zackees

@zackees zackees commented Oct 16, 2026

Copy link
Copy Markdown
Member

master's macOS build is broken. frontend/utility/GpuStatus.cpp (from #960, #963 and #1006) loops over QJsonArray with const QJsonValue &. The iterator returns QJsonValue by value, so Apple clang's -Werror,-Wrange-loop-bind-reference fails the build:

GpuStatus.cpp:36:25: error: loop variable 'arg' binds to a temporary value produced by a range of type 'const QJsonArray'
GpuStatus.cpp:56:25: error: loop variable 'line' binds to a temporary value ...
GpuStatus.cpp:59:25: error: loop variable 'value' binds to a temporary value ...

This is from the macOS arm64 job of release verify run 38867987465. Linux GCC does not have this warning, which is why my GCC syntax checks missed it.

Fix: const QJsonValue x (by value). There is no extra copy; the value is a temporary either way.

RED → GREEN, locally with clang:

  • RED: clang++ -fsyntax-only -Werror=range-loop-bind-reference gives the same three errors on master.
  • GREEN: with -Wall -Wextra -Werror -Wrange-loop-bind-reference -Wrange-loop-construct, GpuStatus.cpp is clean. No other for (const QJsonValue & exists in frontend/ or shared/.

ci-full runs the macOS builds. Please merge this ahead of the daily release.

@zackees zackees added the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 16, 2026
@zackees
zackees enabled auto-merge October 16, 2026 07:53
@zackees zackees closed this Oct 16, 2026
auto-merge was automatically disabled October 16, 2026 08:19

Pull request was closed

@zackees zackees reopened this Oct 16, 2026
@zackees
zackees force-pushed the fix/gpu-status-range-loop branch from b884c55 to bfb32fa Compare October 16, 2026 08:20
@zackees
zackees enabled auto-merge October 16, 2026 08:20
QJsonArray's iterator yields QJsonValue by value, so 'const QJsonValue &'
loop variables bind to temporaries; Apple clang builds with
-Werror,-Wrange-loop-bind-reference and the macOS build fails
(GpuStatus.cpp:36, :56, :59; run 38867987465). Linux GCC does not warn.
Reproduced and verified locally with clang -Werror.
@zackees zackees removed the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 16, 2026
@zackees
zackees force-pushed the fix/gpu-status-range-loop branch from bfb32fa to cf8f2de Compare October 16, 2026 08:27
@zackees

zackees commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

Rebased on master. PR runs no longer include full app builds (AGENTS.md: "the full OBS app builds never run from a PR path"), so the macOS evidence here is the local clang reproduction: same three errors before, clean after with -Werror -Wrange-loop-bind-reference. The first full macOS proof will be master's run after merge. I removed ci-full, which no longer has an effect.

@zackees
zackees added this pull request to the merge queue Oct 16, 2026
Merged via the queue into master with commit e9475f8 Oct 16, 2026
20 checks passed
@zackees
zackees deleted the fix/gpu-status-range-loop branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant