Skip to content

Commit

Permalink
Update detect_flags.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
JPietrzykTUD authored Sep 6, 2024
1 parent e9922f6 commit f8e0a40
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions detect_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ else

if [[ -f $gcc_exe && -x $gcc_exe ]]; then
gcc_output=$(eval $gcc_exe -E - -march=native -### 2>&1)
parsed_flags=$(parse_flags "gcc" "$gcc_output")
parsed_flags=$(parse_flags "gcc" "$gcc_output" | sed "s/\./_/g")
# Parse whitespace-separated string into an array
IFS=' ' read -r -a parsed_array <<< "$parsed_flags"
Expand Down Expand Up @@ -77,11 +77,11 @@ else
continue
else
echo "Could not detect the current operating system. Aborting."
exit 1
# exit 1
fi
clang_output=$(eval $clang_exe -E - $arch_string -### 2>&1)
parsed_flags=$(parse_flags "clang" "$clang_output")
parsed_flags=$(parse_flags "clang" "$clang_output" | sed "s/\./_/g")
# Parse whitespace-separated string into an array
IFS=' ' read -r -a parsed_array <<< "$parsed_flags"
Expand All @@ -95,9 +95,14 @@ else
fi
done
fi
if [ -z "{flag_set}" ]; then
echo "Could not determine any flags"
exit 1
fi
IFS=$'\n' sorted=($(sort <<<"${flag_set[*]}"))
unset IFS
printf "%s " "${sorted[@]}"
printf "\n"
fi
fi

0 comments on commit f8e0a40

Please sign in to comment.