[PATCH] D96344: [flang][driver] Add options for -fdefault* and -flarge-sizes
Andrzej Warzynski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 3 06:18:23 PST 2021
awarzynski requested changes to this revision.
awarzynski added a comment.
This revision now requires changes to proceed.
This patch won't build with `BUILD_SHARED_LIBS` set to `On`. That's because a new dependency in `CompilerInvocation` is introduced (on `IntrinsicTypeDefaultKinds`). This dependency is currently not satisfied in the unit tests. This should fix it:
diff --git a/flang/unittests/Frontend/CMakeLists.txt b/flang/unittests/Frontend/CMakeLists.txt
index 88ec86f49291..a288aa0c99c9 100644
--- a/flang/unittests/Frontend/CMakeLists.txt
+++ b/flang/unittests/Frontend/CMakeLists.txt
@@ -10,4 +10,5 @@ target_link_libraries(FlangFrontendTests
flangFrontendTool
FortranParser
FortranSemantics
+ FortranCommon
)
I've left a few other comments inline.
================
Comment at: clang/include/clang/Driver/Options.td:4307-4314
+def fdefault_double_8 : Flag<["-"],"fdefault-double-8">, Group<f_Group>,
+ HelpText<"Set the DOUBLE PRECISION type and double real constants like 1.d0 to an 8 byte wide type">;
+def fdefault_integer_8 : Flag<["-"],"fdefault-integer-8">, Group<f_Group>,
+ HelpText<"Set the default integer and logical types to an 8 byte wide type">;
+def fdefault_real_8 : Flag<["-"],"fdefault-real-8">, Group<f_Group>,
+ HelpText<"Set the default real type to an 8 byte wide type">;
+def flarge_sizes : Flag<["-"],"flarge-sizes">, Group<f_Group>,
----------------
[nit] I believe that you copied the long version from [[ https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html | here ]]. I would instead use the short versions from this:
```
gcc --help=fortran | grep default
-Wreturn-type Warn whenever a function's return type defaults to "int" (C), or about inconsistent return types (C++).
-fdefault-double-8 Set the default double precision kind to an 8 byte wide type.
-fdefault-integer-8 Set the default integer kind to an 8 byte wide type.
-fdefault-real-8 Set the default real kind to an 8 byte wide type.
-fmodule-private Set default accessibility of module entities to PRIVATE.
-fopenacc-dim= Specify default OpenACC compute dimensions.
```
================
Comment at: flang/test/Flang-Driver/fdefault.f90:53
+!-----------------------------------------
+! ERROR: error: Use of `-fdefault-double-8` requires `-fdefault-real-8`
+
----------------
Fails for `f18` as it does not print `error` here.
================
Comment at: flang/test/Flang-Driver/pipeline.f90:1
+! This file tests that flang-new forwards
+! all Flang frontend options to flang-new -fc1
----------------
This test will fail with `FLANG_BUILD_NEW_DRIVER` set to `Off` (because it should not be run with `f18`). If you add `! REQUIRES: new-flang-driver` then everything will be fine.
Instead of adding that ^^^, could you move it to [[ https://github.com/llvm/llvm-project/blob/main/flang/test/Flang-Driver/frontend-forwarding.f90 | frontend-forwarding.f90 ]]?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96344/new/
https://reviews.llvm.org/D96344
More information about the cfe-commits
mailing list