# HG changeset patch # User Nobuyasu Oshiro # Date 1329383722 -32400 # Node ID 5c3ad79fc15bfc7815c3d95c9705d8550c3eab15 # Parent 29a62213c1d0442ebeba65a28f864bb6b1b8d2aa modify implemeted __rectype expression diff -r 29a62213c1d0 -r 5c3ad79fc15b gcc/c-decl.c --- 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 diff -r 29a62213c1d0 -r 5c3ad79fc15b gcc/c-parser.c --- 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); diff -r 29a62213c1d0 -r 5c3ad79fc15b gcc/cbc-tree.h --- 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)