gbranden pushed a commit to branch master
in repository groff.

commit ec856178ff48ebd59c2586967e8ff94189f81e5f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 28 16:35:30 2025 -0600

    [troff]: Add assertion.
    
    * src/roff/troff/input.cpp (token::description): Add assertion; every
      token type should have a human-readable description.  In the event
      that's not the case and `NDEBUG` is defined, describe the anomalous
      token as "an undescribed token" rather than "a magic token", to make
      it clearer that the problem results from developer oversight.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 383f3263b..e86c69426 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-11-28  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (token::description): Add assertion;
+       every token type should have a human-readable description.  In
+       the event that's not the case and `NDEBUG` is defined, describe
+       the anomalous token as "an undescribed token" rather than "a
+       magic token", to make it clearer that the problem results from
+       developer oversight.
+
 2025-11-28  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/token.h: Add new inline member function
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 0ff52efd1..35224c502 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3031,9 +3031,9 @@ const char *token::description()
   case TOKEN_EOF:
     return "end of input";
   default:
-    break;
+    assert(0 == "unhandled case of `type` (token)");
+    return "an undescribed token";
   }
-  return "a magic token";
 }
 
 void skip_line()

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

Reply via email to