Skip to content

Disallow volatile keyword#8397

Merged
bob80905 merged 5 commits into
microsoft:mainfrom
bob80905:remove_volatile_as_keyword
Apr 28, 2026
Merged

Disallow volatile keyword#8397
bob80905 merged 5 commits into
microsoft:mainfrom
bob80905:remove_volatile_as_keyword

Conversation

@bob80905

@bob80905 bob80905 commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

volatile is not a valid keyword in HLSL, it is meaningless in this language.
However, it comes as a result of the fact that HLSL is build on a C/C++ compiler, so there are some C++ artifacts that are part of the language.
This scenario goes into more detail: llvm/wg-hlsl#300
Though DXC currently does and seems to always have compiled with the volatile keyword, this is not sensible and should be disallowed.
Fixes #8391
Assisted by: Github Copilot

@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

✅ With the latest revision this PR passed the C/C++ code formatter.

@damyanp damyanp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMUE

@alsepkow alsepkow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments from @inbelic and I.
I think we also need an 'assisted by AI' in the PR description?

It would also be good to mention the scenario capturing this for llvm llvm/wg-hlsl#300 as without it it wasn't clear that we actually don't support volatile. Even copilot told me HLSL supports it (And in some ways it was right! It tried compiling with it).

Comment thread tools/clang/test/HLSLFileCheck/hlsl/types/conversions/varmods-syntax_Mod.hlsl Outdated
Comment thread tools/clang/test/HLSL/rewriter/varmods-syntax_noerr.hlsl Outdated
@github-project-automation github-project-automation Bot moved this from New to In progress in HLSL Roadmap Apr 23, 2026

@alsepkow alsepkow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bob80905 bob80905 merged commit d73829d into microsoft:main Apr 28, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in HLSL Roadmap Apr 28, 2026
AnastaZIuk referenced this pull request in Devsh-Graphics-Programming/Nabla May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Disallow volatile keyword

3 participants