Mercurial > hg > CbC > CbC_gcc
diff 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 |
line wrap: on
line diff
--- a/gcc/c-parser.c Tue Jan 24 03:25:13 2012 +0900 +++ b/gcc/c-parser.c Tue Jan 24 18:11:15 2012 +0900 @@ -2134,12 +2134,11 @@ c_parser_set_source_position_from_token (c_parser_peek_token (parser)); tree value; struct c_typespec ret; - // ret = parser_xref_tag (ident_loc, code, ident); value = make_node (IDENTIFIER_NODE); ret = parser_xref_tag (loc, code, value); - // IS_SELFTYPE (ret.spec) = 1; - ret.spec->base.lang_flag_3 = 1; - // ret = lookup_tag (code, value, 0, &loc); + + // ret.spec->base.lang_flag_3 = 1; + IS_SELFTYPE (ret.spec) = 1; declspecs_add_type (loc, specs, ret); c_parser_consume_token (parser); break; @@ -2483,19 +2482,12 @@ #ifndef noCbC /* If tree type of d_type is selftype, d_type modify to RECORD_TYPE: (d_type = type). */ if(TREE_CODE(decls) == FIELD_DECL && TREE_CODE(type) == RECORD_TYPE) { - // tree d_type = TREE_TYPE(decls); - tree tmptype = decls; - while(TREE_TYPE (tmptype)) { - // if(IS_SELFTYPE (TREE_TYPE (d_type))) { - if(tmptype->common.type->base.lang_flag_3) { - TREE_TYPE (tmptype) = type; - break; - } else if(TREE_CODE (TREE_TYPE((tmptype))) != POINTER_TYPE) { - break; - } - tmptype = TREE_TYPE(decls); - } + tree tmptype = decls; + while(TREE_CODE (TREE_TYPE (tmptype)) == POINTER_TYPE) + tmptype = TREE_TYPE(tmptype); + if(IS_SELFTYPE ( TREE_TYPE (tmptype))) TREE_TYPE(tmptype) = type; } + #endif contents = chainon (decls, contents);