groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 02/05: src/preproc/tbl/table.cpp: Regularize diagnostics.


From: G. Branden Robinson
Subject: [groff] 02/05: src/preproc/tbl/table.cpp: Regularize diagnostics.
Date: Sat, 26 Sep 2020 22:08:50 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit f75e156b621d3743368c58425f357e6cd52372a0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Sep 26 10:41:29 2020 +1000

    src/preproc/tbl/table.cpp: Regularize diagnostics.
    
    * src/preproc/tbl/table.cpp (table::init_output):
      (table::compute_expand_width):
      (table::compute_separation_factor): Use consistent format for
      diagnostic messages.
      + Do not spread a single diagnostic across multiple lines.
      + Report messages in GNU Coding Standards format, that is:
      + Report the name of the file the problem is in...
      + ...then the line number...
      + ...then the diagnostic severity level...
      + ...then the specific problem.
    
    Unfortunately source line numbers for tbl(1) tables can get a bit
    approximate and are badly off in some cases (I think it has to do with
    text blocks--I'll be investgating that soon), but that is a separate
    issue.
    
    Continues the long process of fixing Savannah #52463.
    
    Here are examples of output before and after this change. \\ marks lines
    wrapped for the purpose of this commit message.
    
    Before:
    
    $ groff -z -Tps -t -ms diag1-Tps.ms
    warning: file 'diag1-Tps.ms', around line 11:
      table wider than line width
    warning: file 'diag1-Tps.ms', around line 11:
      column separation set to zero
    warning: file 'diag1-Tps.ms', around line 101:
      table wider than line width
    warning: file 'diag1-Tps.ms', around line 96:
      table squeezed horizontally to fit line length
    $ groff -z -Tps -t -man diag2-Tps.man
    error: page 2: table will not fit on one page; use .TS H/.TH with a \\
    supporting macro package
    $ groff -z -Tutf8 -t -man diag3-Tutf8.man
    warning: page 3: table text block will not fit on one page
    warning: page 10: table text block will not fit on one page
    
    Now:
    
    $ ../build/test-groff -z -Tps -t -ms diag1-Tps.ms
    diag1-Tps.ms: around line 11: warning: table wider than line width
    diag1-Tps.ms: around line 11: warning: column separation set to zero
    diag1-Tps.ms: around line 101: warning: table wider than line width
    diag1-Tps.ms: around line 96: warning: table squeezed horizontally to \\
    fit line length
    $ ../build/test-groff -z -Tps -t -man diag2-Tps.man
    diag2-Tps.man: around line 3660: error: table will not fit on page 2; \\
    use .TS H/.TH with a supporting macro package
    $ ../build/test-groff -z -Tutf8 -t -man diag3-Tutf8.man
    diag3-Tutf8.man: around line 536: warning: table text block will not \\
    fit on page 3
    diag3-Tutf8.man: around line 1361: warning: table text block will not \\
    fit on page 10
---
 ChangeLog                 | 13 +++++++++++++
 src/preproc/tbl/table.cpp | 31 ++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d85f5b..48903f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2020-09-26  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * src/preproc/tbl/table.cpp (table::init_output):
+       (table::compute_expand_width):
+       (table::compute_separation_factor): Use consistent format for
+       diagnostic messages.
+       + Do not spread a single diagnostic across multiple lines.
+       + Report messages in GNU Coding Standards format, that is:
+       + Report the name of the file the problem is in...
+       + ...then the line number...
+       + ...then the diagnostic severity level...
+       + ...then the specific problem.
+
+2020-09-26  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * tmac/an-old.tmac: Emit warnings when configuration registers
        are ignored when producing output for HTML.
 
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index d60d348..482192c 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1839,11 +1839,13 @@ void table::init_output()
           ".nr " SUPPRESS_BOTTOM_REG " 0\n"
           ".mk #T\n"
           ".\\}\n"
-          ".if \\n[.t]<=\\n[" SAVED_DN_REG "] "
-          /* Since we turn off traps, it won't get into an infinite loop
-          when we try and print it; it will just go off the bottom of the
-          page. */
-          ".tm warning: page \\n%: table text block will not fit on one page\n"
+          ".if \\n[.t]<=\\n[" SAVED_DN_REG "] \\{\\\n"
+          /* Since we turn off traps, it won't get into an infinite
+             loop when we try and print it; it will just go off the
+             bottom of the page. */
+          ".  tmc \\n[.F]: around line \\n[.c]: warning:\n"
+          ".  tm1 \" table text block will not fit on page \\n%\n"
+          ".\\}\n"
           ".nf\n"
           ".if \\n[ln] .nm \\n[ln]\n"
           ".nr " ROW_MAX_LINE_REG " \\n[ln]\n"
@@ -1871,8 +1873,11 @@ void table::init_output()
           ".di\n"
           ".nr " SAVED_DN_REG " \\n[dn]\n"
           ".ne \\n[dn]u+\\n[.V]u\n"
-          ".ie \\n[.t]<=\\n[" SAVED_DN_REG "] "
-          ".tm error: page \\n%: table will not fit on one page; use .TS H/.TH 
with a supporting macro package\n"
+          ".ie \\n[.t]<=\\n[" SAVED_DN_REG "] \\{\\\n"
+          ".  tmc \\n[.F]: around line \\n[.c]: error:\n"
+          ".  tmc \" table will not fit on page \\n%;\n"
+          ".  tm1 \" use .TS H/.TH with a supporting macro package\n"
+          ".\\}\n"
           ".el \\{"
           ".in 0\n"
           ".ls 1\n"
@@ -2131,8 +2136,8 @@ void table::compute_expand_width()
           "delim off\n"
           ".EN\n"
           "..\n");
-    prints(".tm1 \"warning: file '\\n[.F]', around line \\n[.c]:\n"
-          ".tm1 \"  table wider than line width\n");
+    prints(".tmc \\n[.F]: around line \\n[.c]: warning:\n"
+          ".tm1 \" table wider than line width\n");
     prints(".ig\n"
           ".EQ\n"
           "delim on\n"
@@ -2183,16 +2188,16 @@ void table::compute_separation_factor()
           "delim off\n"
           ".EN\n"
           "..\n");
-    prints(".tm1 \"warning: file '\\n[.F]', around line \\n[.c]:\n"
-          ".tm1 \"  column separation set to zero\n"
+    prints(".tmc \\n[.F]: around line \\n[.c]: warning:\n"
+          ".tm1 \" column separation set to zero\n"
           ".nr " SEPARATION_FACTOR_REG " 0\n");
   }
   prints(".\\}\n"
         ".el .if \\n[" SEPARATION_FACTOR_REG "]<1n \\{\\\n");
   entry_list->set_location();
   if (!(flags & NOWARN)) {
-    prints(".tm1 \"warning: file '\\n[.F]', around line \\n[.c]:\n"
-          ".tm1 \"  table squeezed horizontally to fit line length\n");
+    prints(".tmc \\n[.F]: around line \\n[.c]: warning:\n"
+          ".tm1 \" table squeezed horizontally to fit line length\n");
     prints(".ig\n"
           ".EQ\n"
           "delim on\n"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]