Mercurial > hg > CbC > CbC_gcc
changeset 101:5c3ad79fc15b
modify implemeted __rectype expression
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Feb 2012 18:15:22 +0900 |
parents | 29a62213c1d0 |
children | fdc380f80c07 |
files | gcc/c-decl.c gcc/c-parser.c gcc/cbc-tree.h |
diffstat | 3 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gcc/c-decl.c Sun Feb 05 10:24:11 2012 +0900 +++ b/gcc/c-decl.c Thu Feb 16 18:15:22 2012 +0900 @@ -5640,6 +5640,7 @@ if ( declspecs->typespec_word == cts_CbC_rec ) { type = build_code_segment_type (type, NULL_TREE); + IS_RECTYPE(type) = 1; } #endif /* Merge any constancy or volatility into the target type
--- a/gcc/c-parser.c Sun Feb 05 10:24:11 2012 +0900 +++ b/gcc/c-parser.c Thu Feb 16 18:15:22 2012 +0900 @@ -1637,6 +1637,31 @@ tree d = start_decl (declarator, specs, false, chainon (postfix_attrs, all_prefix_attrs)); +#ifndef noCbC + if(specs->storage_class == csc_typedef) { + tree tmp = TREE_TYPE(d); + while(TREE_CODE(tmp) == POINTER_TYPE) tmp = TREE_TYPE(tmp); + if(TREE_CODE(tmp) == FUNCTION_TYPE) { + tree t = declarator->u.arg_info->parms; + while(t) { + tree tmptype = t; + while(TREE_TYPE(tmptype) && TREE_CODE(TREE_TYPE(tmptype)) == POINTER_TYPE) { + t = TREE_TYPE(tmptype); + tmptype = TREE_TYPE(t); + } + if(TREE_CODE(tmptype) != FUNCTION_TYPE) { + t = TREE_CHAIN(t); + continue; + } + if(IS_RECTYPE(tmptype)) { + TREE_TYPE(t) = tmp; + break; + } + t = TREE_CHAIN(t); + } + } + } +#endif if (d) finish_decl (d, UNKNOWN_LOCATION, NULL_TREE, NULL_TREE, asm_name);
--- a/gcc/cbc-tree.h Sun Feb 05 10:24:11 2012 +0900 +++ b/gcc/cbc-tree.h Thu Feb 16 18:15:22 2012 +0900 @@ -13,7 +13,8 @@ extern tree cbc_env; extern location_t cbc_return; -/* flag of selftype is lang_flag_3. */ +/* flag of rectype and selftype is lang_flag_3. */ +#define IS_RECTYPE(NODE) ((NODE)->type.lang_flag_3) #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)