mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:16:46 +00:00

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.
25 lines
728 B
Fortran
25 lines
728 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
|
|
|
|
! Test check that enforce that a common block is initialized
|
|
! only once in a file.
|
|
|
|
subroutine init_1
|
|
common x, y
|
|
common /a/ xa, ya
|
|
common /b/ xb, yb
|
|
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
|
|
data x /42./, xa /42./, yb/42./
|
|
end subroutine
|
|
|
|
subroutine init_conflict
|
|
!ERROR: Multiple initialization of COMMON block //
|
|
common x, y
|
|
!ERROR: Multiple initialization of COMMON block /a/
|
|
common /a/ xa, ya
|
|
common /b/ xb, yb
|
|
equivalence (yb, yb_eq)
|
|
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
|
|
!ERROR: Multiple initialization of COMMON block /b/
|
|
data x /66./, xa /66./, yb_eq /66./
|
|
end subroutine
|