gbranden pushed a commit to branch master
in repository groff.

commit c5c95d0bf563f4d8accd7a76a2d0c3ca9349bdd8
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Jul 1 22:58:36 2026 -0500

    [tbl]: Warn user when ignoring excess entries.
    
    * src/preproc/tbl/main.cpp (process_data): Emit warning when ignoring
      excess table entries instead of doing so silently.
---
 ChangeLog                |  5 +++++
 src/preproc/tbl/main.cpp | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0ef19baeb..401712c4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,11 @@
        Arrange equality comparisons to avoid inadvertent assignment to
        lvalue (GBR style).
 
+2026-07-01  G. Branden Robinson <[email protected]>
+
+       * src/preproc/tbl/main.cpp (process_data): Emit warning when
+       ignoring excess table entries instead of doing so silently.
+
 2026-07-01  G. Branden Robinson <[email protected]>
 
        * src/preproc/tbl/main.cpp (strieq)
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 918b36e59..8a751bf32 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -1400,6 +1400,19 @@ static table *process_data(table_input &in, format *f, 
options *opt)
              --ln;
            if ((opt->flags & table::NOSPACES))
              input_entry.remove_spaces();
+           if (col >= ncolumns) {
+             // 1-based indices are more familiar to non-programmers.
+             // Those wishing to hack or debug register names used by
+             // GNU tbl will have to adapt.  Someday, we might refactor
+             // those register names...
+             if (input_entry.length() == 0)
+               warning("ignoring excess empty table entry at row %1,"
+                       " column %2", (current_row + 1), (col + 1));
+             else
+               warning("ignoring excess table entry at row %1,"
+                       " column %2: \"%3\"", (current_row + 1),
+                       (col + 1), input_entry.contents());
+           }
            while (col < ncolumns
                   && line_format[col].type == FORMAT_SPAN) {
              tbl->add_entry(current_row, col, "", &line_format[col],

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

Reply via email to