gbranden pushed a commit to branch master
in repository groff.
commit 70b4f2883f10eaef480feee96c8cd7c7863ce479
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jul 12 04:24:24 2026 -0500
[troff]: Revise message construction.
* src/roff/troff/input.cpp (token::description): When special character
syntax `\[foo]` is not backed by an existing object, we don't know if
a special character or character class is meant. Since the
constructed description is followed by "is not defined", it's
redundant to characterize the token as "nonexistent". Rename `static`
`const` local object `nonexistent` to `special_character_or_class`,
and repopulate its contents accordingly.
Problem exposed by a change in my working copy that appears unlikely to
end up in Savannah. (`rchar` should not provoke a complaint if the
input attempts to remove a special character that doesn't exist, since
doing so is an idempotent operation; see `rr`, `rm`.)
troff:../contrib/mom/examples/sample_docs.mom:482: warning: nonexistent
special character or class 'Sd' is not defined [-w char]
---
ChangeLog | 12 ++++++++++++
src/roff/troff/input.cpp | 11 +++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1d5115111..cb44b781f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-07-12 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::description): Revise
+ message construction. When special character syntax `\[foo]` is
+ not backed by an existing object, we don't know if a special
+ character or character class is meant. Since the constructed
+ description is followed by "is not defined", it's redundant to
+ characterize the token as "nonexistent". Rename `static`
+ `const` local object `nonexistent` to
+ `special_character_or_class`, and repopulate its contents
+ accordingly.
+
2026-07-12 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp: Trivially refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 3aca7f563..effcb4960 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3092,7 +3092,7 @@ const char *token::description()
// "special character 'bracketrighttp'"
// "indexed character -2147483648"
// "space character horizontal motion node token"
- // "nonexistent special character or class"
+ // "special character or class"
// Future:
// "character code XXX (U+XXXX)" or similar
const size_t bufsz
@@ -3171,15 +3171,18 @@ const char *token::description()
// character or character class names. Do something about that.
// (The truncation is visually indicated by the absence of a
// closing quotation mark.)
+ // constexpr // C++11
static const char special_character[] = "special character";
+ // constexpr // C++11
static const char character_class[] = "character class";
- static const char nonexistent[] = "nonexistent special character"
- " or class";
+ // constexpr // C++11
+ static const char special_character_or_class[]
+ = "special character or class";
const char *ctype = special_character;
charinfo *ci = get_charinfo(false /* is_mandatory */,
true /* suppress creation */);
if (0 /* nullptr */ == ci)
- ctype = nonexistent;
+ ctype = special_character_or_class;
else if (ci->is_class())
ctype = character_class;
(void) snprintf(buf, bufsz, "%s %c%s%c", ctype, qc, sc, qc);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit