[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 10/23: [troff]: Align diagnostic format with libgroff.
From: |
G. Branden Robinson |
Subject: |
[groff] 10/23: [troff]: Align diagnostic format with libgroff. |
Date: |
Thu, 23 Sep 2021 08:12:33 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 121247a6935700884d2552f2636984fa0f15c6ef
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 23 10:35:23 2021 +1000
[troff]: Align diagnostic format with libgroff.
* src/roff/troff/input.cpp (fatal_with_file_and_line): Report the
program name if one is defined.
(fatal_with_file_and_line, error_with_file_and_line,
debug_with_file_and_line): Report the line number of the input file
only if it is positive, so that other values can be used for "whole
file" complaints. See commit cd0457b6, 17 September.
---
ChangeLog | 11 +++++++++++
src/roff/troff/input.cpp | 17 ++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0a29acc..c462327 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2021-09-23 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [troff]: Align diagnostic message format with libgroff.
+
+ * src/roff/troff/input.cpp (fatal_with_file_and_line): Report
+ the program name if one is defined.
+ (fatal_with_file_and_line, error_with_file_and_line,
+ debug_with_file_and_line): Report the line number of the input
+ file only if it is positive, so that other values can be used
+ for "whole file" complaints. See commit cd0457b6, 17 September.
+
+2021-09-23 G. Branden Robinson <g.branden.robinson@gmail.com>
+
[libgroff]: Drop redundant diagnostic.
* src/libs/libgroff/font.cpp (font::load): Drop redundant
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index dad498e..ed8f71a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8826,7 +8826,12 @@ void fatal_with_file_and_line(const char *filename, int
lineno,
const errarg &arg2,
const errarg &arg3)
{
- fprintf(stderr, "%s:%d: fatal error: ", filename, lineno);
+ if (program_name)
+ fprintf(stderr, "%s: ", program_name);
+ fprintf(stderr, "%s:", filename);
+ if (lineno > 0)
+ fprintf(stderr, "%d:", lineno);
+ fputs(" fatal error: ", stderr);
errprint(format, arg1, arg2, arg3);
fputc('\n', stderr);
fflush(stderr);
@@ -8841,7 +8846,10 @@ void error_with_file_and_line(const char *filename, int
lineno,
{
if (program_name)
fprintf(stderr, "%s: ", program_name);
- fprintf(stderr, "%s:%d: error: ", filename, lineno);
+ fprintf(stderr, "%s:", filename);
+ if (lineno > 0)
+ fprintf(stderr, "%d:", lineno);
+ fputs(" error: ", stderr);
errprint(format, arg1, arg2, arg3);
fputc('\n', stderr);
fflush(stderr);
@@ -8856,7 +8864,10 @@ void debug_with_file_and_line(const char *filename,
{
if (program_name)
fprintf(stderr, "%s: ", program_name);
- fprintf(stderr, "%s:%d: debug: ", filename, lineno);
+ fprintf(stderr, "%s:", filename);
+ if (lineno > 0)
+ fprintf(stderr, "%d:", lineno);
+ fputs(" debug: ", stderr);
errprint(format, arg1, arg2, arg3);
fputc('\n', stderr);
fflush(stderr);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 10/23: [troff]: Align diagnostic format with libgroff.,
G. Branden Robinson <=