[PATCH] D97119: [flang][driver] Add options for -std=2018

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 03:48:57 PST 2021


awarzynski added a comment.

Hi @arnamoy10 , thank for working on this!

I suggest making it more explicit that the new option is about _enabling standard conformance checks_. So e.g. `enableConformanceChecks` rather than `setStandard` (or `set_EnableConformanceChecks` if the member variable is called `EnableConformanceChecks`).

I am also mindful that adding `-std=f2018` might be a bit confusing to users if we don't support other versions of the language. @tskeith raised this point earlier <https://lists.llvm.org/pipermail/flang-dev/2020-November/000593.html>.

Perhaps we should use e..g `-fstd-conf-checks/-fno-std-conf-checks` instead? This could be an alias for `-Mstandard` in `f18`. We would replace it with `-std=<arg>` once that makes more sense.



================
Comment at: flang/include/flang/Frontend/CompilerInvocation.h:74
   Fortran::common::IntrinsicTypeDefaultKinds defaultKinds_;
+  bool standard_ = false;
 
----------------
Wouldn`t e.g. `standardConformanceChecks_` be a bit more self-explanatory? Currently this is quite vague.


================
Comment at: flang/include/flang/Frontend/CompilerInvocation.h:113
+    standard_ = true;
+  }
   /// Set the Fortran options to predifined defaults. These defaults are
----------------
Missing empty line.


================
Comment at: flang/test/Flang-Driver/std2018.f90:12-13
+!-----------------------------------------
+!  RUN: %flang-new -fc1 -fsyntax-only -std=2018 %s  2>&1 | FileCheck %s --check-prefix=GIVEN
+!  RUN: not %flang-new -fc1 -fsyntax-only -std=90 %s  2>&1 | FileCheck %s --check-prefix=WRONG
+
----------------
[nit] `-fstynax-only` is effectively the default in the frontend driver, see [[ https://github.com/llvm/llvm-project/blob/b5b3243bf783f07415c5e2838fa1a948e126f643/flang/lib/Frontend/CompilerInvocation.cpp#L92 | here ]]. Basically, in the absence of any _action_ options, the driver will run the `ParseSyntaxOnly` action (which corresponds to `-fsyntax-only`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97119



More information about the cfe-commits mailing list