Skip to content

[flang] Silence warnings from module files after recent change #92834

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
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions flang/lib/Semantics/check-declarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2998,14 +2998,14 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
examinedByWhyNotInteroperable_.insert(symbol);
CHECK(symbol.has<ObjectEntityDetails>());
if (isExplicitBindC && !symbol.owner().IsModule()) {
messages_.Say(symbol.name(),
msgs.Say(symbol.name(),
"A variable with BIND(C) attribute may only appear in the specification part of a module"_err_en_US);
}
auto shape{evaluate::GetShape(foldingContext_, symbol)};
if (shape) {
if (evaluate::GetRank(*shape) == 0) { // 18.3.4
if (IsAllocatableOrPointer(symbol) && !IsDummy(symbol)) {
messages_.Say(symbol.name(),
msgs.Say(symbol.name(),
"A scalar interoperable variable may not be ALLOCATABLE or POINTER"_err_en_US);
}
} else if (auto extents{
Expand All @@ -3026,25 +3026,22 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
if (derived) {
if (derived->typeSymbol().attrs().test(Attr::BIND_C)) {
} else if (isError) {
if (auto *msg{messages_.Say(symbol.name(),
"The derived type of a BIND(C) object must also be BIND(C)"_err_en_US)}) {
msg->Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
}
context_.SetError(symbol);
msgs.Say(symbol.name(),
"The derived type of a BIND(C) object must also be BIND(C)"_err_en_US)
.Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
} else if (auto bad{WhyNotInteroperableDerivedType(
derived->typeSymbol(), /*isError=*/false)};
bad.AnyFatalError()) {
if (auto *msg{messages_.Say(symbol.name(),
"The derived type of an interoperable object must be interoperable, but is not"_err_en_US)}) {
msg->Attach(
derived->typeSymbol().name(), "Non-interoperable type"_en_US);
bad.AttachTo(*msg, parser::Severity::None);
}
bad.AttachTo(
msgs.Say(symbol.name(),
"The derived type of an interoperable object must be interoperable, but is not"_err_en_US)
.Attach(derived->typeSymbol().name(),
"Non-interoperable type"_en_US),
parser::Severity::None);
} else {
if (auto *msg{messages_.Say(symbol.name(),
"The derived type of an interoperable object should be BIND(C)"_warn_en_US)}) {
msg->Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
}
msgs.Say(symbol.name(),
"The derived type of an interoperable object should be BIND(C)"_warn_en_US)
.Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
}
}
if (type->IsAssumedType()) { // ok
Expand Down
Loading