Skip to content

Commit 49e595e

Browse files
[SYCL] Remove attribute ignored diagnostic for sycl_device (#6095)
Remove warning diagnostic on host compilation when using __attribute__((sycl_device)) Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
1 parent d019f29 commit 49e595e

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ def : MutualExclusions<[CUDAConstant, CUDAShared, HIPManaged]>;
12261226
def SYCLDevice : InheritableAttr {
12271227
let Spellings = [GNU<"sycl_device">];
12281228
let Subjects = SubjectList<[Function]>;
1229-
let LangOpts = [SYCLIsDevice];
1229+
let LangOpts = [SYCLIsDevice, SilentlyIgnoreSYCLIsHost];
12301230
let Documentation = [SYCLDeviceDocs];
12311231
}
12321232

clang/test/SemaSYCL/sycl-device.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
2-
// RUN: %clang_cc1 -verify -DNO_SYCL %s
1+
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify -DSYCL %s
2+
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DHOST %s
3+
// RUN: %clang_cc1 -verify %s
34

4-
#ifndef NO_SYCL
5+
// Semantic tests for sycl_device attribute
6+
7+
#ifdef SYCL
58

69
__attribute__((sycl_device)) // expected-warning {{'sycl_device' attribute only applies to functions}}
710
int N;
@@ -35,8 +38,13 @@ __attribute__((sycl_device)) int *func0() { return nullptr; }
3538

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

38-
#else // NO_SYCL
41+
#elif defined(HOST)
42+
43+
// expected-no-diagnostics
44+
__attribute__((sycl_device)) void func3() {}
45+
46+
#else
3947
__attribute__((sycl_device)) // expected-warning {{'sycl_device' attribute ignored}}
4048
void baz() {}
4149

42-
#endif // NO_SYCL
50+
#endif

0 commit comments

Comments
 (0)