tests: fix the DirectStorage file read check build on MSVC 19.42 #1582

Merged
SimSalabimse merged 1 commit from upstream-pr/1589 into main 2026-11-24 14:47:23 +00:00
SimSalabimse commented 2026-11-24 14:39:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T14:39:04Z.


Change

tests/startup_dstorage_file_read_check.cpp:102 (added in #1493) does not compile on MSVC 19.42. The conditional alias ? low_alias.bytes : above_4g.bytes decays to const unsigned char *, and read() takes const unsigned char (&)[4]:

tests/startup_dstorage_file_read_check.cpp(102): error C2664: 'void `anonymous-namespace'::read(const char *,HANDLE,uint64_t,const unsigned char (&)[4])': cannot convert argument 4 from 'const unsigned char *' to 'const unsigned char (&)[4]'

The call now selects a pointer to the array and dereferences it, so the reference binds to the chosen unsigned char[4]. Test behaviour is unchanged.

Verification

Windows 11 26200, MSVC 19.42.34435 (VS 2022).

Before: cmake --build --preset dev exited 1 with the C2664 above.

After:

  • cmake --build --preset dev: exit 0
  • cmake --preset release and cmake --build --preset release: exit 0
  • ctest --preset dev --no-tests=error -R "dstorage" --output-on-failure: exit 0
  • ctest --preset release --no-tests=error -R "dstorage" --output-on-failure: exit 0

AI-assisted (Grok Build)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584284380 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1589). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T14:39:04Z. --- ## Change `tests/startup_dstorage_file_read_check.cpp:102` (added in #1493) does not compile on MSVC 19.42. The conditional `alias ? low_alias.bytes : above_4g.bytes` decays to `const unsigned char *`, and `read()` takes `const unsigned char (&)[4]`: ``` tests/startup_dstorage_file_read_check.cpp(102): error C2664: 'void `anonymous-namespace'::read(const char *,HANDLE,uint64_t,const unsigned char (&)[4])': cannot convert argument 4 from 'const unsigned char *' to 'const unsigned char (&)[4]' ``` The call now selects a pointer to the array and dereferences it, so the reference binds to the chosen `unsigned char[4]`. Test behaviour is unchanged. ## Verification Windows 11 26200, MSVC 19.42.34435 (VS 2022). Before: `cmake --build --preset dev` exited 1 with the C2664 above. After: - `cmake --build --preset dev`: exit 0 - `cmake --preset release` and `cmake --build --preset release`: exit 0 - `ctest --preset dev --no-tests=error -R "dstorage" --output-on-failure`: exit 0 - `ctest --preset release --no-tests=error -R "dstorage" --output-on-failure`: exit 0 AI-assisted (Grok Build)
upstream-sync closed this pull request 2026-11-24 15:02:12 +00:00
tedin7 commented 2026-11-24 15:02:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:50:42Z.

Review: COMMENTED


Reviewed commit 79f41db81c0cb30895e91d4bca1f8e1237f112d6 (tests: fix the DirectStorage file read check build on MSVC 19.42). No defects found.

Technical review

  • tests/startup_dstorage_file_read_check.cpp: Replaces alias ? low_alias.bytes : above_4g.bytes with *(alias ? &low_alias.bytes : &above_4g.bytes), avoiding array-to-pointer decay in the ternary expression so the result remains const unsigned char (&)[4] for read(...).

Verification

  • Linux:
    • python3 tests/docs_links_check.py — passed (16 Markdown files, 344 links).
    • python3 tests/bidi_controls_check.py — passed (1254 files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207):
    • Debug (--preset dev, startup_dstorage_file_read_check): 2/2 passed (startup_dstorage_file_read 0.01s, startup_dstorage_file_read_alias_control 0.01s).
    • Release /O2 (--preset release, startup_dstorage_file_read_check): 2/2 passed (startup_dstorage_file_read 0.01s, startup_dstorage_file_read_alias_control 0.01s).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041498602 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1589#pullrequestreview-6041498602). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:50:42Z. **Review:** COMMENTED --- Reviewed commit `79f41db81c0cb30895e91d4bca1f8e1237f112d6` (`tests: fix the DirectStorage file read check build on MSVC 19.42`). No defects found. ### Technical review - **`tests/startup_dstorage_file_read_check.cpp`**: Replaces `alias ? low_alias.bytes : above_4g.bytes` with `*(alias ? &low_alias.bytes : &above_4g.bytes)`, avoiding array-to-pointer decay in the ternary expression so the result remains `const unsigned char (&)[4]` for `read(...)`. ### Verification - **Linux**: - `python3 tests/docs_links_check.py` — passed (16 Markdown files, 344 links). - `python3 tests/bidi_controls_check.py` — passed (1254 files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207)**: - Debug (`--preset dev`, `startup_dstorage_file_read_check`): **2/2 passed** (`startup_dstorage_file_read` `0.01s`, `startup_dstorage_file_read_alias_control` `0.01s`). - Release `/O2` (`--preset release`, `startup_dstorage_file_read_check`): **2/2 passed** (`startup_dstorage_file_read` `0.01s`, `startup_dstorage_file_read_alias_control` `0.01s`). AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1582
No description provided.