summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/missing-return-target.slang
blob: 8fc65efd104295e5a2fefd404ae4862f4ddfb4ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_NOT_SUPP): -entry computeMain -stage compute -target spirv
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_NOT_SUPP): -entry computeMain -stage compute -target glsl
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_NOT_SUPP): -entry computeMain -stage compute -target wgsl

//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SUPP):
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SUPP): -entry computeMain -stage compute -target hlsl
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SUPP): -entry computeMain -stage compute -target metal
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SUPP): -entry computeMain -stage compute -target cpp
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SUPP): -entry computeMain -stage compute -target cuda

// Some compilation targets allow missing returns while some do not.
// This test ensures that either errors and warnings are emitted appropriately.

RWStructuredBuffer<uint> out;

// CHECK_NOT_SUPP: warning 41010: non-void function
// CHECK_NOT_SUPP: error 41009: non-void function

// CHECK_SUPP: warning 41010: non-void function

uint func()
{
}

[shader("compute")]
void computeMain()
{
    out[0] = func();
}