History

fixed typdefed type parsing (Mauro Persano)

bellard committed 23 years ago

Commit c5959b71 parent 7b940fc1 file · +9 −2Browse files

Unified · Split

tcc.c+9−2
@@ -6204,12 +6204,13 @@ static void struct_decl(CType *type, int u) · 6203 unmodified lines
6204 */6204 */
6205static int parse_btype(CType *type, AttributeDef *ad)6205static int parse_btype(CType *type, AttributeDef *ad)
6206{6206{
6207 int t, u, type_found;6207 int t, u, type_found, typespec_found;
6208 Sym *s;6208 Sym *s;
6209 CType type1;6209 CType type1;
6210 6210
6211 memset(ad, 0, sizeof(AttributeDef));6211 memset(ad, 0, sizeof(AttributeDef));
6212 type_found = 0;6212 type_found = 0;
6213 typespec_found = 0;
6213 t = 0;6214 t = 0;
6214 while(1) {6215 while(1) {
6215 switch(tok) {6216 switch(tok) {
@@ -6227,6 +6228,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 11 unmodified lines
6227 if ((t & VT_BTYPE) != 0)6228 if ((t & VT_BTYPE) != 0)
6228 error("too many basic types");6229 error("too many basic types");
6229 t |= u;6230 t |= u;
6231 typespec_found = 1;
6230 break;6232 break;
6231 case TOK_VOID:6233 case TOK_VOID:
6232 u = VT_VOID;6234 u = VT_VOID;
@@ -6236,6 +6238,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 3 unmodified lines
6236 goto basic_type;6238 goto basic_type;
6237 case TOK_INT:6239 case TOK_INT:
6238 next();6240 next();
6241 typespec_found = 1;
6239 break;6242 break;
6240 case TOK_LONG:6243 case TOK_LONG:
6241 next();6244 next();
@@ -6287,10 +6290,11 @@ static int parse_btype(CType *type, AttributeDef *ad) · 45 unmodified lines
6287 t |= VT_VOLATILE;6290 t |= VT_VOLATILE;
6288 next();6291 next();
6289 break;6292 break;
6290 case TOK_REGISTER:
6291 case TOK_SIGNED1:6293 case TOK_SIGNED1:
6292 case TOK_SIGNED2:6294 case TOK_SIGNED2:
6293 case TOK_SIGNED3:6295 case TOK_SIGNED3:
6296 typespec_found = 1;
6297 case TOK_REGISTER:
6294 case TOK_AUTO:6298 case TOK_AUTO:
6295 case TOK_RESTRICT1:6299 case TOK_RESTRICT1:
6296 case TOK_RESTRICT2:6300 case TOK_RESTRICT2:
@@ -6300,6 +6304,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 3 unmodified lines
6300 case TOK_UNSIGNED:6304 case TOK_UNSIGNED:
6301 t |= VT_UNSIGNED;6305 t |= VT_UNSIGNED;
6302 next();6306 next();
6307 typespec_found = 1;
6303 break;6308 break;
6304 6309
6305 /* storage */6310 /* storage */
@@ -6335,6 +6340,8 @@ static int parse_btype(CType *type, AttributeDef *ad) · 29 unmodified lines
6335 parse_expr_type(&type1);6340 parse_expr_type(&type1);
6336 goto basic_type2;6341 goto basic_type2;
6337 default:6342 default:
6343 if (typespec_found)
6344 goto the_end;
6338 s = sym_find(tok);6345 s = sym_find(tok);
6339 if (!s || !(s->type.t & VT_TYPEDEF))6346 if (!s || !(s->type.t & VT_TYPEDEF))
6340 goto the_end;6347 goto the_end;

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