From 345b328de2875976664fd45565270b90caaae1f5 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 9 Apr 2020 12:10:21 -0400 Subject: [PATCH 1/2] [SYCL] Add regression test for operator names Some libraries require -fno-operator-names, and so we should avoid using operator name keywords in SYCL headers. Signed-off-by: John Pennycook --- sycl/test/regression/operator-names.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sycl/test/regression/operator-names.cpp diff --git a/sycl/test/regression/operator-names.cpp b/sycl/test/regression/operator-names.cpp new file mode 100644 index 0000000000000..5dc850ee3de2e --- /dev/null +++ b/sycl/test/regression/operator-names.cpp @@ -0,0 +1,11 @@ +// RUN: %clangxx -fsycl -c %s -o %t.out -Wno-deprecated -fno-operator-names +// +//===----------------------------------------------------------------------===// +// This test checks if any SYCL header files use C++ operator name keywords +// e.g. and, or, not +// +// This test does not use -fsyntax-only because it does not appear to respect +// the -fno-operator-names option +//===----------------------------------------------------------------------===// + +#include From b37597dc69c13d9c91410d101e64b32916a3f7ce Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 9 Apr 2020 12:14:32 -0400 Subject: [PATCH 2/2] [SYCL] Remove operator name keywords Two instances of "not" in group_algorithms.hpp. Signed-off-by: John Pennycook --- sycl/include/CL/sycl/intel/group_algorithm.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/intel/group_algorithm.hpp b/sycl/include/CL/sycl/intel/group_algorithm.hpp index 8da599d73573d..86304709c7e23 100644 --- a/sycl/include/CL/sycl/intel/group_algorithm.hpp +++ b/sycl/include/CL/sycl/intel/group_algorithm.hpp @@ -217,7 +217,7 @@ template bool none_of(Group g, bool pred) { "Group algorithms only support the sycl::group and " "intel::sub_group class."); #ifdef __SYCL_DEVICE_ONLY__ - return detail::spirv::GroupAll(not pred); + return detail::spirv::GroupAll(!pred); #else throw runtime_error("Group algorithms are not supported on host device.", PI_INVALID_DEVICE); @@ -239,7 +239,7 @@ EnableIfIsPointer none_of(Group g, Ptr first, Ptr last, static_assert(detail::is_generic_group::value, "Group algorithms only support the sycl::group and " "intel::sub_group class."); - return not any_of(g, first, last, pred); + return !any_of(g, first, last, pred); #else throw runtime_error("Group algorithms are not supported on host device.", PI_INVALID_DEVICE);