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.
17 lines
478 B
Fortran
17 lines
478 B
Fortran
! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
|
|
! Verify varnings on nonconforming DATA statements
|
|
! As a common extension, C876 violations are not errors.
|
|
program main
|
|
type :: seqType
|
|
sequence
|
|
integer :: number
|
|
end type
|
|
type(seqType) :: x
|
|
integer :: j
|
|
common j, x, y
|
|
!CHECK: Blank COMMON object 'j' in a DATA statement is not standard
|
|
data j/1/
|
|
!CHECK: Blank COMMON object 'x' in a DATA statement is not standard
|
|
data x%number/2/
|
|
end
|