# HG changeset patch # User Nobuyasu Oshiro # Date 1329719932 -32400 # Node ID fdc380f80c0711c4f5810bfec3190bd1ec203b16 # Parent 5c3ad79fc15bfc7815c3d95c9705d8550c3eab15 fix __rectype expression diff -r 5c3ad79fc15b -r fdc380f80c07 gcc/c-decl.c --- a/gcc/c-decl.c Thu Feb 16 18:15:22 2012 +0900 +++ b/gcc/c-decl.c Mon Feb 20 15:38:52 2012 +0900 @@ -5155,6 +5155,16 @@ } } + +#ifndef noCbC + if ( declspecs->typespec_word == cts_CbC_rec ) + { + type = build_code_segment_type (type, NULL_TREE); + IS_RECTYPE(type) = 1; + } +#endif + + /* Now figure out the structure of the declarator proper. Descend through it, creating more complex types, until we reach the declared identifier (or NULL_TREE, in an absolute declarator). @@ -5636,13 +5646,6 @@ } case cdk_pointer: { -#ifndef noCbC - 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 for the pointer. */ @@ -5690,6 +5693,11 @@ type = build_pointer_type (type); +#ifndef noCbC + if ( declspecs->typespec_word == cts_CbC_rec ){ + IS_RECTYPE(type) = 1; + } +#endif /* Process type qualifiers (such as const or volatile) that were given inside the `*'. */ type_quals = declarator->u.pointer_quals; diff -r 5c3ad79fc15b -r fdc380f80c07 gcc/c-parser.c --- a/gcc/c-parser.c Thu Feb 16 18:15:22 2012 +0900 +++ b/gcc/c-parser.c Mon Feb 20 15:38:52 2012 +0900 @@ -1644,19 +1644,17 @@ if(TREE_CODE(tmp) == FUNCTION_TYPE) { tree t = declarator->u.arg_info->parms; while(t) { + if( !IS_RECTYPE(t)) { + t = TREE_CHAIN(t); + continue; + } tree tmptype = t; - while(TREE_TYPE(tmptype) && TREE_CODE(TREE_TYPE(tmptype)) == POINTER_TYPE) { + while(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; - } + TREE_TYPE(t) = tmp; + break; t = TREE_CHAIN(t); } }