File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -10979,6 +10979,9 @@ def warn_sycl_implicit_decl
10979
10979
"declaration for a kernel type name; your program may not "
10980
10980
"be portable">,
10981
10981
InGroup<SyclStrict>, DefaultIgnore;
10982
+ def warn_sycl_restrict_recursion
10983
+ : Warning<"SYCL kernel cannot call a recursive function">,
10984
+ InGroup<SyclStrict>, DefaultError;
10982
10985
def err_ivdep_duplicate_arg : Error<
10983
10986
"duplicate argument to 'ivdep'. attribute requires one or both of a safelen "
10984
10987
"and array">;
Original file line number Diff line number Diff line change @@ -354,8 +354,7 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
354
354
// all functions used by kernel have already been parsed and have
355
355
// definitions.
356
356
if (RecursiveSet.count (Callee) && !ConstexprDepth) {
357
- SemaRef.Diag (e->getExprLoc (), diag::err_sycl_restrict)
358
- << Sema::KernelCallRecursiveFunction;
357
+ SemaRef.Diag (e->getExprLoc (), diag::warn_sycl_restrict_recursion);
359
358
SemaRef.Diag (Callee->getSourceRange ().getBegin (),
360
359
diag::note_sycl_recursive_function_declared_here)
361
360
<< Sema::KernelCallRecursiveFunction;
Original file line number Diff line number Diff line change 1
- // RUN: %clang_cc1 -fsycl -fsycl-is-device -fcxx-exceptions -Wno-return-type -Wno-sycl-strict -verify -fsyntax-only -std=c++17 %s
1
+ // RUN: %clang_cc1 -fsycl -fsycl-is-device -fcxx-exceptions -Wno-return-type -Wno-error= sycl-strict -verify -fsyntax-only -std=c++17 %s
2
2
3
3
// This recursive function is not called from sycl kernel,
4
4
// so it should not be diagnosed.
@@ -16,6 +16,7 @@ using myFuncDef = int(int, int);
16
16
17
17
typedef __typeof__ (sizeof (int )) size_t;
18
18
19
+ // expected-warning@+1 {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
19
20
SYCL_EXTERNAL
20
21
void *operator new (size_t );
21
22
@@ -34,7 +35,7 @@ template <typename name, typename Func>
34
35
__attribute__ ((sycl_kernel)) void kernel_single_task2(Func kernelFunc) {
35
36
// expected-note@+1 {{called by 'kernel_single_task2}}
36
37
kernelFunc ();
37
- // expected-error @+1 2{{SYCL kernel cannot call a recursive function}}
38
+ // expected-warning @+1 2{{SYCL kernel cannot call a recursive function}}
38
39
kernel_single_task2<name, Func>(kernelFunc);
39
40
}
40
41
Original file line number Diff line number Diff line change 1
- // RUN: %clang_cc1 -fsycl -fsycl-is-device -fcxx-exceptions -Wno-return-type -Wno-sycl-strict -verify -fsyntax-only -std=c++17 %s
1
+ // RUN: %clang_cc1 -fsycl -fsycl-is-device -fcxx-exceptions -Wno-return-type -Wno-error= sycl-strict -verify -fsyntax-only -std=c++17 %s
2
2
3
3
// This recursive function is not called from sycl kernel,
4
4
// so it should not be diagnosed.
@@ -10,21 +10,22 @@ int fib(int n) {
10
10
11
11
// expected-note@+1 2{{function implemented using recursion declared here}}
12
12
void kernel2 (void ) {
13
- // expected-error @+1 {{SYCL kernel cannot call a recursive function}}
13
+ // expected-warning @+1 {{SYCL kernel cannot call a recursive function}}
14
14
kernel2 ();
15
15
}
16
16
17
17
using myFuncDef = int (int , int );
18
18
19
19
typedef __typeof__ (sizeof (int )) size_t;
20
20
21
+ // expected-warning@+1 {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
21
22
SYCL_EXTERNAL
22
23
void *operator new (size_t );
23
24
24
25
void usage2 (myFuncDef functionPtr) {
25
26
// expected-error@+1 {{SYCL kernel cannot allocate storage}}
26
27
int *ip = new int ;
27
- // expected-error @+1 {{SYCL kernel cannot call a recursive function}}
28
+ // expected-warning @+1 {{SYCL kernel cannot call a recursive function}}
28
29
kernel2 ();
29
30
}
30
31
You can’t perform that action at this time.
0 commit comments