[flang-commits] [flang] [flang][driver] add -Wfatal-errors (PR #147614)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Tue Jul 8 16:49:33 PDT 2025


================
@@ -452,22 +452,31 @@ void Messages::ResolveProvenances(const AllCookedSources &allCooked) {
 }
 
 void Messages::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
-    bool echoSourceLines,
-    const common::LanguageFeatureControl *hintFlagPtr) const {
+    bool echoSourceLines, const common::LanguageFeatureControl *hintFlagPtr,
+    size_t maxErrorsToEmit) const {
   std::vector<const Message *> sorted;
   for (const auto &msg : messages_) {
     sorted.push_back(&msg);
   }
   std::stable_sort(sorted.begin(), sorted.end(),
       [](const Message *x, const Message *y) { return x->SortBefore(*y); });
   const Message *lastMsg{nullptr};
+  size_t errorsEmitted{0};
   for (const Message *msg : sorted) {
     if (lastMsg && *msg == *lastMsg) {
       // Don't emit two identical messages for the same location
       continue;
     }
     msg->Emit(o, allCooked, echoSourceLines, hintFlagPtr);
     lastMsg = msg;
+    if (msg->IsFatal()) {
+      ++errorsEmitted;
+    }
----------------
akuhlens wrote:

<img width="1920" alt="Screenshot 2025-07-08 at 4 48 37 PM" src="https://github.com/user-attachments/assets/45793879-b7a3-4766-9f78-83bf9cb3e1f2" />
gfortran also seems to emit the warnings before the first error.

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


More information about the flang-commits mailing list