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
62046204 */
62056205 static int parse_btype(CType *type, AttributeDef *ad)
62066206 {
6207− int t, u, type_found;
6207+ int t, u, type_found, typespec_found;
62086208 Sym *s;
62096209 CType type1;
62106210
62116211 memset(ad, 0, sizeof(AttributeDef));
62126212 type_found = 0;
6213+ typespec_found = 0;
62136214 t = 0;
62146215 while(1) {
62156216 switch(tok) {
@@ -6227,6 +6228,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 11 unmodified lines
62276228 if ((t & VT_BTYPE) != 0)
62286229 error("too many basic types");
62296230 t |= u;
6231+ typespec_found = 1;
62306232 break;
62316233 case TOK_VOID:
62326234 u = VT_VOID;
@@ -6236,6 +6238,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 3 unmodified lines
62366238 goto basic_type;
62376239 case TOK_INT:
62386240 next();
6241+ typespec_found = 1;
62396242 break;
62406243 case TOK_LONG:
62416244 next();
@@ -6287,10 +6290,11 @@ static int parse_btype(CType *type, AttributeDef *ad) · 45 unmodified lines
62876290 t |= VT_VOLATILE;
62886291 next();
62896292 break;
6290− case TOK_REGISTER:
62916293 case TOK_SIGNED1:
62926294 case TOK_SIGNED2:
62936295 case TOK_SIGNED3:
6296+ typespec_found = 1;
6297+ case TOK_REGISTER:
62946298 case TOK_AUTO:
62956299 case TOK_RESTRICT1:
62966300 case TOK_RESTRICT2:
@@ -6300,6 +6304,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 3 unmodified lines
63006304 case TOK_UNSIGNED:
63016305 t |= VT_UNSIGNED;
63026306 next();
6307+ typespec_found = 1;
63036308 break;
63046309
63056310 /* storage */
@@ -6335,6 +6340,8 @@ static int parse_btype(CType *type, AttributeDef *ad) · 29 unmodified lines
63356340 parse_expr_type(&type1);
63366341 goto basic_type2;
63376342 default:
6343+ if (typespec_found)
6344+ goto the_end;
63386345 s = sym_find(tok);
63396346 if (!s || !(s->type.t & VT_TYPEDEF))
63406347 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