Skip to content

Commit 4aef322

Browse files
[SYCL][NFC] Enable more warnings for SemaSYCL (#19259)
There are few compiler flags which are required in accordance with our internal guidelines, but we can't apply them globally, because the upstream code is not warning-free. However, we do have two isolated downstream files: `SemaSYCL.cpp` and `SemaSYCLDeclAttr.cpp` where we can apply those extra flags without concerns that some code will come to us from the upstream. Absolute most of the changes is fixing `-Wunused-parameter` warnings
1 parent b4ea865 commit 4aef322

File tree

2 files changed

+157
-150
lines changed

2 files changed

+157
-150
lines changed

clang/lib/Sema/CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,40 @@ if (MSVC)
1212
set_source_files_properties(SemaSYCL.cpp PROPERTIES COMPILE_FLAGS /bigobj)
1313
endif()
1414

15+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
16+
set(is_clang TRUE)
17+
endif()
18+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
19+
set(is_gcc TRUE)
20+
endif()
21+
if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
22+
set(is_icpx TRUE)
23+
endif()
24+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
25+
set(is_msvc TRUE)
26+
endif()
27+
28+
set(linux_opts "-Wall;-Wextra")
29+
if (CMAKE_BUILD_TYPE MATCHES "Release")
30+
list(APPEND linux_opts "-Wconversion;-Wimplicit-fallthrough")
31+
endif()
32+
33+
if (is_gcc OR is_clang OR (is_icpx AND NOT WIN32))
34+
set(opts_to_apply ${linux_opts})
35+
elseif (is_msvc)
36+
set(opts_to_apply "/W4")
37+
elseif (is_icpx and WIN32)
38+
set(opts_to_apply "/Wall")
39+
endif()
40+
41+
if (opts_to_apply)
42+
set_source_files_properties(
43+
SemaSYCL.cpp SemaSYCLDeclAttr.cpp
44+
PROPERTIES
45+
COMPILE_OPTIONS "${opts_to_apply}"
46+
)
47+
endif()
48+
1549
clang_tablegen(OpenCLBuiltins.inc -gen-clang-opencl-builtins
1650
SOURCE OpenCLBuiltins.td
1751
TARGET ClangOpenCLBuiltinsImpl

0 commit comments

Comments
 (0)