Skip to content

fix(warnings): compile the DPI helper only where it is called - #18

Merged
zackees merged 1 commit into
masterfrom
fix/2626-w4-guarded-dpi-helper
Oct 28, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2626-w4-guarded-dpi-helper

Conversation

@zackees

@zackees zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member

SetHighDPIv2Scaling() is only called from the WinMain fallback inside #if CHROME_VERSION_BUILD < 5615. With the CEF version obs-rust/obs-studio pins, that call is compiled out, so the definition is an unreferenced static — C4505, which is fatal in the MSVC /W4 app build (obs-browser-helper.vcxproj), blocking obs-rust/obs-studio#2626's Windows lane.

This guards the definition with the same condition as the call, so the two cannot drift for any CEF version. No behaviour change: where the call survives, the definition survives.

Found by the /W4 app-lane verification on obs-rust/obs-studio#2691 (run 40762415176, Build windows arm64). obs-rust/obs-studio's side bumps this submodule pointer to d4276de.

`SetHighDPIv2Scaling()` is called from the one place in `WinMain` that is
guarded by `#if CHROME_VERSION_BUILD < 5615`. With the CEF version this fork
pins, the call is compiled out and the definition is left as an unreferenced
static, which is C4505 in the MSVC /W4 app build (obs-rust/obs-studio#2626,
`obs-browser-helper.vcxproj`). Guarding the definition with the same condition
keeps the two in step for every CEF version.

No behaviour change: where the call survives, the definition survives.
@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Superseded for obs-rust/obs-studio#2691: while I was writing this, a sibling worker landed the same lane green with a target-level /wd4505 on obs-browser-helper (126805122 on the #2691 branch), so the pointer bump was dropped rather than duplicated.

Keeping this open as the root-cause alternative — the definition and its only call site sit under the same #if CHROME_VERSION_BUILD < 5615, and a target-wide C4505 suppression also hides any future dead static in that target. Merge or close as you prefer; nothing downstream depends on it now.

@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 — correct and minimal.

  • SetHighDPIv2Scaling() has exactly one caller, obs-browser-page-main.cpp:90, and that call sits inside #if CHROME_VERSION_BUILD < 5615. With a newer CEF the whole path is compiled out, so the static becomes unreferenced and MSVC /W4 reports C4505. Guarding the definition with the same condition is the right fix; the alternative (an [[maybe_unused]] or a dummy reference) would hide the real condition.
  • CHROME_VERSION_BUILD is already used a few lines below in the same file, so the guard needs no new include.
  • The translation unit keeps its other content (shutdown_check_thread and the rest), so nothing becomes an empty TU, and no header declares the helper (it is static).
  • Comment names the diagnostic (C4505) and the reason, which is what the surrounding code does for its other warning fixes.

checks is green (1 passed). Merging; obs-browser has no merge queue and no required checks.

@zackees
zackees merged commit 92a28ed into master Oct 28, 2026
1 check passed
@zackees
zackees deleted the fix/2626-w4-guarded-dpi-helper branch October 28, 2026 20:46
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