mirror of
https://github.com/frida/tinycc
synced 2024-12-26 23:09:41 +03:00
fix for the #include_next, v3
don't give an error and simply ingnore directive if we detect a loop of the #include_next. With this aproach coreutils-8.24.51-8802e compiles, but with errors: lib/libcoreutils.a: error: 'xnmalloc' defined twice lib/libcoreutils.a: error: 'xnrealloc' defined twice
This commit is contained in:
parent
6b9490b6ff
commit
ad1c01f96c
18
tccpp.c
18
tccpp.c
@ -1528,7 +1528,7 @@ ST_FUNC void preprocess(int is_bof)
|
|||||||
int i, c, n, saved_parse_flags;
|
int i, c, n, saved_parse_flags;
|
||||||
char buf[1024], *q;
|
char buf[1024], *q;
|
||||||
Sym *s;
|
Sym *s;
|
||||||
int include_next_first_try = 1;
|
int include_next_count = 0;
|
||||||
|
|
||||||
saved_parse_flags = parse_flags;
|
saved_parse_flags = parse_flags;
|
||||||
parse_flags = PARSE_FLAG_PREPROCESS
|
parse_flags = PARSE_FLAG_PREPROCESS
|
||||||
@ -1618,7 +1618,6 @@ ST_FUNC void preprocess(int is_bof)
|
|||||||
/* store current file in stack, but increment stack later below */
|
/* store current file in stack, but increment stack later below */
|
||||||
*s1->include_stack_ptr = file;
|
*s1->include_stack_ptr = file;
|
||||||
|
|
||||||
search_again:
|
|
||||||
n = s1->nb_include_paths + s1->nb_sysinclude_paths;
|
n = s1->nb_include_paths + s1->nb_sysinclude_paths;
|
||||||
for (i = -2; i < n; ++i) {
|
for (i = -2; i < n; ++i) {
|
||||||
char buf1[sizeof file->filename];
|
char buf1[sizeof file->filename];
|
||||||
@ -1654,19 +1653,13 @@ ST_FUNC void preprocess(int is_bof)
|
|||||||
|
|
||||||
if (tok == TOK_INCLUDE_NEXT) {
|
if (tok == TOK_INCLUDE_NEXT) {
|
||||||
for (f = s1->include_stack_ptr; f >= s1->include_stack; --f)
|
for (f = s1->include_stack_ptr; f >= s1->include_stack; --f)
|
||||||
if (include_next_first_try) {
|
|
||||||
if (0 == PATHCMP((*f)->filename, buf1)) {
|
if (0 == PATHCMP((*f)->filename, buf1)) {
|
||||||
#ifdef INC_DEBUG
|
#ifdef INC_DEBUG
|
||||||
printf("%s: #include_next skipping %s\n", file->filename, buf1);
|
printf("%s: #include_next skipping %s\n", file->filename, buf1);
|
||||||
#endif
|
#endif
|
||||||
include_next_first_try++;
|
include_next_count++;
|
||||||
goto include_trynext;
|
goto include_trynext;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (0 == PATHCMP(file->filename, buf1)) {
|
|
||||||
goto include_trynext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e = search_cached_include(s1, buf1);
|
e = search_cached_include(s1, buf1);
|
||||||
@ -1698,11 +1691,8 @@ include_trynext:
|
|||||||
ch = file->buf_ptr[0];
|
ch = file->buf_ptr[0];
|
||||||
goto the_end;
|
goto the_end;
|
||||||
}
|
}
|
||||||
if (include_next_first_try > 1) {
|
if (include_next_count == 0)
|
||||||
include_next_first_try = 0;
|
tcc_error("include file '%s' not found", buf);
|
||||||
goto search_again;
|
|
||||||
}
|
|
||||||
tcc_error("include file '%s' not found", buf);
|
|
||||||
include_done:
|
include_done:
|
||||||
break;
|
break;
|
||||||
case TOK_IFNDEF:
|
case TOK_IFNDEF:
|
||||||
|
Loading…
Reference in New Issue
Block a user