[PATCH] D99353: [driver] Make `clang` warn rather then error on `flang` options

Joachim Protze via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 29 09:49:30 PDT 2021


protze.joachim added a comment.

Thank you for working on this! It works for me.
As you mentioned in D95460 <https://reviews.llvm.org/D95460>, this makes the behavior more similar to gcc.

I tested with `-Werror`:

  $ flang -fopenmp test-f77.f -ffree-form -c
  $ clang -fopenmp test-f77.o -ffree-form -lgfortran -Werror && echo $?
  clang-13: warning: command line option ‘-ffree-form’ is only valid in Flang mode (i.e. for Fortran input)
  clang-13: error: argument unused during compilation: '-ffree-form' [-Werror,-Wunused-command-line-argument]

Since `-Werror` only raises the second warning, `-Wno-error=unused-command-line-argument` allows to successfully compile with `-Werror`.

  $ clang -fopenmp test-f77.o -ffree-form -lgfortran -Werror -Wno-error=unused-command-line-argument && echo $?
  clang-13: warning: command line option ‘-ffree-form’ is only valid in Flang mode (i.e. for Fortran input)
  clang-13: warning: argument unused during compilation: '-ffree-form' [-Wunused-command-line-argument]
  0

I also tested with `-ffixed-form` and `-ffixed-line-length-132`. The latter doesn't work, while `-ffixed-line-length=132` works.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99353/new/

https://reviews.llvm.org/D99353



More information about the cfe-commits mailing list