diff options
| author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-11-10 15:16:50 -0600 |
|---|---|---|
| committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-11-10 15:16:50 -0600 |
| commit | 429723c3ec773a36313001ba70862fa6a7408984 (patch) | |
| tree | 7e7ebf86cee2b623ed3af39b2f5d0228b7bb99e1 | |
| parent | a9fe0544eb52dba799d1b8dbcdd72eda420793a8 (diff) | |
[troff]: Warn on no-op device & output requests.
* src/roff/troff/input.cpp (device_request, output_request): Throw
warning diagnostic if no arguments given.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | man/groff_diff.7.man | 1 | ||||
| -rw-r--r-- | src/roff/troff/input.cpp | 10 |
3 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2023-11-10 G. Branden Robinson <g.branden.robinson@gmail.com> + + * src/roff/troff/input.cpp (device_request, output_request): + Throw warning diagnostic if no arguments given. + 2023-11-06 Pim <pimh@kth.se> * src/preproc/eqn/lex.cpp: Update internal macro definitions diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man index b0a82b5..26b6b96 100644 --- a/man/groff_diff.7.man +++ b/man/groff_diff.7.man @@ -3017,7 +3017,6 @@ used in the top-level diversion. An initial neutral double quote in .I contents is stripped to allow the embedding of leading spaces. -.\" XXX: useless request warning if no argument? . . .TP diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 89812a8..aa776ab 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -5653,6 +5653,11 @@ static node *do_special() void device_request() { + if (!has_arg()) { + warning(WARN_MISSING, "device control request expects arguments"); + skip_line(); + return; + } if (!tok.is_newline() && !tok.is_eof()) { int c; macro mac; @@ -5689,6 +5694,11 @@ void device_macro_request() void output_request() { + if (!has_arg()) { + warning(WARN_MISSING, "output request expects arguments"); + skip_line(); + return; + } if (!tok.is_newline() && !tok.is_eof()) { int c; for (;;) { |
