gbranden pushed a commit to branch master
in repository groff.

commit 33f557eceb58f94ebeabf4668ef0d80746ffa60b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Aug 31 18:40:48 2025 -0500

    [troff]: "Asciify" dummy nodes as nothing.
    
    ...suppressing non-actionable diagnostic message.  (The dummy character
    escape sequence produces a dummy node when formatted.)
    
    * src/roff/troff/node.h (class dummy_node): Declare `asciify` member
      function, thus overriding base class.
    
    * src/roff/troff/node.cpp (dummy_node::asciify): New member function
      does "nothing" in the same way that those of `line_start_node` and
      `vertical_size_node`s do: delete the `this` object and return.
    
    Thanks to Deri James for the discussion and proof of concept.
---
 ChangeLog               | 15 +++++++++++++++
 src/roff/troff/node.cpp |  5 +++++
 src/roff/troff/node.h   |  1 +
 3 files changed, 21 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index cbf4f64c5..445c75fb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2025-08-31  G. Branden Robinson <[email protected]>
+
+       [troff]: "Asciify" dummy nodes as nothing, suppressing
+       non-actionable diagnostic message.  (The dummy character escape
+       sequence produces a dummy node when formatted.)
+
+       * src/roff/troff/node.h (class dummy_node): Declare `asciify`
+       member function, thus overriding base class.
+       * src/roff/troff/node.cpp (dummy_node::asciify): New member
+       function does "nothing" in the same way that those of
+       `line_start_node` and `vertical_size_node`s do: delete the
+       `this` object and return.
+
+       Thanks to Deri James for the discussion and proof of concept.
+
 2025-09-04  G. Branden Robinson <[email protected]>
 
        [groff]: Unit-test `asciify` request.
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 821ac0ed2..95f0cfe2e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4018,6 +4018,11 @@ void vertical_size_node::asciify(macro *)
   delete this;
 }
 
+void dummy_node::asciify(macro *)
+{
+  delete this;
+}
+
 breakpoint *node::get_breakpoints(hunits /* width */, int /* nspaces */,
                                  breakpoint *rest, bool /* is_inner */)
 {
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index a22c2084d..f79204a33 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -466,6 +466,7 @@ public:
 class dummy_node : public node {
 public:
   dummy_node(node * nd = 0 /* nullptr */) : node(nd) {}
+  void asciify(macro *);
   node *copy();
   bool is_same_as(node *);
   const char *type();

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

Reply via email to