comparison lwasm/pass1.c @ 40:d96037ea0b80

Fixed line number counting being broken by macros
author lost@l-w.ca
date Sat, 02 Apr 2011 22:28:22 -0600
parents 7317fbe024af
children 18b49cf10ae9
comparison
equal deleted inserted replaced
39:23b01aa3ecf9 40:d96037ea0b80
75 *p1++ = '\0'; 75 *p1++ = '\0';
76 if (!strcmp(line + 2, "SETCONTEXT")) 76 if (!strcmp(line + 2, "SETCONTEXT"))
77 { 77 {
78 as -> context = strtol(p1, NULL, 10); 78 as -> context = strtol(p1, NULL, 10);
79 } 79 }
80 else if (!strcmp(line + 2, "SETLINENO"))
81 {
82 lc = strtol(p1, NULL, 10);
83 }
80 lw_free(line); 84 lw_free(line);
81 lc = 1; 85 if (lc == 0)
86 lc = 1;
82 continue; 87 continue;
83 } 88 }
84 debug_message(as, 75, "Read line: %s", line); 89 debug_message(as, 75, "Read line: %s", line);
85 90
86 cl = lw_alloc(sizeof(line_t)); 91 cl = lw_alloc(sizeof(line_t));
126 } 131 }
127 if (!lc && strcmp(cl -> linespec, cl -> prev -> linespec)) 132 if (!lc && strcmp(cl -> linespec, cl -> prev -> linespec))
128 lc = 1; 133 lc = 1;
129 if (lc) 134 if (lc)
130 { 135 {
131 cl -> lineno = 1; 136 cl -> lineno = lc;
132 lc = 0; 137 lc = 0;
133 } 138 }
134 as -> line_tail = cl; 139 as -> line_tail = cl;
135 // blank lines don't count for anything 140 // blank lines don't count for anything
136 // except a local symbol context break 141 // except a local symbol context break