[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 12/24: [troff]: Add warning diagnostic to `cflags`.
From: |
G. Branden Robinson |
Subject: |
[groff] 12/24: [troff]: Add warning diagnostic to `cflags`. |
Date: |
Sun, 10 Nov 2024 14:56:21 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit dac9fa6aa696d61f4806b00396ce81cf09cd5c94
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 9 14:34:12 2024 -0600
[troff]: Add warning diagnostic to `cflags`.
* src/roff/troff/input.cpp (set_character_flags): Check for arguments as
the very first thing in the function, before trying to read an
integer.
This clarifies diagnostics and is helpful if the request is renamed.
$ echo .cflags | ~/groff-stable/bin/groff -ww
troff:<standard input>:1: warning: numeric expression missing
$ echo .cflags | ./build/test-groff -ww
troff:<standard input>:1: warning: character flags configuration request
expects arguments
---
ChangeLog | 6 ++++++
src/roff/troff/input.cpp | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 93a2cfe6a..b3087567f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-11-09 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/input.cpp (set_character_flags): Check for
+ arguments as the very first thing in the function, before trying
+ to read an integer.
+
2024-11-09 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Make more requests that take mandatory arguments--
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 778b043cc..baf8996b0 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7756,6 +7756,12 @@ void translate_input()
static void set_character_flags()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "character flags configuration request"
+ " expects arguments");
+ skip_line();
+ return;
+ }
int flags;
if (get_integer(&flags)) {
if (tok.is_newline() || tok.is_eof()) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 12/24: [troff]: Add warning diagnostic to `cflags`.,
G. Branden Robinson <=