Remove building with NOCRYPTO option
[minix.git] / external / bsd / llvm / dist / clang / test / SemaOpenCL / invalid-kernel-parameters.cl
blobde32eae8821e6865fe64e76cff34427a7bafd873
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
6 // Disallowed: parameters with type
7 // bool, half, size_t, ptrdiff_t, intptr_t, and uintptr_t
8 // or a struct / union with any of these types in them
10 // TODO: Ban int types, size_t, ptrdiff_t ...
12 kernel void bool_arg(bool x) { } // expected-error{{'bool' cannot be used as the type of a kernel parameter}}
14 kernel void half_arg(half x) { } // expected-error{{'half' cannot be used as the type of a kernel parameter}}
16 typedef struct ContainsBool // expected-note{{within field of type 'ContainsBool' declared here}}
18 bool x; // expected-note{{field of illegal type 'bool' declared here}}
19 } ContainsBool;
21 kernel void bool_in_struct_arg(ContainsBool x) { } // expected-error{{'ContainsBool' (aka 'struct ContainsBool') cannot be used as the type of a kernel parameter}}
25 typedef struct FooImage2D // expected-note{{within field of type 'FooImage2D' declared here}}
27 image2d_t imageField; // expected-note{{field of illegal type 'image2d_t' declared here}}
28 } FooImage2D;
30 kernel void image_in_struct_arg(FooImage2D arg) { } // expected-error{{struct kernel parameters may not contain pointers}}
32 typedef struct Foo // expected-note{{within field of type 'Foo' declared here}}
34 int* ptrField; // expected-note{{field of illegal pointer type 'int *' declared here}}
35 } Foo;
37 kernel void pointer_in_struct_arg(Foo arg) { } // expected-error{{struct kernel parameters may not contain pointers}}
39 typedef union FooUnion // expected-note{{within field of type 'FooUnion' declared here}}
41 int* ptrField; // expected-note{{field of illegal pointer type 'int *' declared here}}
42 } FooUnion;
44 kernel void pointer_in_union_arg(FooUnion arg) { }// expected-error{{union kernel parameters may not contain pointers}}
46 typedef struct NestedPointer // expected-note 2 {{within field of type 'NestedPointer' declared here}}
48 int x;
49 struct InnerNestedPointer
51 int* ptrField; // expected-note 3 {{field of illegal pointer type 'int *' declared here}}
52 } inner; // expected-note 3 {{within field of type 'struct InnerNestedPointer' declared here}}
53 } NestedPointer;
55 kernel void pointer_in_nested_struct_arg(NestedPointer arg) { }// expected-error{{struct kernel parameters may not contain pointers}}
57 struct NestedPointerComplex // expected-note{{within field of type 'NestedPointerComplex' declared here}}
59 int foo;
60 float bar;
62 struct InnerNestedPointerComplex
64 int innerFoo;
65 int* innerPtrField; // expected-note{{field of illegal pointer type 'int *' declared here}}
66 } inner; // expected-note{{within field of type 'struct InnerNestedPointerComplex' declared here}}
68 float y;
69 float z[4];
72 kernel void pointer_in_nested_struct_arg_complex(struct NestedPointerComplex arg) { }// expected-error{{struct kernel parameters may not contain pointers}}
74 typedef struct NestedBool // expected-note 2 {{within field of type 'NestedBool' declared here}}
76 int x;
77 struct InnerNestedBool
79 bool boolField; // expected-note 2 {{field of illegal type 'bool' declared here}}
80 } inner; // expected-note 2 {{within field of type 'struct InnerNestedBool' declared here}}
81 } NestedBool;
83 kernel void bool_in_nested_struct_arg(NestedBool arg) { } // expected-error{{'NestedBool' (aka 'struct NestedBool') cannot be used as the type of a kernel parameter}}
85 // Warning emitted again for argument used in other kernel
86 kernel void bool_in_nested_struct_arg_again(NestedBool arg) { } // expected-error{{'NestedBool' (aka 'struct NestedBool') cannot be used as the type of a kernel parameter}}
89 // Check for note with a struct not defined inside the struct
90 typedef struct NestedBool2Inner
92 bool boolField; // expected-note{{field of illegal type 'bool' declared here}}
93 } NestedBool2Inner;
95 typedef struct NestedBool2 // expected-note{{within field of type 'NestedBool2' declared here}}
97 int x;
98 NestedBool2Inner inner; // expected-note{{within field of type 'NestedBool2Inner' (aka 'struct NestedBool2Inner') declared here}}
99 } NestedBool2;
101 kernel void bool_in_nested_struct_2_arg(NestedBool2 arg) { } // expected-error{{'NestedBool2' (aka 'struct NestedBool2') cannot be used as the type of a kernel parameter}}
104 struct InnerInner
106 int* foo;
107 bool x;
110 struct Valid
112 float c;
113 float d;
116 struct Inner
118 struct Valid v;
119 struct InnerInner a;
120 struct Valid g;
121 struct InnerInner b;
124 struct AlsoUser // expected-note{{within field of type 'AlsoUser' declared here}}
126 float x;
127 struct Valid valid1;
128 struct Valid valid2;
129 struct NestedPointer aaaa; // expected-note{{within field of type 'struct NestedPointer' declared here}}
132 kernel void pointer_in_nested_struct_arg_2(struct Valid valid, struct NestedPointer arg, struct AlsoUser also) { } // expected-error 2 {{struct kernel parameters may not contain pointers}}