wcc: c-side mangles private decls; main exempt as entry-point convention
This commit is contained in:
@@ -94,6 +94,27 @@ skipws(Lex *l)
|
||||
continue;
|
||||
}
|
||||
if (c == '/' && lpeek(l, 1) == '/') {
|
||||
lget(l); lget(l); /* consume '//' */
|
||||
/* `// MODULE: foo` directive emitted by the ww
|
||||
* driver before each source-file's section in
|
||||
* combined.ww. Captured so cgen can mangle
|
||||
* non-exported symbols by module. */
|
||||
if (lpeek(l, 0) == ' '
|
||||
&& lpeek(l, 1) == 'M' && lpeek(l, 2) == 'O'
|
||||
&& lpeek(l, 3) == 'D' && lpeek(l, 4) == 'U'
|
||||
&& lpeek(l, 5) == 'L' && lpeek(l, 6) == 'E'
|
||||
&& lpeek(l, 7) == ':' && lpeek(l, 8) == ' ') {
|
||||
for (int i = 0; i < 9; i++) lget(l);
|
||||
u64 start = l->pos;
|
||||
while ((c = lpeek(l, 0)) >= 0
|
||||
&& c != '\n' && c != '\r')
|
||||
lget(l);
|
||||
u64 n = l->pos - start;
|
||||
char *m = amalloc(l->a, n + 1);
|
||||
memcpy(m, l->src + start, n);
|
||||
m[n] = '\0';
|
||||
l->module = m;
|
||||
}
|
||||
while ((c = lpeek(l, 0)) >= 0 && c != '\n')
|
||||
lget(l);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user