Mercurial > hg > CbC > CbC_gcc
comparison gcc/c-parser.c @ 99:98e1e78a6b5a
modify implementation of selftype
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Jan 2012 18:11:15 +0900 |
parents | 5211b774b8b5 |
children | 29a62213c1d0 |
comparison
equal
deleted
inserted
replaced
98:5211b774b8b5 | 99:98e1e78a6b5a |
---|---|
2132 location_t loc = c_parser_peek_token (parser)->location; | 2132 location_t loc = c_parser_peek_token (parser)->location; |
2133 | 2133 |
2134 c_parser_set_source_position_from_token (c_parser_peek_token (parser)); | 2134 c_parser_set_source_position_from_token (c_parser_peek_token (parser)); |
2135 tree value; | 2135 tree value; |
2136 struct c_typespec ret; | 2136 struct c_typespec ret; |
2137 // ret = parser_xref_tag (ident_loc, code, ident); | |
2138 value = make_node (IDENTIFIER_NODE); | 2137 value = make_node (IDENTIFIER_NODE); |
2139 ret = parser_xref_tag (loc, code, value); | 2138 ret = parser_xref_tag (loc, code, value); |
2140 // IS_SELFTYPE (ret.spec) = 1; | 2139 |
2141 ret.spec->base.lang_flag_3 = 1; | 2140 // ret.spec->base.lang_flag_3 = 1; |
2142 // ret = lookup_tag (code, value, 0, &loc); | 2141 IS_SELFTYPE (ret.spec) = 1; |
2143 declspecs_add_type (loc, specs, ret); | 2142 declspecs_add_type (loc, specs, ret); |
2144 c_parser_consume_token (parser); | 2143 c_parser_consume_token (parser); |
2145 break; | 2144 break; |
2146 #endif | 2145 #endif |
2147 case RID_ENUM: | 2146 case RID_ENUM: |
2481 decls = c_parser_struct_declaration (parser); | 2480 decls = c_parser_struct_declaration (parser); |
2482 | 2481 |
2483 #ifndef noCbC | 2482 #ifndef noCbC |
2484 /* If tree type of d_type is selftype, d_type modify to RECORD_TYPE: (d_type = type). */ | 2483 /* If tree type of d_type is selftype, d_type modify to RECORD_TYPE: (d_type = type). */ |
2485 if(TREE_CODE(decls) == FIELD_DECL && TREE_CODE(type) == RECORD_TYPE) { | 2484 if(TREE_CODE(decls) == FIELD_DECL && TREE_CODE(type) == RECORD_TYPE) { |
2486 // tree d_type = TREE_TYPE(decls); | 2485 tree tmptype = decls; |
2487 tree tmptype = decls; | 2486 while(TREE_CODE (TREE_TYPE (tmptype)) == POINTER_TYPE) |
2488 while(TREE_TYPE (tmptype)) { | 2487 tmptype = TREE_TYPE(tmptype); |
2489 // if(IS_SELFTYPE (TREE_TYPE (d_type))) { | 2488 if(IS_SELFTYPE ( TREE_TYPE (tmptype))) TREE_TYPE(tmptype) = type; |
2490 if(tmptype->common.type->base.lang_flag_3) { | |
2491 TREE_TYPE (tmptype) = type; | |
2492 break; | |
2493 } else if(TREE_CODE (TREE_TYPE((tmptype))) != POINTER_TYPE) { | |
2494 break; | |
2495 } | |
2496 tmptype = TREE_TYPE(decls); | |
2497 } | |
2498 } | 2489 } |
2490 | |
2499 #endif | 2491 #endif |
2500 | 2492 |
2501 contents = chainon (decls, contents); | 2493 contents = chainon (decls, contents); |
2502 /* If no semicolon follows, either we have a parse error or | 2494 /* If no semicolon follows, either we have a parse error or |
2503 are at the end of the struct or union and should | 2495 are at the end of the struct or union and should |