Skip to content

Fix -Winvalid-token-paste Clang warnings#55

Merged
vdwtanner merged 1 commit into
microsoft:masterfrom
ruiji-shi:user/ruishi/Clang-FixInvalidTokenPaste
May 11, 2026
Merged

Fix -Winvalid-token-paste Clang warnings#55
vdwtanner merged 1 commit into
microsoft:masterfrom
ruiji-shi:user/ruishi/Clang-FixInvalidTokenPaste

Conversation

@ruiji-shi

Copy link
Copy Markdown
Contributor

Summary

Remove a spurious ## between :: and the AbbreviatedView macro argument in the ViewTraits template specialization. The expansion D3D12TranslationLayer::##AbbreviatedView joins a punctuator (::) to an identifier (SRV, RTV, …), which forms two tokens (:: and SRV), not one — exactly what clang rejects under -Winvalid-token-paste.

Removing the ## yields the byte-identical token stream the author intended (D3D12TranslationLayer :: SRV) and is now standards-conforming. The legitimate paste ID3D11##View that builds ID3D11ShaderResourceView is preserved.

MSVC's traditional preprocessor silently dropped the broken paste, so the change has no behavioral impact on existing MSVC builds.

Errors fixed

File Error pattern Count (baseline)
include/view.hpp '::SRV', '::RTV', '::DSV', '::UAV', '::VDOV', '::VPIV', '::VPOV' 7 (per build target; 42 across all consumers per the original CSV)

Validation

Local build.

Remove spurious '##' between '::' and the AbbreviatedView macro arg in ViewTraits specialization. The paste 'D3D12TranslationLayer::##AbbreviatedView' joined a punctuator '::' to an identifier 'SRV' (etc.), which produces two tokens ('::' and 'SRV'), not one.

Removing the '##' yields the same token stream the author wanted ('D3D12TranslationLayer :: SRV') and is now standards-conforming. The legitimate paste 'ID3D11##View' that builds 'ID3D11ShaderResourceView' is preserved.

Validated by building dxg/d3d11/D3D11On12/linkdll with bcz -clang in two parallel OS enlistments: baseline 14 errors (covers both this header and D3D12TranslationLayer/include/View.hpp) -> fix 0 errors.
@ruiji-shi ruiji-shi marked this pull request as ready for review May 11, 2026 23:01
@vdwtanner

Copy link
Copy Markdown
Contributor

Can ignore that PR build failure - environment issue in the host I haven't had a chance to fix

@vdwtanner vdwtanner merged commit 0a7fd75 into microsoft:master May 11, 2026
1 of 2 checks passed
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.

2 participants