Files
clang-p2996/flang/test/Semantics/resolve118.f90
Peter Klausler 1c91d9bdea [flang] Ensure that portability warnings are conditional (#71857)
Before emitting a warning message, code should check that the usage in
question should be diagnosed by calling ShouldWarn(). A fair number of
sites in the code do not, and can emit portability warnings
unconditionally, which can confuse a user that hasn't asked for them
(-pedantic) and isn't terribly concerned about portability *to* other
compilers.

Add calls to ShouldWarn() or IsEnabled() around messages that need them,
and add -pedantic to tests that now require it to test their portability
messages, and add more expected message lines to those tests when
-pedantic causes other diagnostics to fire.
2023-11-13 16:13:50 -08:00

60 lines
949 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
! USE vs IMPORT
module m1
type t
integer n
end type
end module
module m2
type t
real x
end type
end module
module m3
use m1
interface
subroutine s1(x)
use m1
!PORTABILITY: The same 't' is already present in this scope
import t
type(t) x
end
subroutine s2(x)
use m2
!ERROR: A distinct 't' is already present in this scope
import t
type(t) x
end
end interface
end module
module m4
type t
complex z
end type
interface
subroutine s3(x)
use m1
!ERROR: A distinct 't' is already present in this scope
import t
type(t) x
end
end interface
end module
module m5
interface
subroutine s4(x)
use m1
!ERROR: A distinct 't' is already present in this scope
import t
type(t) x
end
end interface
contains
subroutine t
end
end module