6204 |
*/ |
*/ |
6205 |
static int parse_btype(CType *type, AttributeDef *ad) |
static int parse_btype(CType *type, AttributeDef *ad) |
6206 |
{ |
{ |
6207 |
int t, u, type_found; |
int t, u, type_found, typespec_found; |
6208 |
Sym *s; |
Sym *s; |
6209 |
CType type1; |
CType type1; |
6210 |
|
|
6211 |
memset(ad, 0, sizeof(AttributeDef)); |
memset(ad, 0, sizeof(AttributeDef)); |
6212 |
type_found = 0; |
type_found = 0; |
6213 |
|
typespec_found = 0; |
6214 |
t = 0; |
t = 0; |
6215 |
while(1) { |
while(1) { |
6216 |
switch(tok) { |
switch(tok) { |
6228 |
if ((t & VT_BTYPE) != 0) |
if ((t & VT_BTYPE) != 0) |
6229 |
error("too many basic types"); |
error("too many basic types"); |
6230 |
t |= u; |
t |= u; |
6231 |
|
typespec_found = 1; |
6232 |
break; |
break; |
6233 |
case TOK_VOID: |
case TOK_VOID: |
6234 |
u = VT_VOID; |
u = VT_VOID; |
6238 |
goto basic_type; |
goto basic_type; |
6239 |
case TOK_INT: |
case TOK_INT: |
6240 |
next(); |
next(); |
6241 |
|
typespec_found = 1; |
6242 |
break; |
break; |
6243 |
case TOK_LONG: |
case TOK_LONG: |
6244 |
next(); |
next(); |
6290 |
t |= VT_VOLATILE; |
t |= VT_VOLATILE; |
6291 |
next(); |
next(); |
6292 |
break; |
break; |
|
case TOK_REGISTER: |
|
6293 |
case TOK_SIGNED1: |
case TOK_SIGNED1: |
6294 |
case TOK_SIGNED2: |
case TOK_SIGNED2: |
6295 |
case TOK_SIGNED3: |
case TOK_SIGNED3: |
6296 |
|
typespec_found = 1; |
6297 |
|
case TOK_REGISTER: |
6298 |
case TOK_AUTO: |
case TOK_AUTO: |
6299 |
case TOK_RESTRICT1: |
case TOK_RESTRICT1: |
6300 |
case TOK_RESTRICT2: |
case TOK_RESTRICT2: |
6304 |
case TOK_UNSIGNED: |
case TOK_UNSIGNED: |
6305 |
t |= VT_UNSIGNED; |
t |= VT_UNSIGNED; |
6306 |
next(); |
next(); |
6307 |
|
typespec_found = 1; |
6308 |
break; |
break; |
6309 |
|
|
6310 |
/* storage */ |
/* storage */ |
6340 |
parse_expr_type(&type1); |
parse_expr_type(&type1); |
6341 |
goto basic_type2; |
goto basic_type2; |
6342 |
default: |
default: |
6343 |
|
if (typespec_found) |
6344 |
|
goto the_end; |
6345 |
s = sym_find(tok); |
s = sym_find(tok); |
6346 |
if (!s || !(s->type.t & VT_TYPEDEF)) |
if (!s || !(s->type.t & VT_TYPEDEF)) |
6347 |
goto the_end; |
goto the_end; |