diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake index 4dbe5e046cc68..a88932d08c370 100644 --- a/libc/cmake/modules/LLVMLibCTestRules.cmake +++ b/libc/cmake/modules/LLVMLibCTestRules.cmake @@ -25,34 +25,53 @@ function(_get_common_test_compile_options output_var c_test flags) list(APPEND compile_options "-ffixed-point") endif() - # list(APPEND compile_options "-Wall") - # list(APPEND compile_options "-Wextra") + list(APPEND compile_options "-Wall") + list(APPEND compile_options "-Wextra") # -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror. if(NOT LIBC_WNO_ERROR) - # list(APPEND compile_options "-Werror") + list(APPEND compile_options "-Werror") + + # TODO (https://github.com/llvm/llvm-project/issues/122367#issuecomment-2581374103) + list(APPEND compile_options "-Wno-unused-command-line-argument") + + # TODO (https://github.com/llvm/llvm-project/issues/123434) + list(APPEND compile_options "-Wno-missing-field-initializers") endif() - # list(APPEND compile_options "-Wconversion") - # list(APPEND compile_options "-Wno-sign-conversion") - # list(APPEND compile_options "-Wimplicit-fallthrough") - # list(APPEND compile_options "-Wwrite-strings") - # list(APPEND compile_options "-Wextra-semi") + list(APPEND compile_options "-Wconversion") + list(APPEND compile_options "-Wno-sign-conversion") + list(APPEND compile_options "-Wimplicit-fallthrough") + list(APPEND compile_options "-Wwrite-strings") + list(APPEND compile_options "-Wextra-semi") # Silence this warning because _Complex is a part of C99. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(NOT c_test) list(APPEND compile_options "-fext-numeric-literals") endif() - else() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + list(APPEND compile_options "-Wnewline-eof") + list(APPEND compile_options "-Wnonportable-system-include-path") + list(APPEND compile_options "-Wstrict-prototypes") + list(APPEND compile_options "-Wthread-safety") + # TODO(https://github.com/llvm/llvm-project/issues/119281) triggered in TEST_F implementation + list(APPEND compile_options "-Wno-global-constructors") + + # TODO(https://github.com/llvm/llvm-project/issues/119281) + # These have been disabled for the time being to create explicit PRs for each change. + list(APPEND compile_options "-Wno-unused-parameter") + list(APPEND compile_options "-Wno-implicit-int-conversion") + list(APPEND compile_options "-Wno-shorten-64-to-32") + list(APPEND compile_options "-Wno-float-conversion") + list(APPEND compile_options "-Wno-implicit-float-conversion") + list(APPEND compile_options "-Wno-extra-semi") + + list(APPEND compile_options "-Wno-c99-extensions") list(APPEND compile_options "-Wno-gnu-imaginary-constant") + endif() + list(APPEND compile_options "-Wno-pedantic") - # if(NOT CMAKE_COMPILER_IS_GNUCXX) - # list(APPEND compile_options "-Wnewline-eof") - # list(APPEND compile_options "-Wnonportable-system-include-path") - # list(APPEND compile_options "-Wstrict-prototypes") - # list(APPEND compile_options "-Wthread-safety") - # list(APPEND compile_options "-Wglobal-constructors") - # endif() + endif() set(${output_var} ${compile_options} PARENT_SCOPE) endfunction()