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.
32 lines
629 B
Fortran
32 lines
629 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
|
|
! test global name conflicts
|
|
|
|
subroutine ext1
|
|
end
|
|
|
|
subroutine ext2
|
|
!ERROR: Two entities have the same global name 'ext1'
|
|
common /ext1/ x
|
|
end
|
|
|
|
module ext4
|
|
contains
|
|
!ERROR: Two entities have the same global name 'ext2'
|
|
subroutine foo() bind(c,name="ext2")
|
|
end
|
|
!ERROR: Two entities have the same global name 'ext3'
|
|
subroutine bar() bind(c,name="ext3")
|
|
end
|
|
end
|
|
|
|
block data ext3
|
|
!PORTABILITY: Global name 'ext4' conflicts with a module
|
|
common /ext4/ x
|
|
end
|
|
|
|
subroutine s
|
|
!ERROR: Two entities have the same global name 'foo'
|
|
common /foo/n
|
|
call foo
|
|
end
|