[flang-commits] [flang] [Flang] Support -Werror=<name> and -Wno-error=<name> (PR #205413)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Wed Jun 24 14:05:21 PDT 2026


================
@@ -169,6 +169,19 @@ bool Message::SortBefore(const Message &that) const {
       location_, that.location_);
 }
 
+static bool ShouldTreatMessageAsFatal(const Message &msg,
+    bool globalWarningsAreErrors,
+    const common::LanguageFeatureControl *control) {
+  if (msg.IsFatal()) {
+    return true;
+  }
+  if (control) {
+    return control->ShouldPromoteWarningToError(
+        globalWarningsAreErrors, msg.languageFeature(), msg.usageWarning());
----------------
akuhlens wrote:

This is exposing a wrinkle in how messages where originally setup. Instead of having a variant for language feature or warning, they have two options. We should fix this, but definitely not here. 

We should not propagate this idiosyncrasy to `LanguageFeatureControl` and include logic there to resolve what the meaning of a message having both a `LanguageFeature` and a `UsageWarning` means. `ShouldPromoteWarningToError` should probably take either a variant or be overloaded. Let the code here in message which should take precedence since it is the one that is currently ambiguous.

https://github.com/llvm/llvm-project/pull/205413


More information about the flang-commits mailing list