Skip to content

Commit

Permalink
[libc][complex] Fix compiler warnings for usage of complex.h header. (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
lntue authored and EricWF committed Oct 22, 2024
1 parent e762d66 commit f467346
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ function(_get_common_compile_options output_var flags)
list(APPEND compile_options "-Wconversion")
list(APPEND compile_options "-Wno-sign-conversion")
# Silence this warning because _Complex is a part of C99.
list(APPEND compile_options "-Wno-c99-extensions")
list(APPEND compile_options "-Wno-pedantic")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
list(APPEND compile_options "-fext-numeric-literals")
list(APPEND compile_options "-Wno-pedantic")
else()
list(APPEND compile_options "-Wno-c99-extensions")
list(APPEND compile_options "-Wno-gnu-imaginary-constant")
endif()
list(APPEND compile_options "-Wimplicit-fallthrough")
list(APPEND compile_options "-Wwrite-strings")
list(APPEND compile_options "-Wextra-semi")
Expand Down Expand Up @@ -210,7 +215,7 @@ function(_get_common_test_compile_options output_var c_test flags)
list(APPEND compile_options "-fno-exceptions")
list(APPEND compile_options "-fno-unwind-tables")
list(APPEND compile_options "-fno-asynchronous-unwind-tables")
if(NOT ${c_test})
if(NOT c_test)
list(APPEND compile_options "-fno-rtti")
endif()
endif()
Expand All @@ -231,8 +236,15 @@ function(_get_common_test_compile_options output_var c_test flags)
# list(APPEND compile_options "-Wwrite-strings")
# list(APPEND compile_options "-Wextra-semi")
# Silence this warning because _Complex is a part of C99.
list(APPEND compile_options "-Wno-c99-extensions")
list(APPEND compile_options "-Wno-pedantic")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(NOT c_test)
list(APPEND compile_options "-fext-numeric-literals")
list(APPEND compile_options "-Wno-pedantic")
endif()
else()
list(APPEND compile_options "-Wno-c99-extensions")
list(APPEND compile_options "-Wno-gnu-imaginary-constant")
endif()
# if(NOT CMAKE_COMPILER_IS_GNUCXX)
# list(APPEND compile_options "-Wnewline-eof")
# list(APPEND compile_options "-Wnonportable-system-include-path")
Expand Down

0 comments on commit f467346

Please sign in to comment.