[Nasm-commits] [nasm:nasm-2.15.xx] nasm.c: correctly print errors once committed; assert errhold_stack empty
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Thu Jun 4 19:57:05 PDT 2020
Commit-ID: 283bc92a92b71904ee7d3769ea94e452ee353178
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=283bc92a92b71904ee7d3769ea94e452ee353178
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Thu, 4 Jun 2020 16:19:51 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Thu, 4 Jun 2020 16:19:51 -0700
nasm.c: correctly print errors once committed; assert errhold_stack empty
Properly format the error messages when we print them (oops!)
The errhold_stack should be empty after each pass. It may even be
worthwhile to make sure it is empty after each *line*, but do this
for now.
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/nasm.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/asm/nasm.c b/asm/nasm.c
index be557e70..2f6634ef 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1,4 +1,4 @@
- /* ----------------------------------------------------------------------- *
+/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2020 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
@@ -87,6 +87,7 @@ static const struct error_format errfmt_gnu = { ":", "", ": " };
static const struct error_format errfmt_msvc = { "(", ")", " : " };
static const struct error_format *errfmt = &errfmt_gnu;
static struct strlist *warn_list;
+static struct nasm_errhold *errhold_stack;
unsigned int debug_nasm; /* Debugging messages? */
@@ -1663,6 +1664,9 @@ static void assemble_file(const char *fname, struct strlist *depend_list)
preproc->cleanup_pass();
+ /* We better not be having an error hold still... */
+ nasm_assert(!errhold_stack);
+
if (global_offset_changed) {
switch (pass_type()) {
case PASS_OPT:
@@ -1907,7 +1911,6 @@ struct nasm_errhold {
struct nasm_errhold *up;
struct nasm_errtext *head, **tail;
};
-static struct nasm_errhold *errhold_stack;
static void nasm_free_error(struct nasm_errtext *et)
{
@@ -2069,15 +2072,17 @@ static void nasm_issue_error(struct nasm_errtext *et)
pfx, et->msg, here, warnsuf);
} else {
/*
- * If we have buffered warnings, and this is a non-warning,
- * output them now.
+ * Actually output an error. If we have buffered
+ * warnings, and this is a non-warning, output them now.
*/
if (true_type >= ERR_NONFATAL && warn_list) {
strlist_write(warn_list, "\n", error_file);
strlist_free(&warn_list);
}
- fprintf(error_file, "%s\n", et->msg);
+ fprintf(error_file, "%s%s%s%s%s%s%s\n",
+ file, linestr, errfmt->beforemsg,
+ pfx, et->msg, here, warnsuf);
}
}
More information about the Nasm-commits
mailing list