/////////////////// #include <stdio.h> // test for a bug: // compiler don't understand am extern array of structs // $ tcc test_1.c // test_1.c:8: error: unknown struct/union/enum extern struct FILE std_files[4]; int main() { return 0; } ////////////////// tcc-current /* enum/struct/union declaration. u is either VT_ENUM or VT_STRUCT */ static void struct_decl(CType *type, int u, int tdef) ... if (tok != '{') { v = tok; next(); /* struct already defined ? return it */ if (v < TOK_IDENT) expect("struct/union/enum name"); s = struct_find(v); if (s) { if (s->type.t != a) tcc_error("invalid type"); goto do_decl; } else if (tok >= TOK_IDENT && !tdef) tcc_error("unknown struct/union/enum"); } else { v = anon_sym++; } tcc-0.9.23 which don't have such error /* enum/struct/union declaration. u is either VT_ENUM or VT_STRUCT */ static void struct_decl(CType *type, int u) .... if (tok != '{') { v = tok; next(); /* struct already defined ? return it */ if (v < TOK_IDENT) expect("struct/union/enum name"); s = struct_find(v); if (s) { if (s->type.t != a) error("invalid type"); goto do_decl; } } else { v = anon_sym++; }
Unified · Split
| @@ -3148,14 +3148,14 @@ static int parse_btype(CType *type, AttributeDef *ad) · 3147 unmodified lines | |||
| 3148 | } | 3148 | } |
| 3149 | break; | 3149 | break; |
| 3150 | case TOK_ENUM: | 3150 | case TOK_ENUM: |
| 3151 | struct_decl(&type1, VT_ENUM, t & VT_TYPEDEF); | 3151 | struct_decl(&type1, VT_ENUM, t & (VT_TYPEDEF | VT_EXTERN)); |
| 3152 | basic_type2: | 3152 | basic_type2: |
| 3153 | u = type1.t; | 3153 | u = type1.t; |
| 3154 | type->ref = type1.ref; | 3154 | type->ref = type1.ref; |
| 3155 | goto basic_type1; | 3155 | goto basic_type1; |
| 3156 | case TOK_STRUCT: | 3156 | case TOK_STRUCT: |
| 3157 | case TOK_UNION: | 3157 | case TOK_UNION: |
| 3158 | struct_decl(&type1, VT_STRUCT, t & VT_TYPEDEF); | 3158 | struct_decl(&type1, VT_STRUCT, t & (VT_TYPEDEF | VT_EXTERN)); |
| 3159 | goto basic_type2; | 3159 | goto basic_type2; |
| 3160 | 3160 | ||
| 3161 | /* type modifiers */ | 3161 | /* type modifiers */ |