diff 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
line wrap: on
line diff
--- a/gcc/c-parser.c	Mon Apr 09 19:01:21 2012 +0900
+++ b/gcc/c-parser.c	Fri May 25 10:34:23 2012 +0900
@@ -1638,7 +1638,7 @@
 				   chainon (postfix_attrs,
 					    all_prefix_attrs));
 #ifndef noCbC
-	      if(specs->typespec_word == cts_CbC_code ) {
+	      if (specs->typespec_word == cts_CbC_code) {
 		/* 
 		 * func_tree is TYPE_DECL or FUNCTION_DECL.
 		 * tmp is POINTER_TYPE or FUNCTION_TYPE.
@@ -1655,12 +1655,21 @@
 		  tree t = TREE_TYPE(tmptype);
 		  while (TREE_CODE(t) == POINTER_TYPE) {
 		    tmptype = t;
-		    t= TREE_TYPE(tmptype);
+		    t = TREE_TYPE(tmptype);
 		  }
 		  TREE_TYPE(tmptype) = func_tree;
 		  parm = TREE_CHAIN(parm);
 		}
 	      }
+	      if (specs->typespec_word == cts_CbC_rec) {
+		tree t = TREE_TYPE(d);
+		tree tmptype = t;
+		while (TREE_CODE(t) == POINTER_TYPE) {
+		  tmptype = t;
+		  t = TREE_TYPE(tmptype);
+		}
+		TREE_TYPE(tmptype) = TREE_TYPE(current_function_decl);
+	      }
 
 #endif
 	      if (d)
@@ -2146,9 +2155,9 @@
 	    /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/
 	    declspecs_add_attrs(specs, attrs);
       }
-	  
-	  c_parser_consume_token (parser);
-	  break;
+
+          c_parser_consume_token (parser);
+          break;
 	case RID_CbC_SELFTYPE:
 	  if (!typespec_ok)
 	    goto out;