Skip to content

Commit 8bcf40b

Browse files
authored
[flang] Adjust new warnings for extensions (#94485)
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 67081ba commit 8bcf40b

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
@@ -742,14 +742,13 @@ void CheckHelper::CheckObjectEntity(
742742
}
743743
} else if (!IsIntentInOut(symbol)) { // C1586
744744
messages_.Say(
745-
"non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_warn_en_US,
745+
"non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_err_en_US,
746746
what);
747747
ok = false;
748748
}
749-
if (ok && InFunction()) {
749+
if (ok && InFunction() && !InModuleFile() && !InElemental()) {
750750
if (context_.IsEnabled(common::LanguageFeature::RelaxedPureDummy)) {
751-
if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy) &&
752-
!InModuleFile() && !InElemental()) {
751+
if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy)) {
753752
messages_.Say(
754753
"non-POINTER dummy argument of pure function should be INTENT(IN) or VALUE"_warn_en_US);
755754
}

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)