diff options
| author | bellard <bellard> | 2005-04-10 22:18:53 +0000 |
|---|---|---|
| committer | bellard <bellard> | 2005-04-10 22:18:53 +0000 |
| commit | 8f2d519203e71d997071b31ee90ad1cd55b27577 (patch) | |
| tree | 95b8b7616677113666644e0921922ede1b029bc0 /tcc.c | |
| parent | 9825011cedeb3fdcfb54e312ab27d92a2a8488b0 (diff) | |
| download | tinycc-8f2d519203e71d997071b31ee90ad1cd55b27577.tar.gz tinycc-8f2d519203e71d997071b31ee90ad1cd55b27577.tar.bz2 | |
#include_next support (Bernhard Fischer)
Diffstat (limited to 'tcc.c')
| -rw-r--r-- | tcc.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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,8 +2808,12 @@ static void preprocess(int is_bof) buf1[size] = '\0'; pstrcat(buf1, sizeof(buf1), buf); f = tcc_open(s1, buf1); - if (f) - goto found; + 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"); @@ -2824,8 +2829,12 @@ static void preprocess(int is_bof) pstrcat(buf1, sizeof(buf1), "/"); pstrcat(buf1, sizeof(buf1), buf); f = tcc_open(s1, buf1); - if (f) - goto found; + if (f) { + if (tok == TOK_INCLUDE_NEXT) + tok = TOK_INCLUDE; + else + goto found; + } } error("include file '%s' not found", buf); f = NULL; |
