gbranden pushed a commit to branch master
in repository groff.

commit e2eb5eeec983eda3b44ff5e2b26764e7586f2f4c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Mar 18 08:23:33 2026 -0500

    [troff]: Trivially refactor (3/3).
    
    * src/roff/troff/troff.h (enum warning_type): Rename this...
      (enum warning_category): ...to this, for consistency with groff
      documentation and because the enumeration constants aren't
      distinct "types" in the C++ sense.
    
    * src/roff/troff/input.cpp (warning, output_warning): Update users of
      the enumeration type.  Any given diagnostic warning corresponds to
      only one warning category.
---
 ChangeLog                | 12 ++++++++++++
 src/roff/troff/input.cpp |  8 ++++----
 src/roff/troff/troff.h   |  6 +++---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 76d972aa5..b7eb68ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-03-18  G. Branden Robinson <[email protected]>
+
+       [troff]: Trivially refactor.
+
+       * src/roff/troff/troff.h (enum warning_type): Rename this...
+       (enum warning_category): ...to this, for consistency with groff
+       documentation and because the enumeration constants aren't
+       distinct "types" in the C++ sense.
+       * src/roff/troff/input.cpp (warning, output_warning): Update
+       users of the enumeration type.  Any given diagnostic warning
+       corresponds to only one warning category.
+
 2026-03-18  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 aecd2547b..e52002251 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -10765,23 +10765,23 @@ void debug(const char *format,
   do_error(DEBUG, format, arg1, arg2, arg3);
 }
 
-void warning(warning_type t,
+void warning(warning_category wc,
             const char *format,
             const errarg &arg1,
             const errarg &arg2,
             const errarg &arg3)
 {
-  if ((t & desired_warnings) != 0U)
+  if ((wc & desired_warnings) != 0U)
     do_error(WARNING, format, arg1, arg2, arg3);
 }
 
-void output_warning(warning_type t,
+void output_warning(warning_category wc,
                    const char *format,
                    const errarg &arg1,
                    const errarg &arg2,
                    const errarg &arg3)
 {
-  if ((t & desired_warnings) != 0U)
+  if ((wc & desired_warnings) != 0U)
     do_error(OUTPUT_WARNING, format, arg1, arg2, arg3);
 }
 
diff --git a/src/roff/troff/troff.h b/src/roff/troff/troff.h
index fd29514d8..aa52e4b0a 100644
--- a/src/roff/troff/troff.h
+++ b/src/roff/troff/troff.h
@@ -48,7 +48,7 @@ extern search_path *mac_path;
 #include "errarg.h"
 #include "error.h"
 
-enum warning_type {
+enum warning_category {
   WARN_CHAR = 01,
   //WARN_NUMBER = 02, // withdrawn in groff 1.24
   WARN_BREAK = 04,
@@ -76,11 +76,11 @@ enum warning_type {
 
 const int WARN_MAX = 07777777;
 
-void warning(warning_type, const char *,
+void warning(warning_category, const char *,
             const errarg & = empty_errarg,
             const errarg & = empty_errarg,
             const errarg & = empty_errarg);
-void output_warning(warning_type, const char *,
+void output_warning(warning_category, const char *,
                    const errarg & = empty_errarg,
                    const errarg & = empty_errarg,
                    const errarg & = empty_errarg);

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

Reply via email to