gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit 13388a2917f232e221624edd9d47880604110baa Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sat Apr 1 18:54:35 2023 -0500
[troff]: Make futile aliasing an error. * src/roff/troff/input.cpp (alias_macro): Promote diagnostic when attempting to alias a nonexistent macro/string/diversion from warning to error; this aligns with the handling of the requests `chop`, `stringup`, `stringdown`, `substring`, `asciify`, `unformat`, and `writem` when they are regarded as impossible. Further, attempting to alias a nonexistent object does not create an empty one, unlike interpolating it; try ".als baz qux", then ".pm". * src/roff/troff/reg.cpp (alias_reg): Promote diagnostic when attempting to alias a nonexistent register from warning to error. Attempting to alias a nonexistent register does not create an empty one, unlike interpolating it; try ".aln q r", then ".pnr". --- ChangeLog | 18 ++++++++++++++++++ src/roff/troff/input.cpp | 2 +- src/roff/troff/reg.cpp | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d8d228c0..9b78dd491 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2023-04-01 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: Make futile aliasing an error. + + * src/roff/troff/input.cpp (alias_macro): Promote diagnostic + when attempting to alias a nonexistent macro/string/diversion + from warning to error; this aligns with the handling of the + requests `chop`, `stringup`, `stringdown`, `substring`, + `asciify`, `unformat`, and `writem` when they are regarded as + impossible. Further, attempting to alias a nonexistent object + does not create an empty one, unlike interpolating it; try ".als + baz qux", then ".pm". + * src/roff/troff/reg.cpp (alias_reg): Promote diagnostic when + attempting to alias a nonexistent register from warning to + error. Attempting to alias a nonexistent register does not + create an empty one, unlike interpolating it; try ".aln q r", + then ".pnr". + 2023-03-07 G. Branden Robinson <g.branden.robin...@gmail.com> [tbl]: Trivially refactor. Rename variables and functions to diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 292ee7389..baca587b4 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -4705,7 +4705,7 @@ void alias_macro() symbol s2 = get_name(true /* required */); if (!s2.is_null()) { if (!request_dictionary.alias(s1, s2)) - warning(WARN_MAC, "macro '%1' not defined", s2.contents()); + error("cannot alias undefined object '%1'", s2.contents()); } } skip_line(); diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp index 6b7689d48..3b8f020ae 100644 --- a/src/roff/troff/reg.cpp +++ b/src/roff/troff/reg.cpp @@ -428,7 +428,7 @@ void alias_reg() symbol s2 = get_name(true /* required */); if (!s2.is_null()) { if (!register_dictionary.alias(s1, s2)) - warning(WARN_REG, "register '%1' not defined", s2.contents()); + error("cannot alias undefined register '%1'", s2.contents()); } } skip_line(); _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit