gbranden pushed a commit to branch master
in repository groff.

commit a7c7d878cfb0bb0a8b09d53cffd545585655028c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Dec 2 23:52:58 2025 -0600

    [troff]: Improve diagnostics.
    
    * src/roff/troff/input.cpp (token::description): Hedge against
      programmer carelessness.  If someone creates a node type without a
      human-readable descripion, pre-populate the buffer describing it with
      a revealing description that is less frustrating than nothing at all.
    
    Illustration:
    
    $ printf '\\C\\v"1m"\n' | ~/groff-HEAD/bin/groff -aww
    troff:<standard input>:1: warning: cannot use  to delimit a name
    <beginning of page>
    $ printf '\\C\\v"1m"\n' | ./build/test-groff -aww
    troff:<standard input>:1: warning: cannot use an undescribed node to 
delimit a name
    <beginning of page>
---
 ChangeLog                | 8 ++++++++
 src/roff/troff/input.cpp | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8e12480e9..71a535a4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-12-02  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (token::description): Hedge against
+       programmer carelessness.  If someone creates a node type without
+       a human-readable descripion, pre-populate the buffer describing
+       it with a revealing description that is less frustrating than
+       nothing at all.
+
 2025-12-01  G. Branden Robinson <[email protected]>
 
        * src/devices/xditview/xditview.am
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 3c1602a8b..aac808fab 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2984,6 +2984,7 @@ const char *token::description()
   case TOKEN_NODE:
     {
       static char nodebuf[bufsz];
+      (void) strcpy(buf, "an undescribed node");
       describe_node(nodebuf, bufsz);
       return buf;
     }

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

Reply via email to