Skip to content

Commit b4a3f03

Browse files
[SYCL] Remove warning about SYCL_EXTERNAL with pointers (#2722)
Raw pointers for SYCL_EXTERNAL are prohibited without generic address space. Generic address space doesn't exist in 1.2.1 and is optional in 2020. Our implementation isn't spec compliant to 1.2.1 because we use generic address space (among other). This diagnostic has no practical value to users. We aren't warning about something which has any impact for our implementation based on generic address space.
1 parent 6cc97d2 commit b4a3f03

File tree

5 files changed

+3
-38
lines changed

5 files changed

+3
-38
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11137,11 +11137,6 @@ def warn_sycl_pass_by_value_deprecated
1113711137
def warn_sycl_pass_by_reference_future
1113811138
: Warning<"Passing of kernel functions by reference is a SYCL 2020 extension">,
1113911139
InGroup<Sycl2017Compat>, ShowInSystemHeader;
11140-
def warn_sycl_attibute_function_raw_ptr
11141-
: Warning<"SYCL 1.2.1 specification does not allow %0 attribute applied "
11142-
"to a function with a raw pointer "
11143-
"%select{return type|parameter type}1">,
11144-
InGroup<SyclStrict>, DefaultError;
1114511140
def warn_sycl_implicit_decl
1114611141
: Warning<"SYCL 1.2.1 specification requires an explicit forward "
1114711142
"declaration for a kernel type name; your program may not "

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,15 +4587,6 @@ static void handleSYCLDeviceAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
45874587
S.Diag(AL.getLoc(), diag::err_sycl_attibute_cannot_be_applied_here) << AL;
45884588
return;
45894589
}
4590-
if (FD->getReturnType()->isPointerType()) {
4591-
S.Diag(AL.getLoc(), diag::warn_sycl_attibute_function_raw_ptr)
4592-
<< AL << 0 /* function with a raw pointer return type */;
4593-
}
4594-
for (const ParmVarDecl *Param : FD->parameters())
4595-
if (Param->getType()->isPointerType()) {
4596-
S.Diag(AL.getLoc(), diag::warn_sycl_attibute_function_raw_ptr)
4597-
<< AL << 1 /* function with a raw pointer parameter type */;
4598-
}
45994590

46004591
handleSimpleAttribute<SYCLDeviceAttr>(S, D, AL);
46014592
}

clang/test/SemaSYCL/restrict-recursion3.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ using myFuncDef = int(int, int);
1616

1717
typedef __typeof__(sizeof(int)) size_t;
1818

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}}
2019
SYCL_EXTERNAL
2120
void *operator new(size_t);
2221

clang/test/SemaSYCL/restrict-recursion4.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ using myFuncDef = int(int, int);
1818

1919
typedef __typeof__(sizeof(int)) size_t;
2020

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}}
2221
SYCL_EXTERNAL
2322
void *operator new(size_t);
2423

clang/test/SemaSYCL/sycl-device.cpp

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify %s
22
// RUN: %clang_cc1 -verify -DNO_SYCL %s
33

4-
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify -DNOT_STRICT -Wno-error=sycl-strict -Wno-sycl-strict %s
5-
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify -DWARN_STRICT -Wno-error=sycl-strict %s
6-
74
#ifndef NO_SYCL
85

96
__attribute__((sycl_device)) // expected-warning {{'sycl_device' attribute only applies to functions}}
@@ -34,25 +31,9 @@ class B {
3431
__attribute__((sycl_device)) virtual void bar() = 0;
3532
};
3633

37-
#if defined(NOT_STRICT)
38-
__attribute__((sycl_device))
39-
int* func3() { return nullptr; }
40-
41-
__attribute__((sycl_device))
42-
void func3(int *) {}
43-
#elif defined(WARN_STRICT)
44-
__attribute__((sycl_device)) // expected-warning {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
45-
int* func3() { return nullptr; }
46-
47-
__attribute__((sycl_device)) // expected-warning {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer parameter type}}
48-
void func3(int *) {}
49-
#else
50-
__attribute__((sycl_device)) // expected-error {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
51-
int* func3() { return nullptr; }
52-
53-
__attribute__((sycl_device)) // expected-error {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer parameter type}}
54-
void func3(int *) {}
55-
#endif
34+
__attribute__((sycl_device)) int *func0() { return nullptr; }
35+
36+
__attribute__((sycl_device)) void func2(int *) {}
5637

5738
#else // NO_SYCL
5839
__attribute__((sycl_device)) // expected-warning {{'sycl_device' attribute ignored}}

0 commit comments

Comments
 (0)