ref: 1e85c4cff127d4822e55f7f71ce76a5367893263
parent: c238549e7158a205b44c59fd8a3ab6dee7616a2d
author: cancel <cancel@cancel.fm>
date: Fri Nov 30 04:07:14 EST 2018
Cleanup
--- a/tool
+++ b/tool
@@ -35,7 +35,7 @@
*) os=unknown;;
esac
-compiler_exe="${CC:-cc}"
+cc_exe="${CC:-cc}"
verbose=0
protections_enabled=0
@@ -53,7 +53,7 @@
;;
esac
;;
- c) compiler_exe="$OPTARG";;
+ c) cc_exe="$OPTARG";;
h) print_usage; exit 0;;
d) protections_enabled=1;;
s) stats_enabled=1;;
@@ -105,7 +105,7 @@
# This is not perfect by any means
cc_id=
cc_vers=
-if cc_vers_string=$("$compiler_exe" --version 2> /dev/null); then
+if cc_vers_string=$("$cc_exe" --version 2> /dev/null); then
if clang_vers_string=$(echo "$cc_vers_string" | grep clang | head -n1) && ! [[ -z $clang_vers_string ]]; then
cc_id=clang
# clang -dumpversion always pretends to be gcc 4.2.1
@@ -112,7 +112,7 @@
# shellcheck disable=SC2001
cc_vers=$(echo "$clang_vers_string" | sed 's/.*version \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
# Only gcc has -dumpfullversion
- elif cc_vers=$("$compiler_exe" -dumpfullversion 2> /dev/null); then
+ elif cc_vers=$("$cc_exe" -dumpfullversion 2> /dev/null); then
cc_id=gcc
fi
fi
@@ -197,7 +197,7 @@
local out_path=$build_dir/$build_subdir/$out_exe
# bash versions quirk: empty arrays might give error on expansion, use +
# trick to avoid expanding second operand
- verbose_echo timed_stats "$compiler_exe" "${compiler_flags[@]}" -o "$out_path" "${source_files[@]}" ${libraries[@]+"${libraries[@]}"}
+ verbose_echo timed_stats "$cc_exe" "${compiler_flags[@]}" -o "$out_path" "${source_files[@]}" ${libraries[@]+"${libraries[@]}"}
if [[ $stats_enabled = 1 ]]; then
echo "time: $last_time"
echo "size: $(file_size "$out_path")"
@@ -207,7 +207,7 @@
print_info() {
cat <<EOF
Operating system: $os
-Compiler name: $compiler_exe
+Compiler name: $cc_exe
Compiler type: $cc_id
Compiler version: $cc_vers
EOF