Skip to content

Commit dee2092

Browse files
[libc][test] -Wimplicit-fallthrough, -Wwrite-strings and non-GCC warnings (#124036)
* Enabled `-Wimplicit-fallthrough` * Enabled `-Wwrite-strings` * Enabled non-GCC warnings * Fix non-GCC to mean `clang` * Move `-Wstrict-prototypes` to common section See: #122835 (comment) Relates to #119281
1 parent 7623d91 commit dee2092

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ function(_get_common_test_compile_options output_var c_test flags)
3838
endif()
3939
# list(APPEND compile_options "-Wconversion")
4040
# list(APPEND compile_options "-Wno-sign-conversion")
41-
# list(APPEND compile_options "-Wimplicit-fallthrough")
42-
# list(APPEND compile_options "-Wwrite-strings")
43-
list(APPEND compile_options "-Wextra-semi")
41+
list(APPEND compile_options "-Wimplicit-fallthrough")
42+
list(APPEND compile_options "-Wwrite-strings")
4443
# Silence this warning because _Complex is a part of C99.
4544
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
4645
if(NOT c_test)
@@ -51,13 +50,14 @@ function(_get_common_test_compile_options output_var c_test flags)
5150
list(APPEND compile_options "-Wno-gnu-imaginary-constant")
5251
endif()
5352
list(APPEND compile_options "-Wno-pedantic")
54-
# if(NOT CMAKE_COMPILER_IS_GNUCXX)
55-
# list(APPEND compile_options "-Wnewline-eof")
56-
# list(APPEND compile_options "-Wnonportable-system-include-path")
57-
# list(APPEND compile_options "-Wstrict-prototypes")
58-
# list(APPEND compile_options "-Wthread-safety")
59-
# list(APPEND compile_options "-Wglobal-constructors")
60-
# endif()
53+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
54+
list(APPEND compile_options "-Wstrict-prototypes")
55+
list(APPEND compile_options "-Wextra-semi")
56+
list(APPEND compile_options "-Wnewline-eof")
57+
list(APPEND compile_options "-Wnonportable-system-include-path")
58+
list(APPEND compile_options "-Wthread-safety")
59+
# list(APPEND compile_options "-Wglobal-constructors")
60+
endif()
6161
endif()
6262
set(${output_var} ${compile_options} PARENT_SCOPE)
6363
endfunction()

0 commit comments

Comments
 (0)