From f8e0a40bcd0b39ebfd62a65686fed3d815035a6f Mon Sep 17 00:00:00 2001 From: Johannes Pietrzyk <40020979+JPietrzykTUD@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:34:06 +0200 Subject: [PATCH] Update detect_flags.sh --- detect_flags.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/detect_flags.sh b/detect_flags.sh index fabcdb7..5862545 100755 --- a/detect_flags.sh +++ b/detect_flags.sh @@ -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" @@ -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" @@ -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 \ No newline at end of file +fi