Skip to content

[SYCL]Remove warning about SYCL_EXTERNAL with pointers #2722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -11131,11 +11131,6 @@ def warn_sycl_pass_by_value_deprecated
def warn_sycl_pass_by_reference_future
: Warning<"Passing of kernel functions by reference is a SYCL 2020 extension">,
InGroup<Sycl2017Compat>, ShowInSystemHeader;
def warn_sycl_attibute_function_raw_ptr
: Warning<"SYCL 1.2.1 specification does not allow %0 attribute applied "
"to a function with a raw pointer "
"%select{return type|parameter type}1">,
InGroup<SyclStrict>, DefaultError;
def warn_sycl_implicit_decl
: Warning<"SYCL 1.2.1 specification requires an explicit forward "
"declaration for a kernel type name; your program may not "
Expand Down
9 changes: 0 additions & 9 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4539,15 +4539,6 @@ static void handleSYCLDeviceAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
S.Diag(AL.getLoc(), diag::err_sycl_attibute_cannot_be_applied_here) << AL;
return;
}
if (FD->getReturnType()->isPointerType()) {
S.Diag(AL.getLoc(), diag::warn_sycl_attibute_function_raw_ptr)
<< AL << 0 /* function with a raw pointer return type */;
}
for (const ParmVarDecl *Param : FD->parameters())
if (Param->getType()->isPointerType()) {
S.Diag(AL.getLoc(), diag::warn_sycl_attibute_function_raw_ptr)
<< AL << 1 /* function with a raw pointer parameter type */;
}

handleSimpleAttribute<SYCLDeviceAttr>(S, D, AL);
}
Expand Down
1 change: 0 additions & 1 deletion clang/test/SemaSYCL/restrict-recursion3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ using myFuncDef = int(int, int);

typedef __typeof__(sizeof(int)) size_t;

// expected-warning@+1 {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
SYCL_EXTERNAL
void *operator new(size_t);

Expand Down
1 change: 0 additions & 1 deletion clang/test/SemaSYCL/restrict-recursion4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ using myFuncDef = int(int, int);

typedef __typeof__(sizeof(int)) size_t;

// expected-warning@+1 {{SYCL 1.2.1 specification does not allow 'sycl_device' attribute applied to a function with a raw pointer return type}}
SYCL_EXTERNAL
void *operator new(size_t);

Expand Down
25 changes: 3 additions & 22 deletions clang/test/SemaSYCL/sycl-device.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify %s
// RUN: %clang_cc1 -verify -DNO_SYCL %s

// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify -DNOT_STRICT -Wno-error=sycl-strict -Wno-sycl-strict %s
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify -DWARN_STRICT -Wno-error=sycl-strict %s

#ifndef NO_SYCL

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

#if defined(NOT_STRICT)
__attribute__((sycl_device))
int* func3() { return nullptr; }

__attribute__((sycl_device))
void func3(int *) {}
#elif defined(WARN_STRICT)
__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}}
int* func3() { return nullptr; }

__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}}
void func3(int *) {}
#else
__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}}
int* func3() { return nullptr; }

__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}}
void func3(int *) {}
#endif
__attribute__((sycl_device)) int *func0() { return nullptr; }

__attribute__((sycl_device)) void func2(int *) {}

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