[bug #68542] [PATCH] [troff] want style warning when auto-crement interpolation applied to non-crementing register

"G. Branden Robinson" <[email protected]> Tue, 21 Jul 2026 02:42:04 -0400 (EDT)
Newsgroups gmane.comp.printing.groff.bugs
Message-ID <[email protected]>
Update of bug #68542 (group groff):

                  Status:                    None => In Progress
             Assigned to:                    None => gbranden
                 Summary: [troff] want style warning when auto-crement
interpolation applied to non-crementing register => [PATCH] [troff] want style
warning when auto-crement interpolation applied to non-crementing register

    _______________________________________________________

Follow-up Comment #1:


$ git diff
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f3657fc99..9ad228935 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1150,11 +1150,29 @@ static symbol
read_crement_and_escape_sequence_parameter(int *incp)
     *incp = 0;
     return read_two_character_escape_sequence_parameter();
   case '+':
-    *incp = 1;
-    return read_escape_sequence_parameter();
+    {
+      *incp = 1;
+      symbol identifier = read_escape_sequence_parameter();
+      reg *r = look_up_register(identifier,
+                               true /* suppress creation */);
+      if (r->get_increment() == 0)
+       warning(WARN_STYLE, "applying incrementing interpolation"
+               " to register '%1' lacking an auto-{in,de}crement",
+               identifier.contents());
+      return identifier;
+    }
   case '-':
-    *incp = -1;
-    return read_escape_sequence_parameter();
+    {
+      *incp = -1;
+      symbol identifier = read_escape_sequence_parameter();
+      reg *r = look_up_register(identifier,
+                               true /* suppress creation */);
+      if (r->get_increment() == 0)
+       warning(WARN_STYLE, "applying decrementing interpolation"
+               " to register '%1' lacking an auto-{in,de}crement",
+               identifier.contents());
+      return identifier;
+    }
   case '[':
     if (!want_att_compat) {
       *incp = 0;


Not planned for _groff_ 1.25.

Still needs documentation updates.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68542>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCal8UvAAKCRCqLAuaBUf3
TniCAQDrBlAwQIUvRKFD3ZEV5h25Qi+i9gaHNeyDhqdSj+tURAD/Xhg3CFME1uOk
14Qbwy72ZYjS+HgwRnRCv/5Zi5zGqAI=
=CKMJ
-----END PGP SIGNATURE-----