Mercurial > hg > index.cgi
diff lwasm/lwasm.c @ 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 | 80d615a6642c |
children | 6153cb49403c |
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); }