Skip to content

Commit a0b0f67

Browse files
authored
[SYCL] Fix one more warning coming from SYCL headers (#1758)
Signed-off-by: Aleksander Fadeev <[email protected]>
1 parent 385520a commit a0b0f67

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ convertImpl(T Value) {
330330
detail::enable_if_t<is_sint_to_sint<T, R>::value && \
331331
!std::is_same<OpenCLT, OpenCLR>::value && \
332332
(std::is_same<OpenCLR, DestType>::value || \
333-
std::is_same<OpenCLR, signed char>::value && \
334-
std::is_same<DestType, char>::value), \
333+
(std::is_same<OpenCLR, signed char>::value && \
334+
std::is_same<DestType, char>::value)), \
335335
R> \
336336
convertImpl(T Value) { \
337337
OpenCLT OpValue = cl::sycl::detail::convertDataToType<T, OpenCLT>(Value); \
@@ -382,8 +382,8 @@ convertImpl(T Value) {
382382
typename OpenCLT, typename OpenCLR> \
383383
detail::enable_if_t<is_sint_to_float<T, R>::value && \
384384
(std::is_same<OpenCLR, DestType>::value || \
385-
std::is_same<OpenCLR, _Float16>::value && \
386-
std::is_same<DestType, half>::value), \
385+
(std::is_same<OpenCLR, _Float16>::value && \
386+
std::is_same<DestType, half>::value)), \
387387
R> \
388388
convertImpl(T Value) { \
389389
OpenCLT OpValue = cl::sycl::detail::convertDataToType<T, OpenCLT>(Value); \
@@ -402,8 +402,8 @@ __SYCL_GENERATE_CONVERT_IMPL(SToF, double)
402402
typename OpenCLT, typename OpenCLR> \
403403
detail::enable_if_t<is_uint_to_float<T, R>::value && \
404404
(std::is_same<OpenCLR, DestType>::value || \
405-
std::is_same<OpenCLR, _Float16>::value && \
406-
std::is_same<DestType, half>::value), \
405+
(std::is_same<OpenCLR, _Float16>::value && \
406+
std::is_same<DestType, half>::value)), \
407407
R> \
408408
convertImpl(T Value) { \
409409
OpenCLT OpValue = cl::sycl::detail::convertDataToType<T, OpenCLT>(Value); \
@@ -424,8 +424,8 @@ __SYCL_GENERATE_CONVERT_IMPL(UToF, double)
424424
detail::enable_if_t<is_float_to_float<T, R>::value && \
425425
!std::is_same<OpenCLT, OpenCLR>::value && \
426426
(std::is_same<OpenCLR, DestType>::value || \
427-
std::is_same<OpenCLR, _Float16>::value && \
428-
std::is_same<DestType, half>::value) && \
427+
(std::is_same<OpenCLR, _Float16>::value && \
428+
std::is_same<DestType, half>::value)) && \
429429
RoundingModeCondition<roundingMode>::value, \
430430
R> \
431431
convertImpl(T Value) { \

sycl/test/warnings/warnings.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
// RUN: %clangxx -fsycl --no-system-header-prefix=CL/ -Wall -Wextra -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Werror -Wno-unknown-cuda-version %s -o %t.out
1+
// RUN: %clangxx -fsycl --no-system-header-prefix=CL/sycl -fsyntax-only -Wall -Wextra -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Werror -Wno-unknown-cuda-version %s -o %t.out
22

33
#include <CL/sycl.hpp>
44

55
using namespace cl::sycl;
6-
7-
int main(void) {
8-
// add a very simple kernel to see if compilation succeeds with -Werror
9-
int data1[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
10-
buffer<int, 1> B(data1, range<1>(10), {property::buffer::use_host_ptr()});
11-
queue Q;
12-
Q.submit([&](handler &CGH) {
13-
auto Accessor = B.get_access<access::mode::read_write>(CGH);
14-
CGH.parallel_for<class TheSimpleKernel>(range<1>{10}, [=](id<1> Item) {
15-
Accessor[Item] = 0;
6+
int main() {
7+
vec<long, 4> newVec;
8+
queue myQueue;
9+
buffer<vec<long, 4>, 1> resultBuf{&newVec, range<1>{1}};
10+
myQueue.submit([&](handler &cgh) {
11+
auto writeResult = resultBuf.get_access<access::mode::write>(cgh);
12+
cgh.single_task<class kernel_name>([=]() {
13+
writeResult[0] = (vec<int, 4>{1, 2, 3, 4}).template convert<long>();
1614
});
1715
});
18-
1916
return 0;
2017
}

0 commit comments

Comments
 (0)