mirror of https://github.com/rui314/chibicc
[GNU] Add line marker directive
This commit is contained in:
parent
c61c0d0025
commit
aaf20fb96e
|
@ -839,6 +839,11 @@ static Token *preprocess2(Token *tok) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tok->kind == TK_PP_NUM) {
|
||||||
|
read_line_marker(&tok, tok);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (equal(tok, "error"))
|
if (equal(tok, "error"))
|
||||||
error_tok(tok, "error");
|
error_tok(tok, "error");
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@ int main() {
|
||||||
#line 1
|
#line 1
|
||||||
ASSERT(2, __LINE__);
|
ASSERT(2, __LINE__);
|
||||||
|
|
||||||
|
# 200 "xyz" 2 3
|
||||||
|
ASSERT(201, __LINE__);
|
||||||
|
ASSERT(0, strcmp(__FILE__, "xyz"));
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue