diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index a038e4f08d115..bb71f62373778 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11293,9 +11293,6 @@ def warn_sycl_implicit_decl "declaration for a kernel type name; your program may not " "be portable">, InGroup, ShowInSystemHeader, DefaultIgnore; -def warn_sycl_restrict_recursion - : Warning<"SYCL kernel cannot call a recursive function">, - InGroup, DefaultError; def err_ivdep_duplicate_arg : Error< "duplicate argument to 'ivdep'; attribute requires one or both of a safelen " "and array">; diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index 9c9a5bdfa8fe5..b2810b8cf3086 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -376,7 +376,8 @@ class MarkDeviceFunction : public RecursiveASTVisitor { // all functions used by kernel have already been parsed and have // definitions. if (RecursiveSet.count(Callee) && !ConstexprDepth) { - SemaRef.Diag(e->getExprLoc(), diag::warn_sycl_restrict_recursion); + SemaRef.Diag(e->getExprLoc(), diag::err_sycl_restrict) + << Sema::KernelCallRecursiveFunction; SemaRef.Diag(Callee->getSourceRange().getBegin(), diag::note_sycl_recursive_function_declared_here) << Sema::KernelCallRecursiveFunction; diff --git a/clang/test/SemaSYCL/restrict-recursion3.cpp b/clang/test/SemaSYCL/restrict-recursion3.cpp index 9aebe88df63f2..b66e3cd580cc3 100644 --- a/clang/test/SemaSYCL/restrict-recursion3.cpp +++ b/clang/test/SemaSYCL/restrict-recursion3.cpp @@ -34,7 +34,7 @@ template __attribute__((sycl_kernel)) void kernel_single_task2(const Func &kernelFunc) { // expected-note@+1 {{called by 'kernel_single_task2}} kernelFunc(); - // expected-warning@+1 2{{SYCL kernel cannot call a recursive function}} + // expected-error@+1 2{{SYCL kernel cannot call a recursive function}} kernel_single_task2(kernelFunc); } diff --git a/clang/test/SemaSYCL/restrict-recursion4.cpp b/clang/test/SemaSYCL/restrict-recursion4.cpp index 1fa5ec4ea0f61..ee0fdb20ce4c0 100644 --- a/clang/test/SemaSYCL/restrict-recursion4.cpp +++ b/clang/test/SemaSYCL/restrict-recursion4.cpp @@ -10,7 +10,7 @@ int fib(int n) { // expected-note@+1 2{{function implemented using recursion declared here}} void kernel2(void) { - // expected-warning@+1 {{SYCL kernel cannot call a recursive function}} + // expected-error@+1 {{SYCL kernel cannot call a recursive function}} kernel2(); } @@ -24,7 +24,7 @@ void *operator new(size_t); void usage2(myFuncDef functionPtr) { // expected-error@+1 {{SYCL kernel cannot allocate storage}} int *ip = new int; - // expected-warning@+1 {{SYCL kernel cannot call a recursive function}} + // expected-error@+1 {{SYCL kernel cannot call a recursive function}} kernel2(); }