History

#include_next support (Bernhard Fischer)

bellard committed 21 years ago

Commit 8f2d5191 parent 98250112 files · +14 −4Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t