mirror of
https://github.com/frida/tinycc
synced 2024-12-29 16:19:40 +03:00
#include_next support (Bernhard Fischer)
This commit is contained in:
parent
9825011ced
commit
8f2d519203
13
tcc.c
13
tcc.c
@ -2731,6 +2731,7 @@ static void preprocess(int is_bof)
|
||||
define_undef(s);
|
||||
break;
|
||||
case TOK_INCLUDE:
|
||||
case TOK_INCLUDE_NEXT:
|
||||
ch = file->buf_ptr[0];
|
||||
/* XXX: incorrect if comments : use next_nomacro with a special mode */
|
||||
skip_spaces();
|
||||
@ -2807,9 +2808,13 @@ static void preprocess(int is_bof)
|
||||
buf1[size] = '\0';
|
||||
pstrcat(buf1, sizeof(buf1), buf);
|
||||
f = tcc_open(s1, buf1);
|
||||
if (f)
|
||||
if (f) {
|
||||
if (tok == TOK_INCLUDE_NEXT)
|
||||
tok = TOK_INCLUDE;
|
||||
else
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
if (s1->include_stack_ptr >= s1->include_stack + INCLUDE_STACK_SIZE)
|
||||
error("#include recursion too deep");
|
||||
/* now search in all the include paths */
|
||||
@ -2824,9 +2829,13 @@ static void preprocess(int is_bof)
|
||||
pstrcat(buf1, sizeof(buf1), "/");
|
||||
pstrcat(buf1, sizeof(buf1), buf);
|
||||
f = tcc_open(s1, buf1);
|
||||
if (f)
|
||||
if (f) {
|
||||
if (tok == TOK_INCLUDE_NEXT)
|
||||
tok = TOK_INCLUDE;
|
||||
else
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
error("include file '%s' not found", buf);
|
||||
f = NULL;
|
||||
found:
|
||||
|
Loading…
Reference in New Issue
Block a user