diff gcc/c-parser.c @ 101:5c3ad79fc15b

modify implemeted __rectype expression
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Thu, 16 Feb 2012 18:15:22 +0900
parents 29a62213c1d0
children fdc380f80c07
line wrap: on
line diff
--- a/gcc/c-parser.c	Sun Feb 05 10:24:11 2012 +0900
+++ b/gcc/c-parser.c	Thu Feb 16 18:15:22 2012 +0900
@@ -1637,6 +1637,31 @@
 	      tree d = start_decl (declarator, specs, false,
 				   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);
+		if(TREE_CODE(tmp) == FUNCTION_TYPE) {
+		  tree t = declarator->u.arg_info->parms;
+		  while(t) {
+		    tree tmptype = t;
+		    while(TREE_TYPE(tmptype) && 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;
+		    }
+		    t = TREE_CHAIN(t);		  
+		  }
+		}
+	      }
+#endif
 	      if (d)
 		finish_decl (d, UNKNOWN_LOCATION, NULL_TREE,
 			     NULL_TREE, asm_name);