[libc-commits] [libc] 6bec4fc - [libc] Fix flag parsing bugs. (#84706)

via libc-commits libc-commits at lists.llvm.org
Sun Mar 10 19:17:00 PDT 2024


Author: lntue
Date: 2024-03-10T22:16:56-04:00
New Revision: 6bec4fc76de50a090d1d0b36498da66c4a324851

URL: https://github.com/llvm/llvm-project/commit/6bec4fc76de50a090d1d0b36498da66c4a324851
DIFF: https://github.com/llvm/llvm-project/commit/6bec4fc76de50a090d1d0b36498da66c4a324851.diff

LOG: [libc] Fix flag parsing bugs. (#84706)

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
    libc/cmake/modules/LLVMLibCFlagRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 72b04822d8b84a..893a807b5b61c7 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -2,10 +2,10 @@ function(_get_compile_options_from_flags output_var)
   set(compile_options "")
 
   if(LIBC_TARGET_ARCHITECTURE_IS_RISCV64 OR(LIBC_CPU_FEATURES MATCHES "FMA"))
-    check_flag(ADD_FMA_FLAG ${FMA_OPT_FLAG} ${flags})
+    check_flag(ADD_FMA_FLAG ${FMA_OPT_FLAG} ${ARGN})
   endif()
-  check_flag(ADD_SSE4_2_FLAG ${ROUND_OPT_FLAG} ${flags})
-  check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${flags})
+  check_flag(ADD_SSE4_2_FLAG ${ROUND_OPT_FLAG} ${ARGN})
+  check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${ARGN})
 
   if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
     if(ADD_FMA_FLAG)

diff  --git a/libc/cmake/modules/LLVMLibCFlagRules.cmake b/libc/cmake/modules/LLVMLibCFlagRules.cmake
index 9bec716516f288..18e36dfde5cc19 100644
--- a/libc/cmake/modules/LLVMLibCFlagRules.cmake
+++ b/libc/cmake/modules/LLVMLibCFlagRules.cmake
@@ -131,9 +131,9 @@ endfunction(get_fq_dep_list_without_flag)
 
 # Check if a `flag` is set
 function(check_flag result flag_name)
-  list(FIND ARGN ${flag_name}_FLAG has_flag)
+  list(FIND ARGN ${flag_name} has_flag)
   if(${has_flag} LESS 0)
-    list(FIND ARGN "${flag_name}_FLAG__ONLY" has_flag)
+    list(FIND ARGN "${flag_name}__ONLY" has_flag)
   endif()
   if(${has_flag} GREATER -1)
     set(${result} TRUE PARENT_SCOPE)


        


More information about the libc-commits mailing list