From fb9da4b4e4974190404dfc2d384594b6179612d8 Mon Sep 17 00:00:00 2001 From: Chris B Date: Fri, 3 May 2024 14:13:11 -0500 Subject: [PATCH] Add new -Whlsl-legacy-literal warnings (#229) This updates the specification to include additional warnings for diagnosing literal values that will change signedness. --- proposals/0017-conforming-literals.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/proposals/0017-conforming-literals.md b/proposals/0017-conforming-literals.md index 83f6b4e0..55cee6df 100644 --- a/proposals/0017-conforming-literals.md +++ b/proposals/0017-conforming-literals.md @@ -278,7 +278,9 @@ the literal types that can be explicitly specified. This will result in conversion warnings on implicit conversion to minimum precision types which will notify users of the places where their code may need to be updated. -### New -Wdouble-promotion Warnings +### New Warnings + +#### -Wdouble-promotion Along with the implementation of this proposal a new warning group `-Wdouble-promotion` is introduced to identify implicit promotions for floating @@ -301,4 +303,22 @@ These warnings will be default disabled, but available in all language modes. > support these warnings in Clang, and users will have the same command line > option to enable this warning for DXC and Clang. +#### -Whlsl-legacy-literal + +The new `-Whlsl-legacy-literal` warning group identifies hexadecimal and octal +literal values that will change signedness under the new HLSL language rules. +The change in sign behavior can have a huge impact on bitwise operations as +described in the cases above. + +These warnings will be default disabled, but available in all language modes. + +The following warning text will be emitted for any octal or hexadecimal literal +that has its most-significant bit set. For legacy language modes, the position +of the most significant bit is based on a 32-bit representation if the value is +less than or equal to `UINT32_MAX`, otherwise it is 64-bit. + +``` +warning: literal value is treated as signed in HLSL before 202x, and unsigned in 202x and later +``` +