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
39 lines
1.2 KiB
Fortran
39 lines
1.2 KiB
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
module m
|
|
! C730 The same type-attr-spec shall not appear more than once in a given
|
|
! derived-type-stmt.
|
|
!
|
|
! R727 derived-type-stmt ->
|
|
! TYPE [[, type-attr-spec-list] ::] type-name [( type-param-name-list )]
|
|
! type-attr-spec values are:
|
|
! ABSTRACT, PUBLIC, PRIVATE, BIND(C), EXTENDS(parent-type-name)
|
|
!WARNING: Attribute 'ABSTRACT' cannot be used more than once
|
|
type, abstract, public, abstract :: derived1
|
|
end type derived1
|
|
|
|
!WARNING: Attribute 'PUBLIC' cannot be used more than once
|
|
type, public, abstract, public :: derived2
|
|
end type derived2
|
|
|
|
!WARNING: Attribute 'PRIVATE' cannot be used more than once
|
|
type, private, abstract, private :: derived3
|
|
end type derived3
|
|
|
|
!ERROR: Attributes 'PUBLIC' and 'PRIVATE' conflict with each other
|
|
type, public, abstract, private :: derived4
|
|
end type derived4
|
|
|
|
!WARNING: Attribute 'BIND(C)' cannot be used more than once
|
|
!WARNING: A derived type with the BIND attribute is empty
|
|
type, bind(c), public, bind(c) :: derived5
|
|
end type derived5
|
|
|
|
type, public :: derived6
|
|
end type derived6
|
|
|
|
!ERROR: Attribute 'EXTENDS' cannot be used more than once
|
|
type, extends(derived6), public, extends(derived6) :: derived7
|
|
end type derived7
|
|
|
|
end module m
|