gbranden pushed a commit to branch master
in repository groff.

commit 494c24d798b0a2003a3769aec5a0f5f5e610a7ce
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Dec 31 03:45:55 2025 -0600

    [troff]: Soften diagnostics in non-dramatic cases.
    
    * src/roff/troff/div.cpp (do_divert): Shift checks resulting in error
      diagnostics, including a fatal one, later in the logic.  It's not a
      problem to close a diversion of mismatched "boxing" (see Savannah
      #67139) when the diversion stack is empty.  We can simply emit a
      warning as groff 1.23.0 and earlier did.  Continues commit 251115ed5a,
      19 May.
---
 ChangeLog              |  9 +++++++++
 src/roff/troff/div.cpp | 14 +++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa42474d1..d1f731c83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-12-31  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/div.cpp (do_divert): Shift checks resulting in
+       error diagnostics, including a fatal one, later in the logic.
+       It's not a problem to close a diversion of mismatched "boxing"
+       {see Savannah #67139} when the diversion stack is empty.  We can
+       simply emit a warning as groff 1.23.0 and earlier did.
+       Continues commit 251115ed5a, 19 May.
+
 2025-12-30  G. Branden Robinson <[email protected]>
 
        [troff]: Work on Savannah #67735.
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index d237967b2..15a7f653e 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -106,13 +106,13 @@ void do_divert(bool appending, bool boxing)
   tok.skip_spaces();
   symbol nm = read_identifier();
   if (nm.is_null()) {
-    // Why the asymmetric diagnostic severity?  See Savannah #67139.
-    if (!(curdiv->is_box) && boxing)
-      fatal("cannot close ordinary diversion with box request");
-    if (curdiv->is_box && !boxing)
-      error("cannot close box diversion with ordinary diversion"
-           " request");
-    else if (curdiv->prev) {
+    if (curdiv->prev != 0 /* nullptr */) {
+      // Why the asymmetric diagnostic severity?  See Savannah #67139.
+      if (!(curdiv->is_box) && boxing)
+       fatal("cannot close ordinary diversion with box request");
+      if (curdiv->is_box && !boxing)
+       error("cannot close box diversion with ordinary diversion"
+             " request");
       curenv->seen_break = curdiv->saved_seen_break;
       curenv->seen_space = curdiv->saved_seen_space;
       curenv->seen_eol = curdiv->saved_seen_eol;

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to