From 3af56d187f0c28ba95af383de72d2b6a07dddc20 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 12 Feb 2009 02:37:59 -0500 Subject: [PATCH] Report filenames in error messages. --- assemble.c | 3 ++- finderrors.c | 5 ++++- preprocess.c | 3 ++- testoutput.c | 3 ++- testparse.c | 3 ++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assemble.c b/assemble.c index 9f75c09b..15ca9bda 100644 --- a/assemble.c +++ b/assemble.c @@ -30,7 +30,8 @@ static int assemble(const char *buf, int len, const char *outfile) int i; for (i = 0; i < pd->error_count; i++) { - printf("ERROR: (line %d) %s\n", + printf("%s:%d: ERROR: %s\n", + pd->errors[i].filename ? pd->errors[i].filename : "???", pd->errors[i].error_position, pd->errors[i].error); } // for diff --git a/finderrors.c b/finderrors.c index 714f0e00..ac89a002 100644 --- a/finderrors.c +++ b/finderrors.c @@ -88,7 +88,10 @@ static int do_file(const char *profile, const char *dname, const char *fn, int * if (a->error_count > 0) { - report("FAIL: %s (line %d) %s\n", fname, a->errors[0].error_position, a->errors[0].error); + report("FAIL: %s (line %d) %s\n", + a->errors[0].filename ? a->errors[0].filename : "???", + a->errors[0].error_position, + a->errors[0].error); return 1; } // if diff --git a/preprocess.c b/preprocess.c index ad3578af..0a6cb8b2 100644 --- a/preprocess.c +++ b/preprocess.c @@ -31,7 +31,8 @@ static int preprocess(const char *buf, int len, const char *outfile) int i; for (i = 0; i < pd->error_count; i++) { - printf("ERROR: (line %d) %s\n", + printf("%s:%d: ERROR: %s\n", + pd->errors[i].filename ? pd->errors[i].filename : "???", pd->errors[i].error_position, pd->errors[i].error); } // for diff --git a/testoutput.c b/testoutput.c index 6eeaa8b4..26e55aa2 100644 --- a/testoutput.c +++ b/testoutput.c @@ -22,7 +22,8 @@ static int do_parse(const unsigned char *buf, const int len, const char *prof) int i; for (i = 0; i < pd->error_count; i++) { - printf("ERROR: (line %d) %s\n", + printf("%s:%d: ERROR: %s\n", + pd->errors[i].filename ? pd->errors[i].filename : "???", pd->errors[i].error_position, pd->errors[i].error); } // for diff --git a/testparse.c b/testparse.c index 52a27ad5..8ec9a569 100644 --- a/testparse.c +++ b/testparse.c @@ -66,7 +66,8 @@ static int do_parse(const unsigned char *buf, const int len, const char *prof) int i; for (i = 0; i < pd->error_count; i++) { - printf("ERROR: (position %d) %s\n", + printf("%s:%d: ERROR: %s\n", + pd->errors[i].filename ? pd->errors[i].filename : "???", pd->errors[i].error_position, pd->errors[i].error); } // for