Mercurial > hg > CbC > CbC_gcc
changeset 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 |
files | gcc/c-parser.c gcc/cbc-tree.h |
diffstat | 2 files changed, 13 insertions(+), 17 deletions(-) [+] |
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);
--- a/gcc/cbc-tree.h Tue Jan 24 03:25:13 2012 +0900 +++ b/gcc/cbc-tree.h Tue Jan 24 18:11:15 2012 +0900 @@ -14,5 +14,9 @@ extern location_t cbc_return; /* flag of selftype is lang_flag_3. */ -#define IS_SELFTYPE(NODE) TYPE_LANG_FLAG_3 (RECORD_OR_UNION_CHECK (NODE)) +#define IS_SELFTYPE(NODE) ((NODE)->type.lang_flag_3) +//#define CbC_TYPE_LANG_FLAG_3(NODE) (RECORD_OR_POINTER_CHECK (NODE)->type.lang_flag_3) +//#define RECORD_OR_POINTER_CHECK(NODE) TYPE_CHECK2 (T, POINTER_TYPE, RECORD_TYPE) + +//#define TYPE_LANG_FLAG_3(NODE) (TYPE_CHECK (NODE)->type.lang_flag_3)