[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/02: Align diagnostic message format.
From: |
G. Branden Robinson |
Subject: |
[groff] 01/02: Align diagnostic message format. |
Date: |
Tue, 31 Mar 2020 11:20:03 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit dc0e4c0fd548d915e7c44319fc83f61a5843c0ca
Author: G. Branden Robinson <address@hidden>
AuthorDate: Wed Apr 1 01:49:42 2020 +1100
Align diagnostic message format.
* src/libs/libgroff/error.cpp (do_error_with_file_and_line):
* src/roff/troff/input.cpp (do_error):
Display the diagnostic level when it is "error", instead of leaving it
implicit.
* src/roff/troff/input.cpp (error_with_file_and_line): Include the
program name in the diagnostic message if it is known.
* src/roff/groff/tests/string_case_xform_errors.sh: Update diagnostic
message expectation.
---
ChangeLog | 15 +++++++++++++++
src/libs/libgroff/error.cpp | 13 ++++---------
src/roff/groff/tests/string_case_xform_errors.sh | 2 +-
src/roff/troff/input.cpp | 3 +++
4 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0281062..e7f9743 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-04-01 G. Branden Robinson <address@hidden>
+
+ Align diagnostic message format.
+
+ * src/libs/libgroff/error.cpp (do_error_with_file_and_line):
+ * src/roff/troff/input.cpp (do_error):
+ Display the diagnostic level when it is "error", instead of
+ leaving it implicit.
+
+ * src/roff/troff/input.cpp (error_with_file_and_line): Include
+ the program name in the diagnostic message if it is known.
+
+ * src/roff/groff/tests/string_case_xform_errors.sh: Update
+ diagnostic message expectation.
+
2020-03-31 G. Branden Robinson <address@hidden>
* src/roff/troff/input.cpp (read_size): Improve bad digit
diff --git a/src/libs/libgroff/error.cpp b/src/libs/libgroff/error.cpp
index 9a18803..14949b9 100644
--- a/src/libs/libgroff/error.cpp
+++ b/src/libs/libgroff/error.cpp
@@ -50,24 +50,19 @@ static void do_error_with_file_and_line(const char
*filename,
fprintf(stderr, "%s:%d:", filename, lineno);
need_space = 1;
}
- if (need_space) {
+ if (need_space)
fputc(' ', stderr);
- need_space = 0;
- }
switch (type) {
case FATAL:
- fputs("fatal error:", stderr);
- need_space = 1;
+ fputs("fatal error: ", stderr);
break;
case ERROR:
+ fputs("error: ", stderr);
break;
case WARNING:
- fputs("warning:", stderr);
- need_space = 1;
+ fputs("warning: ", stderr);
break;
}
- if (need_space)
- fputc(' ', stderr);
errprint(format, arg1, arg2, arg3);
fputc('\n', stderr);
fflush(stderr);
diff --git a/src/roff/groff/tests/string_case_xform_errors.sh
b/src/roff/groff/tests/string_case_xform_errors.sh
index 56f322d..c1c02bc 100755
--- a/src/roff/groff/tests/string_case_xform_errors.sh
+++ b/src/roff/groff/tests/string_case_xform_errors.sh
@@ -20,7 +20,7 @@
groff="${abs_top_builddir:-.}/test-groff"
-expected="troff: <standard input>:1: cannot apply string case transformation
to a request ('br')"
+expected="troff: <standard input>:1: error: cannot apply string case
transformation to a request ('br')"
actual=$("$groff" -Tutf8 2>&1 <<EOF
.stringdown br
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 3231933..7bbdab4 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8664,6 +8664,7 @@ static void do_error(error_type type,
fputs("fatal error: ", stderr);
break;
case ERROR:
+ fputs("error: ", stderr);
break;
case WARNING:
fputs("warning: ", stderr);
@@ -8751,6 +8752,8 @@ void error_with_file_and_line(const char *filename, int
lineno,
const errarg &arg2,
const errarg &arg3)
{
+ if (program_name)
+ fprintf(stderr, "%s: ", program_name);
fprintf(stderr, "%s:%d: error: ", filename, lineno);
errprint(format, arg1, arg2, arg3);
fputc('\n', stderr);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/02: Align diagnostic message format.,
G. Branden Robinson <=