diff gcc/c-parser.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 3356a4c26abc
children 0a063106bba9
line wrap: on
line diff
--- a/gcc/c-parser.c	Tue Dec 20 19:03:56 2011 +0900
+++ b/gcc/c-parser.c	Sun Dec 25 04:04:42 2011 +0900
@@ -654,7 +654,8 @@
 	case RID_ACCUM:
 	case RID_SAT:
 #ifndef noCbC
-    case RID_CbC_CODE:
+	case RID_CbC_CODE:
+	case RID_CbC_REC:
 #endif
 	  return true;
 	default:
@@ -2097,30 +2098,31 @@
 	  c_parser_consume_token (parser);
 	  break;
 #ifndef noCbC
-    case RID_CbC_CODE:
-      if (!typespec_ok)
-        goto out;
-      attrs_ok = true;
-      seen_type = true;
-      if (c_dialect_objc ())
-        parser->objc_need_raw_identifier = true;
-      t.kind = ctsk_resword;
-      t.spec = c_parser_peek_token (parser)->value;
-      declspecs_add_type (loc, specs, t);
-
-      /*
-      attrs = get_identifier("fastcall");
-      attrs = build_tree_list(attrs, NULL_TREE);
-      declspecs_add_attrs(specs, attrs);
-      */
-      if(!TARGET_64BIT) {
-	attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE);
-	/*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/
-	declspecs_add_attrs(specs, attrs);
+	case RID_CbC_CODE:
+	case RID_CbC_REC:
+	  if (!typespec_ok)
+	    goto out;
+	  attrs_ok = true;
+	  seen_type = true;
+	  if (c_dialect_objc ())
+	    parser->objc_need_raw_identifier = true;
+	  t.kind = ctsk_resword;
+	  t.spec = c_parser_peek_token (parser)->value;
+	  declspecs_add_type (loc, specs, t);
+	  
+	  /*
+	    attrs = get_identifier("fastcall");
+	    attrs = build_tree_list(attrs, NULL_TREE);
+	    declspecs_add_attrs(specs, attrs);
+	  */
+	  if(!TARGET_64BIT) {
+	    attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE);
+	    /*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;
 #endif
 	case RID_ENUM:
 	  if (!typespec_ok)
@@ -6167,12 +6169,12 @@
   decl_attributes (&tlab, NULL_TREE, 0);
   add_stmt (build_stmt (loc, LABEL_EXPR, tlab));
 
-  tree ret = c_finish_return (loc, retval, retval); /*tree ret = c_finish_return (retval);*/
-  /*
+  tree ret = c_finish_return (loc, retval, retval); //tree ret = c_finish_return (retval);
   TREE_USED(ret) = 1;
   tree if_body = c_end_compound_stmt (loc, cstmt, true);
   TREE_SIDE_EFFECTS (cstmt) = 1;
   c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false);
+
   */
 
   cond = integer_zero_node;
@@ -6775,13 +6777,12 @@
           build_decl (location, VAR_DECL, get_identifier ("retval"),
           TREE_TYPE (TREE_TYPE (current_function_decl)));
 	TREE_STATIC (decl_cond) = 1;
-
-	/* use thread-local */
-	//DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond);
-	//	DECL_TLS_MODEL (decl_cond) = TLS_MODEL_REAL;
-
-	/* Linux: TLS_MODEL_LOCAL_EXEC  OS X: TlS_MODE_REAL */
-	DECL_TLS_MODEL (decl_cond) = TLS_MODEL_LOCAL_EXEC;
+	TREE_USED (decl_cond) = 1;
+
+	/* Use thread-local */
+	DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond);
+	DECL_NONLOCAL (decl_cond) = 1;
+	//	DECL_READ_P (decl_cond) = 1;
 	//DECL_ARTIFICIAL (decl_cond) = 1;
 	//	pushdecl (decl_cond);
 	add_stmt (build_stmt(location, DECL_EXPR,  pushdecl (decl_cond)));
@@ -6789,6 +6790,7 @@
         /* define nested function.  */
         decl =
           cbc_finish_nested_function (location, label, decl_cond);
+	TREE_USED(decl) = 1;
 
         /* define if-ed goto label and return statement. */
         cbc_finish_labeled_goto (location, label, decl_cond);