diff options
author | Peter Klausler <35819229+klausler@users.noreply.github.com> | 2024-05-01 14:33:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 14:33:14 -0700 |
commit | 505f6da1961ab55c601d7239648c53ce863b5d70 (patch) | |
tree | 383ed4a682d2d65a99a109ffe46ca4e08e48387d /flang/lib/Semantics/mod-file.cpp | |
parent | 37277d8da8afd3291240a14a19193024065cf7ca (diff) | |
download | llvm-505f6da1961ab55c601d7239648c53ce863b5d70.zip llvm-505f6da1961ab55c601d7239648c53ce863b5d70.tar.gz llvm-505f6da1961ab55c601d7239648c53ce863b5d70.tar.bz2 |
[flang] Ensure all warning/portability messages are guarded by Should… (#90518)
…Warn()
Many warning messages were being emitted unconditionally. Ensure that
all warnings are conditional on a true result from a call to
common::LanguageFeatureControl::ShouldWarn() so that it is easy for a
driver to disable them all, or, in the future, to provide per-warning
control over them.
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index 9231072..e9aebe5 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -1397,13 +1397,17 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic, std::optional<ModuleCheckSumType> checkSum{ VerifyHeader(sourceFile->content())}; if (!checkSum) { - Say(name, ancestorName, "File has invalid checksum: %s"_warn_en_US, - sourceFile->path()); + if (context_.ShouldWarn(common::UsageWarning::ModuleFile)) { + Say(name, ancestorName, "File has invalid checksum: %s"_warn_en_US, + sourceFile->path()); + } return nullptr; } else if (requiredHash && *requiredHash != *checkSum) { - Say(name, ancestorName, - "File is not the right module file for %s"_warn_en_US, - "'"s + name.ToString() + "': "s + sourceFile->path()); + if (context_.ShouldWarn(common::UsageWarning::ModuleFile)) { + Say(name, ancestorName, + "File is not the right module file for %s"_warn_en_US, + "'"s + name.ToString() + "': "s + sourceFile->path()); + } return nullptr; } llvm::raw_null_ostream NullStream; |