[GNU] Add line marker directive

This commit is contained in:
Rui Ueyama 2020-07-22 22:16:01 +09:00
parent c61c0d0025
commit aaf20fb96e
2 changed files with 9 additions and 0 deletions

View File

@ -839,6 +839,11 @@ static Token *preprocess2(Token *tok) {
continue;
}
if (tok->kind == TK_PP_NUM) {
read_line_marker(&tok, tok);
continue;
}
if (equal(tok, "error"))
error_tok(tok, "error");

View File

@ -12,6 +12,10 @@ int main() {
#line 1
ASSERT(2, __LINE__);
# 200 "xyz" 2 3
ASSERT(201, __LINE__);
ASSERT(0, strcmp(__FILE__, "xyz"));
printf("OK\n");
return 0;
}