changeset 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
files gcc/c-parser.c
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gcc/c-parser.c	Mon Feb 20 15:38:52 2012 +0900
+++ b/gcc/c-parser.c	Fri Mar 23 17:11:33 2012 +0900
@@ -1638,6 +1638,7 @@
 				   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);
@@ -1659,6 +1660,32 @@
 		  }
 		}
 	      }
+	      */
+	      if(specs->typespec_word == cts_CbC_code ) {
+
+		/* 
+		 * func_tree is TYPE_DECL or FUNCTION_DECL
+		 * tmp is POINTER_TYPE or FUNCTION_TYPE
+		 */
+		tree func_tree = TREE_TYPE(d);
+		// parm is PARM_DECL
+		tree parm = declarator->u.arg_info->parms;
+		while(parm) {
+		  tree tmptype = parm;
+		  if( !IS_RECTYPE(TREE_TYPE(tmptype))) {
+		    parm = TREE_CHAIN(parm);
+		    continue;
+		  }
+		  tree t = TREE_TYPE(tmptype);
+		  while(TREE_CODE(t) == POINTER_TYPE) {
+		    tmptype = t;
+		    t= TREE_TYPE(tmptype);
+		  }
+		  TREE_TYPE(tmptype) = func_tree;
+		  parm = TREE_CHAIN(parm);
+		}
+	      }
+
 #endif
 	      if (d)
 		finish_decl (d, UNKNOWN_LOCATION, NULL_TREE,