diff --git a/flang/tools/f18/flang.in b/flang/tools/f18/flang.in --- a/flang/tools/f18/flang.in +++ b/flang/tools/f18/flang.in @@ -24,6 +24,7 @@ COMPILE_ONLY="False" PREPROCESS_ONLY="False" TEMP_OUTPUT="flang_temp_out_" +PRINT_VERSION="False" # === parse_args ============================================================== # @@ -90,6 +91,10 @@ PREPROCESS_ONLY="True" fi + if [[ $1 == "-v" || $1 == "--version" ]]; then + PRINT_VERSION="True" + fi + shift continue @@ -204,7 +209,6 @@ [[ $opt == "-pedantic" ]] || [[ $opt =~ ^-std=.* ]] || [[ $opt =~ ^-U.* ]] || - [[ $opt == "--version" ]] || [[ $opt == "-Werror" ]]; then flang_opts+=($opt) elif [[ $opt =~ -I.* ]] || [[ $opt =~ -J.* ]]; then @@ -266,6 +270,11 @@ main() { parse_args "$@" + if [[ $PRINT_VERSION == "True" ]]; then + echo "flang version @FLANG_VERSION@" + exit 0 + fi + fortran_source_files=() other_source_files=() object_files=()