Skip to content

Commit

Permalink
Add new -Whlsl-legacy-literal warnings (#229)
Browse files Browse the repository at this point in the history
This updates the specification to include additional warnings for
diagnosing literal values that will change signedness.
  • Loading branch information
llvm-beanz authored May 3, 2024
1 parent 15fcf15 commit fb9da4b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion proposals/0017-conforming-literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
<!-- {% endraw %} -->

0 comments on commit fb9da4b

Please sign in to comment.