Skip to content

Commit

Permalink
[libc] Fix flag parsing bugs. (#84706)
Browse files Browse the repository at this point in the history
  • Loading branch information
lntue authored Mar 11, 2024
1 parent f786881 commit 6bec4fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions libc/cmake/modules/LLVMLibCFlagRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6bec4fc

Please sign in to comment.