Skip to content
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

[flang] Silence warnings from hermetic module files #128763

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

klausler
Copy link
Contributor

Modules read from module files must have their symbols tagged with the ModFile flag to suppress all warnings messages that might be emitted for their contents. (Actionable warnings will have been emitted when the modules were originally compiled, so we don't want to repeat them later when the modules are USE'd.) The module symbols of the additional modules in hermetic module files were not being tagged with that flag; fix.

Modules read from module files must have their symbols tagged with
the ModFile flag to suppress all warnings messages that might be
emitted for their contents.  (Actionable warnings will have been
emitted when the modules were originally compiled, so we don't want
to repeat them later when the modules are USE'd.)  The module symbols
of the additional modules in hermetic module files were not being
tagged with that flag; fix.
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Feb 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 25, 2025

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

Modules read from module files must have their symbols tagged with the ModFile flag to suppress all warnings messages that might be emitted for their contents. (Actionable warnings will have been emitted when the modules were originally compiled, so we don't want to repeat them later when the modules are USE'd.) The module symbols of the additional modules in hermetic module files were not being tagged with that flag; fix.


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

1 Files Affected:

  • (modified) flang/lib/Semantics/mod-file.cpp (+4)
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index bef934beaacfa..c208aae423579 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -1563,6 +1563,10 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
     Scope &hermeticScope{topScope.MakeScope(Scope::Kind::Global)};
     context_.set_currentHermeticModuleFileScope(&hermeticScope);
     ResolveNames(context_, hermeticModules, hermeticScope);
+    for (auto &[_, ref] : hermeticScope) {
+      CHECK(ref->has<ModuleDetails>());
+      ref->set(Symbol::Flag::ModFile);
+    }
   }
   GetModuleDependences(context_.moduleDependences(), sourceFile->content());
   ResolveNames(context_, parseTree, topScope);

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.

3 participants