From e9f74ebfa83cd6aca39d7e3da2801cd47935bd1a Mon Sep 17 00:00:00 2001 From: "James Helferty (NVIDIA)" Date: Fri, 26 Sep 2025 13:01:38 -0400 Subject: Diagnostic on use of unsupported entry point modifiers (#8487) Generate a diagnostic warning whenever unsupported modifiers (keywords, attributes) are found on entry point parameters. These have been silently ignored up until now, with the parser accepting them but Slang not actually doing anything with them. Fixes #7151 --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- tests/diagnostics/entry-point-mod-errors.slang | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/diagnostics/entry-point-mod-errors.slang (limited to 'tests/diagnostics') diff --git a/tests/diagnostics/entry-point-mod-errors.slang b/tests/diagnostics/entry-point-mod-errors.slang new file mode 100644 index 000000000..090ce5e33 --- /dev/null +++ b/tests/diagnostics/entry-point-mod-errors.slang @@ -0,0 +1,22 @@ +// Test to check if we emit a warning when unhandled modifiers are applied to +// entry point parameters. + +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry computeMain -target cuda +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry computeMain -target metal +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry computeMain -target cpp +[shader("compute")] +[numthreads(1,1,1)] +void computeMain( +// CHECK: ([[#@LINE+1]]): warning 38010: {{.*}}vk::binding + [[vk::binding(5, 4)]] RWStructuredBuffer test1, +// CHECK: ([[#@LINE+1]]): warning 38010: {{.*}}vk::push_constant + [[vk::push_constant]] RWStructuredBuffer test2, +// CHECK: ([[#@LINE+1]]): warning 38010: {{.*}}register + RWStructuredBuffer test3 : register(r0), +// CHECK: ([[#@LINE+1]]): warning 38010: {{.*}}packoffset + float test4 : packoffset(c4), + RWBuffer output +) +{ + output[0] = test2[0]; +} -- cgit v1.2.3