URL: <https://savannah.gnu.org/bugs/?68029>
Summary: [troff] want warning in `syntax` category when `==`
operator used in compatibility mode
Group: GNU roff
Submitter: gbranden
Submitted: Sat 07 Feb 2026 07:35:05 PM UTC
Category: Core
Severity: 3 - Normal
Item Group: Warning/Suspicious behaviour
Status: Postponed
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Sat 07 Feb 2026 07:35:05 PM UTC By: G. Branden Robinson <gbranden>
Consider this exhibit from a macro definition:
.ie \\.$==0 .nr bR 1v
...[https://github.com/NetHack/NetHack/blob/8833e670cdf0f7558418c586ec6f838f6de63478/doc/tmac.nh#L125
from NetHack].
`==` is a GNU _troff_ extension.
As of recently (post-1.23.0), in some cases we throw warnings of non-portable
syntax when compatibility mode is in effect.
But not here.
Unfortunately, the trivial patch I had in mind for the fifth bust of the C/C++
code freeze for _groff_ 1.24.0...
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index 21b6b3e93..cd1416f8b 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -286,8 +286,12 @@ static bool is_valid_expression(units *u, int
scaling_unit,
break;
case int('='): // TODO: grochar
tok.next();
- if (tok.ch() == int('=')) // TODO: grochar
+ if (tok.ch() == int('=')) { // TODO: grochar
+ if (want_att_compat)
+ warning(WARN_SYNTAX, "'==' in a numeric expression is not"
+ " portable to AT&T troff; use '=' instead");
tok.next();
+ }
break;
default:
return result;
...doesn't compile.
make[2]: Entering directory '/home/branden/src/GIT/groff/build'
CXX src/roff/troff/number.o
../src/roff/troff/number.cpp: In function ‘bool is_valid_expression(units*,
int, bool, bool)’:
../src/roff/troff/number.cpp:290:6: error: ‘want_att_compat’ was not
declared in this scope
290 | if (want_att_compat)
| ^~~~~~~~~~~~~~~
make[2]: *** [Makefile:10977: src/roff/troff/number.o] Error 1
I hate making more variables global, though it's hard for me imagine right now
a better solution. (Adding a parameter tracking compatibility mode to every
function that might be in the call stack when interpreting a numeric
expression seems worse; it would hit practically everything in "number.cpp".)
Anyway, mull this over for _groff_ 1.25.
Born postponed.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68029>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
