From 41f4d47484db69848d3cd65fc7f81237b17bdfd4 Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Thu, 29 Jul 2021 15:58:22 +0100 Subject: [PATCH] [flang] Make `flang` translate `-M{fixed|free}` into `-f{fixed|free}-form` We are only adding this in `flang` - the bash wrapper script for the driver. We don't have any specific plans to support `-M{fixed|free}` in `flang-new` (i.e. the actual driver). That feature was requested by one of our users. Differential Revision: https://reviews.llvm.org/D107081 --- flang/tools/f18/flang | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/flang/tools/f18/flang b/flang/tools/f18/flang index bdd00f58e394..7e1832265a2c 100755 --- a/flang/tools/f18/flang +++ b/flang/tools/f18/flang @@ -209,11 +209,22 @@ categorise_opts() [[ $opt == "-Werror" ]]; then flang_opts+=($opt) elif - # These options are not supported by `flang-new`. There is also no point - # in forwarding them to the host compiler as the output from - # `-fdebug-unparse` will always be in free form. + # We translate the following into equivalents understood by `flang-new` [[ $opt == "-Mfixed" ]] || [[ $opt == "-Mfree" ]]; then - : + case $opt in + -Mfixed) + flang_opts+=("-ffixed-form") + ;; + + -Mfree) + flang_opts+=("-ffree-form") + ;; + + *) + echo "ERROR: $opt has no equivalent in 'flang-new'" + exit 1 + ;; + esac elif # Options that are needed for both Flang and the external driver. [[ $opt =~ -I.* ]] ||