[flang-commits] [PATCH] D134455: [flang] Don't emit portability warnings for things in module files

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Sep 23 13:45:40 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc7285cd09f21: [flang] Don't emit portability warnings for things in module files (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134455/new/

https://reviews.llvm.org/D134455

Files:
  flang/lib/Semantics/check-declarations.cpp
  flang/lib/Semantics/resolve-names-utils.cpp
  flang/lib/Semantics/resolve-names.cpp


Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -173,6 +173,8 @@
     }
   }
 
+  bool InModuleFile() const { return GetFoldingContext().inModuleFile(); }
+
   // Make a placeholder symbol for a Name that otherwise wouldn't have one.
   // It is not in any scope and always has MiscDetails.
   void MakePlaceholder(const parser::Name &, MiscDetails::Kind);
@@ -4835,7 +4837,8 @@
   set_allowForwardReferenceToDerivedType(false);
   if (derivedTypeInfo_.sequence) { // C740
     if (const auto *declType{GetDeclTypeSpec()}) {
-      if (!declType->AsIntrinsic() && !declType->IsSequenceType()) {
+      if (!declType->AsIntrinsic() && !declType->IsSequenceType() &&
+          !InModuleFile()) {
         if (GetAttrs().test(Attr::POINTER) &&
             context().IsEnabled(common::LanguageFeature::PointerInSeqType)) {
           if (context().ShouldWarn(common::LanguageFeature::PointerInSeqType)) {
@@ -6635,7 +6638,7 @@
       ApplyImplicitRules(*symbol);
     }
     if (checkIndexUseInOwnBounds_ &&
-        *checkIndexUseInOwnBounds_ == name.source) {
+        *checkIndexUseInOwnBounds_ == name.source && !InModuleFile()) {
       Say(name,
           "Implied DO index '%s' uses an object of the same name in its bounds expressions"_port_en_US,
           name.source);
Index: flang/lib/Semantics/resolve-names-utils.cpp
===================================================================
--- flang/lib/Semantics/resolve-names-utils.cpp
+++ flang/lib/Semantics/resolve-names-utils.cpp
@@ -464,7 +464,9 @@
       }
     }
   }
-  if (msg) {
+  if (msg &&
+      (!context_.IsInModuleFile(source) ||
+          msg->severity() == parser::Severity::Error)) {
     context_.Say(source, std::move(*msg), sym1.name(), sym2.name());
     return false;
   }
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -201,7 +201,9 @@
 }
 
 void CheckHelper::Check(const Symbol &symbol) {
-  if (symbol.name().size() > common::maxNameLen) {
+  if (symbol.name().size() > common::maxNameLen &&
+      &symbol == &symbol.GetUltimate() &&
+      !FindModuleFileContaining(symbol.owner())) {
     messages_.Say(symbol.name(),
         "%s has length %d, which is greater than the maximum name length "
         "%d"_port_en_US,
@@ -616,7 +618,8 @@
       messages_.Say("A dummy argument must not be initialized"_err_en_US);
     } else if (IsFunctionResult(symbol)) {
       messages_.Say("A function result must not be initialized"_err_en_US);
-    } else if (IsInBlankCommon(symbol)) {
+    } else if (IsInBlankCommon(symbol) &&
+        !FindModuleFileContaining(symbol.owner())) {
       messages_.Say(
           "A variable in blank COMMON should not be initialized"_port_en_US);
     }
@@ -1964,7 +1967,8 @@
         }
       }
     }
-    if (derived->componentNames().empty()) { // C1805
+    if (derived->componentNames().empty() &&
+        !FindModuleFileContaining(symbol.owner())) { // C1805
       messages_.Say(symbol.name(),
           "A derived type with the BIND attribute is empty"_port_en_US);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134455.462585.patch
Type: text/x-patch
Size: 3328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220923/33b83fee/attachment-0001.bin>


More information about the flang-commits mailing list