diff options
author | Peter Klausler <35819229+klausler@users.noreply.github.com> | 2024-06-11 17:09:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 17:09:17 -0700 |
commit | 8bcf40ba884dc80795c17259518db42d35a2f155 (patch) | |
tree | 9139e5e42347324d40e5ce5044d422e4eefa8be0 /flang | |
parent | 67081badfc65b8b60622314dd698834ffcfdbfa9 (diff) | |
download | llvm-8bcf40ba884dc80795c17259518db42d35a2f155.zip llvm-8bcf40ba884dc80795c17259518db42d35a2f155.tar.gz llvm-8bcf40ba884dc80795c17259518db42d35a2f155.tar.bz2 |
[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.
Diffstat (limited to 'flang')
-rw-r--r-- | flang/lib/Semantics/check-declarations.cpp | 7 | ||||
-rw-r--r-- | flang/test/Semantics/call10.f90 | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index 92bfea2..ff43223 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -742,14 +742,13 @@ void CheckHelper::CheckObjectEntity( } } else if (!IsIntentInOut(symbol)) { // C1586 messages_.Say( - "non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_warn_en_US, + "non-POINTER dummy argument of pure %s must have INTENT() or VALUE attribute"_err_en_US, what); ok = false; } - if (ok && InFunction()) { + if (ok && InFunction() && !InModuleFile() && !InElemental()) { if (context_.IsEnabled(common::LanguageFeature::RelaxedPureDummy)) { - if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy) && - !InModuleFile() && !InElemental()) { + if (context_.ShouldWarn(common::LanguageFeature::RelaxedPureDummy)) { messages_.Say( "non-POINTER dummy argument of pure function should be INTENT(IN) or VALUE"_warn_en_US); } diff --git a/flang/test/Semantics/call10.f90 b/flang/test/Semantics/call10.f90 index ff19f10..ffb3b48 100644 --- a/flang/test/Semantics/call10.f90 +++ b/flang/test/Semantics/call10.f90 @@ -53,7 +53,7 @@ module m real, value :: a ! ok end function pure real function f03(a) ! C1583 - !ERROR: non-POINTER dummy argument of pure function must have INTENT() or VALUE attribute + !WARNING: non-POINTER dummy argument of pure function must have INTENT() or VALUE attribute real :: a end function pure real function f03a(a) @@ -83,7 +83,7 @@ module m end function pure subroutine s01(a) ! C1586 - !ERROR: non-POINTER dummy argument of pure subroutine must have INTENT() or VALUE attribute + !WARNING: non-POINTER dummy argument of pure subroutine must have INTENT() or VALUE attribute real :: a end subroutine pure subroutine s01a(a) |