diff options
| author | Mukund Keshava <mkeshava@nvidia.com> | 2025-05-15 14:45:43 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-15 14:45:43 +0530 |
| commit | ed837e205f3e67c4ae112f544cfe486ca3cc8455 (patch) | |
| tree | ec67d243bcea5c613d24c898c301051117497577 /tests/diagnostics | |
| parent | 49de1e8f60c698e9d524befacc988fb06574b234 (diff) | |
Rename 'main' on some backends (#7105)
* Rename 'main' on some backednds
Fixes #5542
Some backends like cuda, metal, cpu do not allow 'main' as the entry
point. This commit adds a new warning that is emitted when a program
uses main as the entry point. In addition to emitting the warning, it
internally renames the entry point to "main_". It also adds a test to
check these for the three backends.
* format code
* move test to diagnostics
* rename test to diagnostic
* generate unique name
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/entry-point-main-warning.slang | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/diagnostics/entry-point-main-warning.slang b/tests/diagnostics/entry-point-main-warning.slang new file mode 100644 index 000000000..9d880dbb1 --- /dev/null +++ b/tests/diagnostics/entry-point-main-warning.slang @@ -0,0 +1,14 @@ +// Test to check if we emit a warning and rename main to main_ on CUDA, CPU, metal backends + +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry main -target cuda +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry main -target metal +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -entry main -target cpp +[shader("compute")] +[numthreads(1,1,1)] +void main(RWBuffer<float> output) +{ + output[0] = 1.0f; +} + +// CHECK: warning 40100: entry point 'main' is not allowed, and has been renamed to 'main_0' +// CHECK: void main_
\ No newline at end of file |
