diff gcc/c-decl.c @ 90:99e7b6776dd1

implemeted __rectype expression. add CbC-exanples/fact-rectype.s
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sun, 25 Dec 2011 04:04:42 +0900
parents f26ecf70364b
children 5c3ad79fc15b
line wrap: on
line diff
--- a/gcc/c-decl.c	Tue Dec 20 19:03:56 2011 +0900
+++ b/gcc/c-decl.c	Sun Dec 25 04:04:42 2011 +0900
@@ -5636,6 +5636,12 @@
 	  }
 	case cdk_pointer:
 	  {
+#ifndef noCbC
+          if ( declspecs->typespec_word == cts_CbC_rec )
+            {
+              type = build_code_segment_type (type, NULL_TREE);
+            }
+#endif
 	    /* Merge any constancy or volatility into the target type
 	       for the pointer.  */
 
@@ -8892,6 +8898,10 @@
         error_at (loc,
               ("both %<long%> and %<void%> in "
                "declaration specifiers"));
+          else if (specs->typespec_word == cts_CbC_rec)
+        error_at (loc,
+              ("both %<long%> and %<void%> in "
+               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_int128)
 		  error_at (loc,
@@ -8939,6 +8949,10 @@
         error_at (loc,
               ("both %<short%> and %<void%> in "
                "declaration specifiers"));
+          else if (specs->typespec_word == cts_CbC_rec)
+        error_at (loc,
+              ("both %<short%> and %<void%> in "
+               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_int128)
 		error_at (loc,
@@ -8990,6 +9004,10 @@
         error_at (loc,
               ("both %<signed%> and %<void%> in "
                "declaration specifiers"));
+          else if (specs->typespec_word == cts_CbC_rec)
+        error_at (loc,
+              ("both %<signed%> and %<void%> in "
+               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_bool)
 		error_at (loc,
@@ -9033,6 +9051,10 @@
         error_at (loc,
               ("both %<unsigned%> and %<void%> in "
                "declaration specifiers"));
+          else if (specs->typespec_word == cts_CbC_rec)
+        error_at (loc,
+              ("both %<unsigned%> and %<void%> in "
+               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_bool)
 		error_at (loc,
@@ -9075,6 +9097,10 @@
         error_at (loc,
               ("both %<complex%> and %<void%> in "
                "declaration specifiers"));
+          else if (specs->typespec_word == cts_CbC_rec)
+        error_at (loc,
+              ("both %<complex%> and %<void%> in "
+               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_bool)
 		error_at (loc,
@@ -9237,22 +9263,51 @@
 #ifndef noCbC
         case RID_CbC_CODE:
           if (specs->long_p)
-        error ("both %<long%> and %<void%> in "
-               "declaration specifiers");
-          else if (specs->short_p)
-        error ("both %<short%> and %<void%> in "
-               "declaration specifiers");
-          else if (specs->signed_p)
-        error ("both %<signed%> and %<void%> in "
-               "declaration specifiers");
-          else if (specs->unsigned_p)
-        error ("both %<unsigned%> and %<void%> in "
-               "declaration specifiers");
-          else if (specs->complex_p)
-        error ("both %<complex%> and %<void%> in "
-               "declaration specifiers");
+	    error_at (loc,
+		      ("both %<long%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->short_p)
+	    error_at (loc,
+		      ("both %<short%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->signed_p)
+	    error_at (loc,
+		      ("both %<signed%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->unsigned_p)
+	    error_at (loc,
+		      ("both %<unsigned%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->complex_p)
+	    error_at (loc,
+		      ("both %<complex%> and %<_Bool%> in "
+		       "declaration specifiers"));
           else
-        specs->typespec_word = cts_CbC_code;
+	    specs->typespec_word = cts_CbC_code;
+          return specs;
+        case RID_CbC_REC:
+          if (specs->long_p)
+	    error_at (loc,
+		      ("both %<long%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->short_p)
+	    error_at (loc,
+		      ("both %<short%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->signed_p)
+	    error_at (loc,
+		      ("both %<signed%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->unsigned_p)
+	    error_at (loc,
+		      ("both %<unsigned%> and %<_Bool%> in "
+		       "declaration specifiers"));
+	  else if (specs->complex_p)
+	    error_at (loc,
+		      ("both %<complex%> and %<_Bool%> in "
+		       "declaration specifiers"));
+          else
+	    specs->typespec_word = cts_CbC_rec;
           return specs;
 #endif
 	    case RID_BOOL:
@@ -9676,6 +9731,7 @@
     case cts_void:
 #ifndef noCbC
     case cts_CbC_code:
+    case cts_CbC_rec:
 #endif
       gcc_assert (!specs->long_p && !specs->short_p
 		  && !specs->signed_p && !specs->unsigned_p