[flang-commits] [flang] [flang] Silence warning in module file (PR #107421)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Sep 5 09:24:05 PDT 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/107421

Most warnings should be silenced when processing the content of a module file, since the warning should have also appeared when the module file was generated.  The case of an intrinsic type kind not being supported for a target wasn't being suppressed; fix.

Fixes https://github.com/llvm/llvm-project/issues/107337.

>From 966ca52c5755a9e4cd112e681d30e81b5c99820b Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Thu, 5 Sep 2024 09:21:17 -0700
Subject: [PATCH] [flang] Silence warning in module file

Most warnings should be silenced when processing the content of a
module file, since the warning should have also appeared when the
module file was generated.  The case of an intrinsic type kind not
being supported for a target wasn't being suppressed; fix.

Fixes https://github.com/llvm/llvm-project/issues/107337.
---
 flang/lib/Semantics/expression.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 60db02dc764b46..3684839c187e68 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -4027,7 +4027,8 @@ bool ExpressionAnalyzer::CheckIntrinsicKind(
     return true;
   } else if (foldingContext_.targetCharacteristics().CanSupportType(
                  category, kind)) {
-    if (context_.ShouldWarn(common::UsageWarning::BadTypeForTarget)) {
+    if (context_.ShouldWarn(common::UsageWarning::BadTypeForTarget) &&
+        !context_.IsInModuleFile(GetContextualMessages().at())) {
       Say("%s(KIND=%jd) is not an enabled type for this target"_warn_en_US,
           ToUpperCase(EnumToString(category)), kind);
     }



More information about the flang-commits mailing list