comparison gcc/c-parser.c @ 103:edcadcec937d

modify __rectype
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Fri, 23 Mar 2012 17:11:33 +0900
parents fdc380f80c07
children 46ee985e4f0e
comparison
equal deleted inserted replaced
102:fdc380f80c07 103:edcadcec937d
1636 { 1636 {
1637 tree d = start_decl (declarator, specs, false, 1637 tree d = start_decl (declarator, specs, false,
1638 chainon (postfix_attrs, 1638 chainon (postfix_attrs,
1639 all_prefix_attrs)); 1639 all_prefix_attrs));
1640 #ifndef noCbC 1640 #ifndef noCbC
1641 /*
1641 if(specs->storage_class == csc_typedef) { 1642 if(specs->storage_class == csc_typedef) {
1642 tree tmp = TREE_TYPE(d); 1643 tree tmp = TREE_TYPE(d);
1643 while(TREE_CODE(tmp) == POINTER_TYPE) tmp = TREE_TYPE(tmp); 1644 while(TREE_CODE(tmp) == POINTER_TYPE) tmp = TREE_TYPE(tmp);
1644 if(TREE_CODE(tmp) == FUNCTION_TYPE) { 1645 if(TREE_CODE(tmp) == FUNCTION_TYPE) {
1645 tree t = declarator->u.arg_info->parms; 1646 tree t = declarator->u.arg_info->parms;
1657 break; 1658 break;
1658 t = TREE_CHAIN(t); 1659 t = TREE_CHAIN(t);
1659 } 1660 }
1660 } 1661 }
1661 } 1662 }
1663 */
1664 if(specs->typespec_word == cts_CbC_code ) {
1665
1666 /*
1667 * func_tree is TYPE_DECL or FUNCTION_DECL
1668 * tmp is POINTER_TYPE or FUNCTION_TYPE
1669 */
1670 tree func_tree = TREE_TYPE(d);
1671 // parm is PARM_DECL
1672 tree parm = declarator->u.arg_info->parms;
1673 while(parm) {
1674 tree tmptype = parm;
1675 if( !IS_RECTYPE(TREE_TYPE(tmptype))) {
1676 parm = TREE_CHAIN(parm);
1677 continue;
1678 }
1679 tree t = TREE_TYPE(tmptype);
1680 while(TREE_CODE(t) == POINTER_TYPE) {
1681 tmptype = t;
1682 t= TREE_TYPE(tmptype);
1683 }
1684 TREE_TYPE(tmptype) = func_tree;
1685 parm = TREE_CHAIN(parm);
1686 }
1687 }
1688
1662 #endif 1689 #endif
1663 if (d) 1690 if (d)
1664 finish_decl (d, UNKNOWN_LOCATION, NULL_TREE, 1691 finish_decl (d, UNKNOWN_LOCATION, NULL_TREE,
1665 NULL_TREE, asm_name); 1692 NULL_TREE, asm_name);
1666 1693