Skip to content

Commit 0c632de

Browse files
committed
[flang] Adjust new warnings for extensions
Prevent messages from module files, respect the language feature flags when enabling the relaxed PURE dummy argument checking, and check that the new warnings are enabled.
1 parent 539b72f commit 0c632de

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,13 @@ void CheckHelper::CheckObjectEntity(
731731
}
732732
} else if (!IsIntentInOut(symbol)) { // C1586
733733
messages_.Say(
734-
"non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_warn_en_US,
734+
"non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_err_en_US,
735735
what);
736736
ok = false;
737737
}
738-
if (ok && InFunction()) {
738+
if (ok && InFunction() && !InModuleFile() && !InElemental()) {
739739
if (context_.IsEnabled(common::LanguageFeature::RelaxedPureDummy)) {
740-
if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy) &&
741-
!InModuleFile() && !InElemental()) {
740+
if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy)) {
742741
messages_.Say(
743742
"non-POINTER dummy argument of pure function should be INTENT(IN) or VALUE"_warn_en_US);
744743
}

flang/test/Semantics/call10.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pure real function f02(a)
5353
real, value :: a ! ok
5454
end function
5555
pure real function f03(a) ! C1583
56-
!ERROR: non-POINTER dummy argument of pure function must have INTENT() or VALUE attribute
56+
!WARNING: non-POINTER dummy argument of pure function must have INTENT() or VALUE attribute
5757
real :: a
5858
end function
5959
pure real function f03a(a)
@@ -83,7 +83,7 @@ pure function f08() ! C1585
8383
end function
8484

8585
pure subroutine s01(a) ! C1586
86-
!ERROR: non-POINTER dummy argument of pure subroutine must have INTENT() or VALUE attribute
86+
!WARNING: non-POINTER dummy argument of pure subroutine must have INTENT() or VALUE attribute
8787
real :: a
8888
end subroutine
8989
pure subroutine s01a(a)

0 commit comments

Comments
 (0)