Skip to content

Commit c1e79bb

Browse files
Enable -Werror and -Wall (#521)
This PR updates the build configuration to compile with stricter warning checks: -Wall: enables common compiler warnings. -Werror: treats all warnings as errors, preventing them from being ignored. -Wno-* suppresses known noisy or irrelevant warnings, so that the build remains strict but practical. Also all warnings from googletest, googlebenchmark, and compat are silenced.
1 parent b0cb10e commit c1e79bb

File tree

5 files changed

+41
-8
lines changed

5 files changed

+41
-8
lines changed

.github/workflows/intel_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
cmake -G Ninja \
104104
-DCUTLASS_ENABLE_SYCL=ON \
105105
-DDPCPP_SYCL_TARGET=${{ matrix.sycl_target }} \
106+
-DCMAKE_CXX_FLAGS="-Werror" \
106107
-DCUTLASS_SYCL_RUNNING_CI=ON
107108
cmake --build .
108109
- name: Unit test

.github/workflows/intel_test_gpp_host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
-DCUTLASS_ENABLE_SYCL=ON \
8585
-DDPCPP_SYCL_TARGET=${{ matrix.sycl_target }} \
8686
-DCUTLASS_SYCL_RUNNING_CI=ON \
87+
-DCMAKE_CXX_FLAGS="-Werror" \
8788
-DDPCPP_HOST_COMPILER=g++-13
8889
cmake --build .
8990

CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828

2929
if(CUTLASS_ENABLE_SYCL)
3030
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
31+
32+
# Silence warnings from GoogleTest headers
33+
include_directories(SYSTEM
34+
${CMAKE_CURRENT_SOURCE_DIR}/_deps/googletest-src/googletest/include
35+
${CMAKE_CURRENT_SOURCE_DIR}/_deps/googletest-src/googlemock/include
36+
)
37+
38+
# Silence warnings from GoogleBenchmark headers
39+
include_directories(SYSTEM
40+
${CMAKE_CURRENT_SOURCE_DIR}/_deps/googlebenchmark-src/include
41+
)
42+
3143
else()
3244
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
3345
cmake_policy(SET CMP0112 NEW)
@@ -121,6 +133,16 @@ if (CUTLASS_ENABLE_SYCL)
121133
DPCPP_SYCL_TARGET STREQUAL "intel_gpu_bmg_g21")
122134
set(SYCL_INTEL_TARGET ON)
123135
add_compile_definitions(SYCL_INTEL_TARGET)
136+
add_compile_options(-Wall
137+
-Wno-unused-variable
138+
-Wno-unused-local-typedef
139+
-Wno-unused-but-set-variable
140+
-Wno-uninitialized
141+
-Wno-reorder-ctor
142+
-Wno-logical-op-parentheses
143+
-Wno-unused-function
144+
-Wno-unknown-pragmas
145+
)
124146
endif()
125147

126148
add_compile_definitions(CUTLASS_ENABLE_SYCL)

cmake/googlebenchmark.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,13 @@ FetchContent_Declare(
4545

4646
FetchContent_MakeAvailable(googlebenchmark)
4747

48+
# Silence warnings from GoogleBenchmark sources
49+
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
50+
foreach(tgt benchmark benchmark_main)
51+
if(TARGET ${tgt})
52+
target_compile_options(${tgt} PRIVATE -w)
53+
endif()
54+
endforeach()
55+
endif()
56+
4857
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)

cmake/googletest.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ FetchContent_Declare(
4444

4545
FetchContent_MakeAvailable(googletest)
4646

47-
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
48-
if (TARGET gtest)
49-
# Ignore unsupported warning flags on IntelLLVM
50-
target_compile_options(gtest PRIVATE -Wno-unknown-warning-option)
51-
# Show -Winline warnings, but don’t let them become errors
52-
target_compile_options(gtest PRIVATE -Wno-error=inline)
53-
endif()
47+
# Silence warnings from GoogleTest sources
48+
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
49+
foreach(tgt gtest gtest_main gmock gmock_main)
50+
if(TARGET ${tgt})
51+
target_compile_options(${tgt} PRIVATE -w)
52+
endif()
53+
endforeach()
5454
endif()
5555

5656
if (MSVC)
5757
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
58-
endif()
58+
endif()

0 commit comments

Comments
 (0)