Skip to content

[flang] Silence warning in module file #107421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Conversation

klausler
Copy link
Contributor

@klausler klausler commented Sep 5, 2024

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 #107337.

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 llvm#107337.
@klausler klausler requested a review from Renaud-K September 5, 2024 16:23
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Sep 5, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2024

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

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 #107337.


Full diff: https://github.com/llvm/llvm-project/pull/107421.diff

1 Files Affected:

  • (modified) flang/lib/Semantics/expression.cpp (+2-1)
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);
     }

@klausler klausler merged commit 3f1d0e1 into llvm:main Sep 5, 2024
11 checks passed
@klausler klausler deleted the bug107337 branch September 5, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flang] Many warnings issued from a module included by a use statement after disabling types
3 participants