[libc-commits] [libc] [libc][complex] Fix compiler warnings for usage of complex.h header. (PR #112282)
via libc-commits
libc-commits at lists.llvm.org
Mon Oct 14 15:41:05 PDT 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/112282
None
>From 6a04887a50cc042d4fb1d612c926061c843ae4ec Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Mon, 14 Oct 2024 22:39:19 +0000
Subject: [PATCH] [libc][complex] Fix compiler warnings for usage of complex.h
header.
---
.../modules/LLVMLibCCompileOptionRules.cmake | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index e3a111c62cdb71..3846c597e6894f 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -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")
@@ -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()
@@ -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")
More information about the libc-commits
mailing list