Skip to content

fix(macOS): emplace_back constructor fix; display_device interface factory#280

Open
martona wants to merge 3 commits into
LizardByte:masterfrom
martona:library-fixes
Open

fix(macOS): emplace_back constructor fix; display_device interface factory#280
martona wants to merge 3 commits into
LizardByte:masterfrom
martona:library-fixes

Conversation

@martona

@martona martona commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Description

The necessary changes for LizardByte/Sunshine#5338 to clear. Also includes the interface factory so display_device.cpp does not have to pull in platform-specific libdisplaydevice includes.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@sonarqubecloud

Copy link
Copy Markdown

@martona

martona commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Just to clarify the issue:

  • emplace_back(device_id, display_name, friendly_name, edid, info): Sonar happy, older toolchain build broken.
  • emplace_back(EnumeratedDevice{...}): Build works, Sonar flags S6011.
  • push_back(EnumeratedDevice{...}): Build works, Sonar tells us to use emplace_back.

I went with push_back and NOSONAR; the only way out of this would be to add a constructor to EnumeratedDevice so the first format works everywhere. But that'd make EnumeratedDevice no longer an aggregate, and cascade into a lot of code change just to keep Sonar happy.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.15%. Comparing base (6561607) to head (8010521).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/macos/factory.cpp 55.55% 0 Missing and 4 partials ⚠️
src/windows/win_display_device_general.cpp 0.00% 0 Missing and 2 partials ⚠️
src/macos/mac_display_device_general.cpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #280      +/-   ##
==========================================
- Coverage   80.17%   80.15%   -0.02%     
==========================================
  Files          59       63       +4     
  Lines        3370     3397      +27     
  Branches     1534     1545      +11     
==========================================
+ Hits         2702     2723      +21     
- Misses        326      355      +29     
+ Partials      342      319      -23     
Flag Coverage Δ
Linux 93.45% <100.00%> (+0.05%) ⬆️
Windows-AMD64 91.06% <84.61%> (-0.05%) ⬇️
Windows-ARM64 67.05% <60.00%> (+0.01%) ⬆️
macOS 57.81% <50.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/common/factory.cpp 100.00% <100.00%> (ø)
src/common/include/display_device/factory.h 100.00% <100.00%> (ø)
src/windows/factory.cpp 100.00% <100.00%> (ø)
src/macos/mac_display_device_general.cpp 55.10% <0.00%> (ø)
src/windows/win_display_device_general.cpp 96.72% <0.00%> (-3.28%) ⬇️
src/macos/factory.cpp 55.55% <55.55%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6561607...8010521. Read the comment docs.

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.

1 participant