[flang] Add options to control IMPLICIT NONE
authorTim Keith <tkeith@nvidia.com>
Thu, 6 Aug 2020 13:47:59 +0000 (06:47 -0700)
committerTim Keith <tkeith@nvidia.com>
Thu, 6 Aug 2020 13:48:01 +0000 (06:48 -0700)
commit08c7d570d30bb9568fb2219db7b1b8a9532559dd
tree40bd618fc45707ea60dc05f8e0ea894f635bde28
parent37894ba6612bf24060f38001122946108a770bc8
[flang] Add options to control IMPLICIT NONE

Add `-fimplicit-none-type-always` to treat each specification-part
like it has `IMPLICIT NONE`. This is helpful for enforcing good Fortran
programming practices. We might consider something similar for
`IMPLICIT NONE(EXTERNAL)` as well.

Add `-fimplicit-none-type-never` to ignore occurrences of `IMPLICIT NONE`
and `IMPLICIT NONE(TYPE)`. This is to handle cases like the one below,
which violates the standard but it accepted by some compilers:
```
subroutine s(a, n)
  implicit none
  real :: a(n)
  integer :: n
end
```

Differential Revision: https://reviews.llvm.org/D85363
flang/documentation/Extensions.md
flang/include/flang/Common/Fortran-features.h
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/implicit09.f90 [new file with mode: 0644]
flang/test/Semantics/implicit10.f90 [new file with mode: 0644]
flang/tools/f18/f18.cpp