gbranden pushed a commit to branch master
in repository groff.

commit 4fe5f37d6139744d23b2a71de480a7a6cc4a335e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jun 23 15:17:38 2026 -0500

    [eqn]: Add `lex_warning()` function.
    
    * src/preproc/eqn/eqn.h: Declare it.
    
    * src/preproc/eqn/lex.cpp (lex_warning): Define it.
---
 ChangeLog               |  7 +++++++
 src/preproc/eqn/eqn.h   |  4 ++++
 src/preproc/eqn/lex.cpp | 14 ++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4d5db0051..123c83a3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-06-23  G. Branden Robinson <[email protected]>
+
+       [eqn]: Add `lex_warning()` function.
+
+       * src/preproc/eqn/eqn.h: Declare it.
+       * src/preproc/eqn/lex.cpp (lex_warning): Define it.
+
 2026-06-24  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp: Fix `-Wstringop-truncation`
diff --git a/src/preproc/eqn/eqn.h b/src/preproc/eqn/eqn.h
index 5d606f55b..1c4692cea 100644
--- a/src/preproc/eqn/eqn.h
+++ b/src/preproc/eqn/eqn.h
@@ -44,6 +44,10 @@ void lex_error(const char *message,
               const errarg &arg1 = empty_errarg,
               const errarg &arg2 = empty_errarg,
               const errarg &arg3 = empty_errarg);
+void lex_warning(const char *,
+                const errarg & /* arg1 */ = empty_errarg,
+                const errarg & /* arg2 */ = empty_errarg,
+                const errarg & /* arg3 */ = empty_errarg);
 
 void init_table(const char *device);
 
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index 4f53b904e..ef6998ca9 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -1264,6 +1264,20 @@ void lex_error(const char *message,
                             arg3);
 }
 
+void lex_warning(const char *message,
+                const errarg &arg1,
+                const errarg &arg2,
+                const errarg &arg3)
+{
+  char *filename;
+  int lineno;
+  if (!get_location(&filename, &lineno))
+    warning(message, arg1, arg2, arg3);
+  else
+    warning_with_file_and_line(filename, lineno, message, arg1, arg2,
+                              arg3);
+}
+
 extern void yyerror(const char *);
 
 void yyerror(const char *s)

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to