changeset 388:f813a56178c0

Make error output more friendly to IDEs Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 21:34:50 -0600
parents 2abcd82b455f
children 2d9b7ae6c329
files lwasm/lwasm.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/lwasm.c	Mon Jul 13 21:33:54 2015 -0600
+++ b/lwasm/lwasm.c	Mon Jul 13 21:34:50 2015 -0600
@@ -1092,13 +1092,19 @@
 	{
 		if (!(cl -> err) && !(cl -> warn))
 			continue;
+
+		// trim "include:" if it appears
+		char* s = cl->linespec;
+		if ((strlen(s) > 8) && (s[7] == ':')) s += 8;
+		while (*s == ' ') s++;
+
 		for (e = cl -> err; e; e = e -> next)
 		{
-			fprintf(stderr, "ERROR: %s (%d)\n", e -> mess, e -> code);
+			fprintf(stderr, "%s(%d) : ERROR : %s\n", s, cl->lineno, e->mess);
 		}
 		for (e = cl -> warn; e; e = e -> next)
 		{
-			fprintf(stderr, "WARNING: %s (%d)\n", e -> mess, e -> code);
+			fprintf(stderr, "%s(%d) : WARNING : %s\n", s, cl->lineno, e->mess);
 		}
 		fprintf(stderr, "%s:%05d %s\n\n", cl -> linespec, cl -> lineno, cl -> ltext);
 	}