Unified · Split
| @@ -2731,6 +2731,7 @@ static void preprocess(int is_bof) · 2730 unmodified lines | ||
| 2731 | 2731 | define_undef(s); |
| 2732 | 2732 | break; |
| 2733 | 2733 | case TOK_INCLUDE: |
| 2734 | + case TOK_INCLUDE_NEXT: | |
| 2734 | 2735 | ch = file->buf_ptr[0]; |
| 2735 | 2736 | /* XXX: incorrect if comments : use next_nomacro with a special mode */ |
| 2736 | 2737 | skip_spaces(); |
| @@ -2807,8 +2808,12 @@ static void preprocess(int is_bof) · 70 unmodified lines | ||
| 2807 | 2808 | buf1[size] = '\0'; |
| 2808 | 2809 | pstrcat(buf1, sizeof(buf1), buf); |
| 2809 | 2810 | f = tcc_open(s1, buf1); |
| 2810 | − if (f) | |
| 2811 | − goto found; | |
| 2811 | + if (f) { | |
| 2812 | + if (tok == TOK_INCLUDE_NEXT) | |
| 2813 | + tok = TOK_INCLUDE; | |
| 2814 | + else | |
| 2815 | + goto found; | |
| 2816 | + } | |
| 2812 | 2817 | } |
| 2813 | 2818 | if (s1->include_stack_ptr >= s1->include_stack + INCLUDE_STACK_SIZE) |
| 2814 | 2819 | error("#include recursion too deep"); |
| @@ -2824,8 +2829,12 @@ static void preprocess(int is_bof) · 9 unmodified lines | ||
| 2824 | 2829 | pstrcat(buf1, sizeof(buf1), "/"); |
| 2825 | 2830 | pstrcat(buf1, sizeof(buf1), buf); |
| 2826 | 2831 | f = tcc_open(s1, buf1); |
| 2827 | − if (f) | |
| 2828 | − goto found; | |
| 2832 | + if (f) { | |
| 2833 | + if (tok == TOK_INCLUDE_NEXT) | |
| 2834 | + tok = TOK_INCLUDE; | |
| 2835 | + else | |
| 2836 | + goto found; | |
| 2837 | + } | |
| 2829 | 2838 | } |
| 2830 | 2839 | error("include file '%s' not found", buf); |
| 2831 | 2840 | f = NULL; |
| @@ -64,6 +64,7 @@ · 63 unmodified lines | ||
| 64 | 64 | /* preprocessor only */ |
| 65 | 65 | DEF(TOK_DEFINE, "define") |
| 66 | 66 | DEF(TOK_INCLUDE, "include") |
| 67 | + DEF(TOK_INCLUDE_NEXT, "include_next") | |
| 67 | 68 | DEF(TOK_IFDEF, "ifdef") |
| 68 | 69 | DEF(TOK_IFNDEF, "ifndef") |
| 69 | 70 | DEF(TOK_ELIF, "elif") |