comparison gcc/c-parser.c @ 105:b3cfc7733d3f

fix bug. implementation fo rectype. c-family/c-pretty-print.c
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Fri, 25 May 2012 10:34:23 +0900
parents 46ee985e4f0e
children 85047c4f1ca4
comparison
equal deleted inserted replaced
104:46ee985e4f0e 105:b3cfc7733d3f
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 if(specs->typespec_word == cts_CbC_code ) { 1641 if (specs->typespec_word == cts_CbC_code) {
1642 /* 1642 /*
1643 * func_tree is TYPE_DECL or FUNCTION_DECL. 1643 * func_tree is TYPE_DECL or FUNCTION_DECL.
1644 * tmp is POINTER_TYPE or FUNCTION_TYPE. 1644 * tmp is POINTER_TYPE or FUNCTION_TYPE.
1645 */ 1645 */
1646 tree func_tree = TREE_TYPE(d); 1646 tree func_tree = TREE_TYPE(d);
1653 continue; 1653 continue;
1654 } 1654 }
1655 tree t = TREE_TYPE(tmptype); 1655 tree t = TREE_TYPE(tmptype);
1656 while (TREE_CODE(t) == POINTER_TYPE) { 1656 while (TREE_CODE(t) == POINTER_TYPE) {
1657 tmptype = t; 1657 tmptype = t;
1658 t= TREE_TYPE(tmptype); 1658 t = TREE_TYPE(tmptype);
1659 } 1659 }
1660 TREE_TYPE(tmptype) = func_tree; 1660 TREE_TYPE(tmptype) = func_tree;
1661 parm = TREE_CHAIN(parm); 1661 parm = TREE_CHAIN(parm);
1662 } 1662 }
1663 }
1664 if (specs->typespec_word == cts_CbC_rec) {
1665 tree t = TREE_TYPE(d);
1666 tree tmptype = t;
1667 while (TREE_CODE(t) == POINTER_TYPE) {
1668 tmptype = t;
1669 t = TREE_TYPE(tmptype);
1670 }
1671 TREE_TYPE(tmptype) = TREE_TYPE(current_function_decl);
1663 } 1672 }
1664 1673
1665 #endif 1674 #endif
1666 if (d) 1675 if (d)
1667 finish_decl (d, UNKNOWN_LOCATION, NULL_TREE, 1676 finish_decl (d, UNKNOWN_LOCATION, NULL_TREE,
2144 if(!TARGET_64BIT) { 2153 if(!TARGET_64BIT) {
2145 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); 2154 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE);
2146 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ 2155 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/
2147 declspecs_add_attrs(specs, attrs); 2156 declspecs_add_attrs(specs, attrs);
2148 } 2157 }
2149 2158
2150 c_parser_consume_token (parser); 2159 c_parser_consume_token (parser);
2151 break; 2160 break;
2152 case RID_CbC_SELFTYPE: 2161 case RID_CbC_SELFTYPE:
2153 if (!typespec_ok) 2162 if (!typespec_ok)
2154 goto out; 2163 goto out;
2155 attrs_ok = true; 2164 attrs_ok = true;
2156 seen_type = true; 2165 seen_type = true;