Repository navigation
build(qt): state the macOS host's modifier return conversion (#2946) - #2947
Conversation
`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
left a comment
There was a problem hiding this comment.
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:
- The identical finding is in the sibling host files.
shared/qt/platform/qt-host-posix.cpp.hpp(lines 29–47) andqt-host-windows.cpp.hpp(lines 24–42) both declareint obsModifiersandreturn obsModifiers;from auint32_tfunction. A macOS-only cast leaves the class of finding: the next lane to compile those two files stops on the same diagnostic. - #2940 already carries this fix, for all three files. It changes the accumulator to
uint32_t obsModifiersinqt-host-macos.cpp.hpp,-posixand-windows, and it is already in the master merge queue (position 5). #2947 and #2940 edit the same hunk ofqt-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.
|
Handed off to the coordinator
Evidence for the file itself is in the description: |
Fixes #2946.
shared/qt/platform/qt-host-macos.cpp.hppreturns anintaccumulator from auint32_tfunction, and AppleClang's-Wsign-conversion— on for the Qt app target since the ratchet (#2872 for #2625) — rejects it. Masterf67176296shows it on both macOS app builds and clang-analyze:The fix is the statement the POSIX sibling already carries (
qt-host-posix.cpp.hpp:47,5298ad7ecfor #2900): the local staysint, 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:
All 16
Qt::KeyboardModifierscombinations return the same value before and after. Local./lint:== lane lint: ok.macOS evidence
git log -1:239091cae.scheduled.yamlworkflow_dispatchon this branch: 40920717013.qt-host-macos.cpp.hppno longer appears in any of the three jobs:Analyze 🔬 / macOS 🍏 (clang-analyze)frontend/utility/platform-osx.mm.hpp:238,239,768Build 🧱 / macOS 🍏 (x86_64)shared/properties-view/properties-view.cpp.hpp:1872Build 🧱 / macOS 🍏 (arm64)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.