changeset 102:fdc380f80c07

fix __rectype expression
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Mon, 20 Feb 2012 15:38:52 +0900
parents 5c3ad79fc15b
children edcadcec937d
files gcc/c-decl.c gcc/c-parser.c
diffstat 2 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/gcc/c-decl.c	Thu Feb 16 18:15:22 2012 +0900
+++ b/gcc/c-decl.c	Mon Feb 20 15:38:52 2012 +0900
@@ -5155,6 +5155,16 @@
 	}
     }
 
+
+#ifndef noCbC
+  if ( declspecs->typespec_word == cts_CbC_rec )
+    {
+      type = build_code_segment_type (type, NULL_TREE);
+      IS_RECTYPE(type) = 1;
+    }
+#endif
+
+
   /* Now figure out the structure of the declarator proper.
      Descend through it, creating more complex types, until we reach
      the declared identifier (or NULL_TREE, in an absolute declarator).
@@ -5636,13 +5646,6 @@
 	  }
 	case cdk_pointer:
 	  {
-#ifndef noCbC
-          if ( declspecs->typespec_word == cts_CbC_rec )
-            {
-              type = build_code_segment_type (type, NULL_TREE);
-	      IS_RECTYPE(type) = 1;
-            }
-#endif
 	    /* Merge any constancy or volatility into the target type
 	       for the pointer.  */
 
@@ -5690,6 +5693,11 @@
 
 	    type = build_pointer_type (type);
 
+#ifndef noCbC
+	    if ( declspecs->typespec_word == cts_CbC_rec ){
+	      IS_RECTYPE(type) = 1;
+	    }
+#endif
 	    /* Process type qualifiers (such as const or volatile)
 	       that were given inside the `*'.  */
 	    type_quals = declarator->u.pointer_quals;
--- a/gcc/c-parser.c	Thu Feb 16 18:15:22 2012 +0900
+++ b/gcc/c-parser.c	Mon Feb 20 15:38:52 2012 +0900
@@ -1644,19 +1644,17 @@
 		if(TREE_CODE(tmp) == FUNCTION_TYPE) {
 		  tree t = declarator->u.arg_info->parms;
 		  while(t) {
+		    if( !IS_RECTYPE(t)) {
+		      t = TREE_CHAIN(t);		  		      
+		      continue;
+		    }
 		    tree tmptype = t;
-		    while(TREE_TYPE(tmptype) && TREE_CODE(TREE_TYPE(tmptype)) == POINTER_TYPE) {
+		    while(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;
-		    }
+		    TREE_TYPE(t) = tmp;
+		    break;
 		    t = TREE_CHAIN(t);		  
 		  }
 		}