mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 17:46:49 +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.
17 lines
476 B
Fortran
17 lines
476 B
Fortran
! RUN: %flang -fsyntax-only -pedantic 2>&1 %s | FileCheck %s
|
|
|
|
! Test that a warning is emitted when a named common block appears in
|
|
! several scopes with a different storage size.
|
|
|
|
subroutine size_1
|
|
common x, y
|
|
common /c/ xc, yc
|
|
end subroutine
|
|
|
|
subroutine size_2
|
|
! OK, blank common size may always differ.
|
|
common x, y, z
|
|
!CHECK: portability: A named COMMON block should have the same size everywhere it appears (12 bytes here)
|
|
common /c/ xc, yc, zc
|
|
end subroutine
|