Skip to content

build(qt): state the macOS host's modifier return conversion (#2946) - #2947

Merged
zackees merged 1 commit into
masterfrom
fix/2946-qt-host-macos-modifiers
Oct 29, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2946-qt-host-macos-modifiers

Conversation

@zackees

@zackees zackees commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #2946.

shared/qt/platform/qt-host-macos.cpp.hpp returns an int accumulator from a uint32_t function, and AppleClang's -Wsign-conversion — on for the Qt app target since the ratchet (#2872 for #2625) — rejects it. Master f67176296 shows it on both macOS app builds and clang-analyze:

shared/qt/platform/qt-host-macos.cpp.hpp:43:9: error: implicit conversion changes signedness:
      'int' to 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-conversion]
   43 |         return obsModifiers;

The fix is the statement the POSIX sibling already carries (qt-host-posix.cpp.hpp:47, 5298ad7ec for #2900): the local stays int, the return states the widening. No flag, pin or target change.

RED → GREEN (local)

A reduced translation unit with this function's body and return, compiled the way the ratchet compiles it:

$ clang++ -std=c++17 -Wconversion -Wsign-conversion -Wfloat-conversion -Werror -c mods.cpp
mods.cpp:15:9: error: implicit conversion changes signedness: 'int' to 'uint32_t'
      (aka 'unsigned int') [-Werror,-Wsign-conversion]
   15 |         return obsModifiers;
1 error generated.

$ # after static_cast<uint32_t>(obsModifiers)
$ clang++ -std=c++17 -Wconversion -Wsign-conversion -Wfloat-conversion -Werror -O2 -o mods mods.cpp && ./mods
modifier_combinations=16 differing_values=0

All 16 Qt::KeyboardModifiers combinations return the same value before and after. Local ./lint: == lane lint: ok.

macOS evidence

git log -1: 239091cae. scheduled.yaml workflow_dispatch on this branch: 40920717013.

qt-host-macos.cpp.hpp no longer appears in any of the three jobs:

Job Result for this file
Analyze 🔬 / macOS 🍏 (clang-analyze) clean — its remaining findings are frontend/utility/platform-osx.mm.hpp:238,239,768
Build 🧱 / macOS 🍏 (x86_64) clean — its remaining finding is shared/properties-view/properties-view.cpp.hpp:1872
Build 🧱 / macOS 🍏 (arm64) was still running at hand-off; it compiles the same unity group

Those two files are master's own unstated conversions, outside this PR; filed as #2950 so the lane can finish. This PR does not claim the lane is green — it states the one site it was filed for, and the lanes confirm it.

Tiers that do not apply: no Rust unit, C test, protocol or runtime behaviour change.

`qt_platform::translate_modifiers()` accumulates `INTERACT_*` flags in an
`int` and returns them as `uint32_t`. AppleClang's `-Wsign-conversion`
(part of the conversion ratchet #2872 added for #2625) rejects the return
on both macOS app builds and the clang-analyze lane:

    qt-host-macos.cpp.hpp:43:9: error: implicit conversion changes
    signedness: 'int' to 'uint32_t' (aka 'unsigned int')
    [-Werror,-Wsign-conversion]

    return obsModifiers;

The statement is the one the POSIX sibling already carries
(`qt-host-posix.cpp.hpp:47`, `5298ad7ec` for #2900): the local stays
`int`, the return states the widening. Every `INTERACT_*` flag is a
non-negative constant, so the returned value is unchanged - all 16
modifier combinations return the same value with and without the cast.

RED: a reduced translation unit with this function's return compiled
under `-Wconversion -Wsign-conversion -Werror` stops on the diagnostic
above. GREEN: the same unit with `static_cast<uint32_t>` compiles, and
the run agrees on all 16 combinations.

Refs #2946

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review (2026-10-29).

The cast is correct in itself: translate_modifiers() returns uint32_t while the local is int, which is exactly the -Wsign-conversion error master's macOS app lane reports (return obsModifiers;, line 43).

Two things before this lands:

  1. The identical finding is in the sibling host files. shared/qt/platform/qt-host-posix.cpp.hpp (lines 29–47) and qt-host-windows.cpp.hpp (lines 24–42) both declare int obsModifiers and return obsModifiers; from a uint32_t function. A macOS-only cast leaves the class of finding: the next lane to compile those two files stops on the same diagnostic.
  2. #2940 already carries this fix, for all three files. It changes the accumulator to uint32_t obsModifiers in qt-host-macos.cpp.hpp, -posix and -windows, and it is already in the master merge queue (position 5). #2947 and #2940 edit the same hunk of qt-host-macos.cpp.hpp, so whichever lands second conflicts.

Recommendation: close #2947 as superseded by #2940 instead of queueing it — #2940 is the complete version and is already queued. If you would rather keep #2947 as the narrow macOS fix, extend it to the posix and windows accumulators so the three files agree, and expect a one-line rebase of #2940 afterwards.

Not queueing it from here because of the overlap; leaving the call to you.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator

  • PR CI on this head: fully green (Fast Gate ⚡, Qt Frontend Linux 🐧, Cross Compile 🧰 (mac-arm64), Format 🔍, CI Gate ✅).
  • Local ./lint: == lane lint: ok. ./unittest was not run to completion on this host (it was still working through Tier 2 at the 15-minute mark); PR CI covers the selected lanes.
  • Branch is 3 commits behind master (it was cut at c2df54a7f); the queue rebases.
  • Merge queue entry already reported by GitHub: queued.

Evidence for the file itself is in the description: scheduled.yaml 40920717013 has all three macOS jobs past qt-host-macos.cpp.hpp, with their remaining failures in files this PR does not touch (#2950).

Merged via the queue into master with commit db2c6cf Oct 29, 2026
67 of 74 checks passed
@zackees
zackees deleted the fix/2946-qt-host-macos-modifiers branch October 29, 2026 18: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.

build: master's macOS build is red in shared/qt/platform/qt-host-macos.cpp.hpp's modifier return (#2625, #2872)

1 participant