mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-28 12:10:05 +08:00
Fake __has_include handling
cctools for MacOS 10.14 (at least) unconditionally uses the __has_include preprocessor directive (i.e. without checking if defined __has_include as normally suggested for portable code). So we need to handle it a little bit. For now we simply say "nope" aka evaluate to 0.
This commit is contained in:
parent
34a5658564
commit
c16f5d2fe6
21
tccpp.c
21
tccpp.c
@ -1450,6 +1450,7 @@ static int expr_preprocess(void)
|
||||
pp_expr = 1;
|
||||
while (tok != TOK_LINEFEED && tok != TOK_EOF) {
|
||||
next(); /* do macro subst */
|
||||
redo:
|
||||
if (tok == TOK_DEFINED) {
|
||||
next_nomacro();
|
||||
t = tok;
|
||||
@ -1467,10 +1468,26 @@ static int expr_preprocess(void)
|
||||
}
|
||||
tok = TOK_CINT;
|
||||
tokc.i = c;
|
||||
} else if (tok >= TOK_IDENT) {
|
||||
/* if undefined macro */
|
||||
} else if (1 && tok == TOK___HAS_INCLUDE) {
|
||||
next(); /* XXX check if correct to use expansion */
|
||||
skip('(');
|
||||
while (tok != ')' && tok != TOK_EOF)
|
||||
next();
|
||||
if (tok != ')')
|
||||
expect("')'");
|
||||
tok = TOK_CINT;
|
||||
tokc.i = 0;
|
||||
} else if (tok >= TOK_IDENT) {
|
||||
/* if undefined macro, replace with zero, check for func-like */
|
||||
t = tok;
|
||||
tok = TOK_CINT;
|
||||
tokc.i = 0;
|
||||
tok_str_add_tok(str);
|
||||
next();
|
||||
if (tok == '(')
|
||||
tcc_error("function-like macro '%s' is not defined",
|
||||
get_tok_str(t, NULL));
|
||||
goto redo;
|
||||
}
|
||||
tok_str_add_tok(str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user