comparison 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
comparison
equal deleted inserted replaced
387:2abcd82b455f 388:f813a56178c0
1090 1090
1091 for (cl = as -> line_head; cl; cl = cl -> next) 1091 for (cl = as -> line_head; cl; cl = cl -> next)
1092 { 1092 {
1093 if (!(cl -> err) && !(cl -> warn)) 1093 if (!(cl -> err) && !(cl -> warn))
1094 continue; 1094 continue;
1095
1096 // trim "include:" if it appears
1097 char* s = cl->linespec;
1098 if ((strlen(s) > 8) && (s[7] == ':')) s += 8;
1099 while (*s == ' ') s++;
1100
1095 for (e = cl -> err; e; e = e -> next) 1101 for (e = cl -> err; e; e = e -> next)
1096 { 1102 {
1097 fprintf(stderr, "ERROR: %s (%d)\n", e -> mess, e -> code); 1103 fprintf(stderr, "%s(%d) : ERROR : %s\n", s, cl->lineno, e->mess);
1098 } 1104 }
1099 for (e = cl -> warn; e; e = e -> next) 1105 for (e = cl -> warn; e; e = e -> next)
1100 { 1106 {
1101 fprintf(stderr, "WARNING: %s (%d)\n", e -> mess, e -> code); 1107 fprintf(stderr, "%s(%d) : WARNING : %s\n", s, cl->lineno, e->mess);
1102 } 1108 }
1103 fprintf(stderr, "%s:%05d %s\n\n", cl -> linespec, cl -> lineno, cl -> ltext); 1109 fprintf(stderr, "%s:%05d %s\n\n", cl -> linespec, cl -> lineno, cl -> ltext);
1104 } 1110 }
1105 } 1111 }
1106 1112