Emil Kieri 93dca9fbee [flang][test] Fix semantics tests with respect to warnings
Make tests expect the (correctly) emitted warnings using the WARNING
directive. This directive is non-functional now, but will be recognised
by test_errors.py when D125804 is landed. This patch is a preparation
for D125804.

For most tests, we add missing WARNING directives for emitted warnings,
but there are exceptions:

 - for int-literals.f90 and resolve31.f90 we pass -pedantic to the
   frontend driver, so that the expected warnings are actually emitted.

 - for block-data01.f90 and resolve42.f90 we change the tests so that
   warnings, which appear unintentional, are not emitted. While testing
   the warning in question (padding added for alignment in common block)
   would be desired, that is beyond the scope of this patch. This
   warning is target-dependent.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D131987
2022-08-18 19:16:20 +02:00

52 lines
1.3 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
module m
public i
integer, private :: j
!ERROR: The accessibility of 'i' has already been specified as PUBLIC
private i
!WARNING: The accessibility of 'j' has already been specified as PRIVATE
private j
end
module m2
interface operator(.foo.)
module procedure ifoo
end interface
public :: operator(.foo.)
!ERROR: The accessibility of 'OPERATOR(.foo.)' has already been specified as PUBLIC
private :: operator(.foo.)
interface operator(+)
module procedure ifoo
end interface
public :: operator(+)
!ERROR: The accessibility of 'OPERATOR(+)' has already been specified as PUBLIC
private :: operator(+) , ifoo
contains
integer function ifoo(x, y)
logical, intent(in) :: x, y
end
end module
module m3
type t
end type
private :: operator(.lt.)
interface operator(<)
logical function lt(x, y)
import t
type(t), intent(in) :: x, y
end function
end interface
!ERROR: The accessibility of 'OPERATOR(<)' has already been specified as PRIVATE
public :: operator(<)
interface operator(.gt.)
logical function gt(x, y)
import t
type(t), intent(in) :: x, y
end function
end interface
public :: operator(>)
!ERROR: The accessibility of 'OPERATOR(.GT.)' has already been specified as PUBLIC
private :: operator(.gt.)
end