gbranden pushed a commit to branch master
in repository groff.

commit 1222385e42032dea31fb1eb893653de5ae8cae05
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jan 17 20:03:54 2025 -0600

    [troff]: More requests warn of missing arguments.
    
    Make more requests that take mandatory arguments--specifically `char`,
    `fchar`, and `schar`--throw warning diagnostics in category "missing"
    when they aren't given any.
    
    * src/roff/troff/input.cpp (define_character_request)
      (define_fallback_character_request)
      (define_special_character_request): Do it.
---
 ChangeLog                | 10 ++++++++++
 src/roff/troff/input.cpp | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4b8ebeae8..fd49d04eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-01-17  G. Branden Robinson <[email protected]>
+
+       [troff]: Make more requests that take mandatory arguments--
+       specifically `char`, `fchar`, and `schar`--throw warning
+       diagnostics in category "missing" when they aren't given any.
+
+       * src/roff/troff/input.cpp (define_character_request)
+       (define_fallback_character_request)
+       (define_special_character_request): Do it.
+
 2025-01-17  G. Branden Robinson <[email protected]>
 
        [troff]: Rename enumeration constants for clarity.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 0947ce725..1ec25e9fa 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4607,16 +4607,34 @@ void define_character(char_mode mode, const char 
*font_name)
 
 static void define_character_request()
 {
+  if (!has_arg(true /* peek; we want to read in copy mode */)) {
+    warning(WARN_MISSING, "character definition request expects"
+           " arguments");
+    skip_line();
+    return;
+  }
   define_character(CHAR_NORMAL);
 }
 
 static void define_fallback_character_request()
 {
+  if (!has_arg(true /* peek; we want to read in copy mode */)) {
+    warning(WARN_MISSING, "fallback character definition request"
+           " expects arguments");
+    skip_line();
+    return;
+  }
   define_character(CHAR_FALLBACK);
 }
 
 static void define_special_character_request()
 {
+  if (!has_arg(true /* peek; we want to read in copy mode */)) {
+    warning(WARN_MISSING, "special character definition request expects"
+           " arguments");
+    skip_line();
+    return;
+  }
   define_character(CHAR_SPECIAL_FALLBACK);
 }
 

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

Reply via email to