Skip to content

Commit 82c6520

Browse files
committed
whisper : enable compiler warnings for src
This commit enables compiler warnings for the src directory. Currently when the WHISPER_ALL_WARNINGS flag is set to ON is only enables warnings in ggml, by setting GGML_ALL_WARNINGS to ON. This commit adds the same compiler flags for whisper's src directory. The motivation for this is to catch potential bugs and issues early on in the development process.
1 parent 83b14c3 commit 82c6520

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ if (WIN32)
77
endif()
88
endif()
99

10+
11+
if (WHISPER_ALL_WARNINGS)
12+
if (NOT MSVC)
13+
list(APPEND WARNING_FLAGS -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function)
14+
list(APPEND C_FLAGS -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes
15+
-Werror=implicit-int -Werror=implicit-function-declaration)
16+
list(APPEND CXX_FLAGS -Wmissing-declarations -Wmissing-noreturn)
17+
18+
list(APPEND C_FLAGS ${WARNING_FLAGS})
19+
list(APPEND CXX_FLAGS ${WARNING_FLAGS})
20+
21+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${C_FLAGS};${GF_C_FLAGS}>"
22+
"$<$<COMPILE_LANGUAGE:CXX>:${CXX_FLAGS};${GF_CXX_FLAGS}>")
23+
else()
24+
# todo : msvc
25+
set(C_FLAGS "")
26+
set(CXX_FLAGS "")
27+
endif()
28+
endif()
29+
1030
if (WHISPER_COREML)
1131
find_library(FOUNDATION_FRAMEWORK Foundation)
1232
find_library(COREML_FRAMEWORK CoreML)

0 commit comments

Comments
 (0)