groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 70/115: [troff]: Make futile aliasing an error.


From: G. Branden Robinson
Subject: [groff] 70/115: [troff]: Make futile aliasing an error.
Date: Thu, 1 Jun 2023 10:46:11 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 4003d425436e130ffc166ad5d9fdf2b31c70f50c
Author: G. Branden Robinson <g.branden.robinson@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 462169bc9..04f4ed2f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2023-04-01  G. Branden Robinson <g.branden.robinson@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.robinson@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();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]