OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / java / decl.c
index 41edf21..1e1db76 100644 (file)
@@ -566,13 +566,14 @@ java_init_decl_processing (void)
   pushlevel (0);       /* make the binding_level structure for global names */
   global_binding_level = current_binding_level;
 
-  /* The code here must be similar to build_common_tree_nodes{,_2} in
-     tree.c, especially as to the order of initializing common nodes.  */
-  error_mark_node = make_node (ERROR_MARK);
-  TREE_TYPE (error_mark_node) = error_mark_node;
+  /* Build common tree nodes, Java has an unsigned char.  */
+  build_common_tree_nodes (false, false);
 
-  /* Create sizetype first - needed for other types. */
-  initialize_sizetypes ();
+  /* ???  Now we continue and override some of the built types again
+     with Java specific types.  As the above generated types are
+     supposed to match the targets C ABI this isn't really the way
+     to go and any Java specifics should _not_ use those global types
+     if the Java ABI does not match the C one.  */
 
   byte_type_node = make_signed_type (8);
   pushdecl (build_decl (BUILTINS_LOCATION,
@@ -604,11 +605,6 @@ java_init_decl_processing (void)
                        TYPE_DECL, get_identifier ("unsigned long"),
                        unsigned_long_type_node));
 
-  /* This is not a java type, however tree-dfa requires a definition for
-     size_type_node.  */
-  size_type_node = make_unsigned_type (POINTER_SIZE);
-  set_sizetype (size_type_node);
-
   /* Define these next since types below may used them.  */
   integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
   integer_zero_node = build_int_cst (NULL_TREE, 0);
@@ -624,39 +620,22 @@ java_init_decl_processing (void)
     = double_int_to_tree (unsigned_long_type_node,
                          double_int_setbit (double_int_zero, 64));
 
-  size_zero_node = size_int (0);
-  size_one_node = size_int (1);
-  bitsize_zero_node = bitsize_int (0);
-  bitsize_one_node = bitsize_int (1);
-  bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
-
   long_zero_node = build_int_cst (long_type_node, 0);
 
-  void_type_node = make_node (VOID_TYPE);
   pushdecl (build_decl (BUILTINS_LOCATION,
                        TYPE_DECL, get_identifier ("void"), void_type_node));
-  layout_type (void_type_node);        /* Uses size_zero_node */
-
-  ptr_type_node = build_pointer_type (void_type_node);
-  const_ptr_type_node
-    = build_pointer_type (build_type_variant (void_type_node, 1, 0));
 
   t = make_node (VOID_TYPE);
   layout_type (t); /* Uses size_zero_node */
   return_address_type_node = build_pointer_type (t);
 
-  null_pointer_node = build_int_cst (ptr_type_node, 0);
-
-  char_type_node = make_node (INTEGER_TYPE);
+  char_type_node = make_unsigned_type (16);
   TYPE_STRING_FLAG (char_type_node) = 1;
-  TYPE_PRECISION (char_type_node) = 16;
-  fixup_unsigned_type (char_type_node);
   pushdecl (build_decl (BUILTINS_LOCATION,
                        TYPE_DECL, get_identifier ("char"), char_type_node));
 
-  boolean_type_node = make_node (BOOLEAN_TYPE);
-  TYPE_PRECISION (boolean_type_node) = 1;
-  fixup_unsigned_type (boolean_type_node);
+  boolean_type_node = make_unsigned_type (1);
+  TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
   pushdecl (build_decl (BUILTINS_LOCATION,
                        TYPE_DECL, get_identifier ("boolean"),
                        boolean_type_node));
@@ -1153,23 +1132,10 @@ java_init_decl_processing (void)
   soft_lrem_node
     = add_builtin_function ("_Jv_remJ", t,
                            0, NOT_BUILT_IN, NULL, NULL_TREE);
-  /* Initialize va_list_type_node.  */
-  unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
-  t = targetm.build_builtin_va_list ();
-
-  /* Many back-ends define record types without setting TYPE_NAME.
-     If we copied the record type here, we'd keep the original
-     record type without a name.  This breaks name mangling.  So,
-     don't copy record types and let c_common_nodes_and_builtins()
-     declare the type to be __builtin_va_list.  */
-  if (TREE_CODE (t) != RECORD_TYPE)
-    t = build_variant_type_copy (t);
-
-  va_list_type_node = t;
 
   initialize_builtins ();
 
-  soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
+  soft_fmod_node = builtin_decl_explicit (BUILT_IN_FMOD);
 
   parse_version ();
 }
@@ -1315,9 +1281,9 @@ pushdecl_function_level (tree x)
   return t;
 }
 
-/* Nonzero if we are currently in the global binding level.  */
+/* Return true if we are in the global binding level.  */
 
-int
+bool
 global_bindings_p (void)
 {
   return current_binding_level == global_binding_level;
@@ -1438,10 +1404,7 @@ poplevel (int keep, int reverse, int functionbody)
 
   block = 0;
   if (keep || functionbody)
-    {
-      block = make_node (BLOCK);
-      TREE_TYPE (block) = void_type_node;
-    }
+    block = make_node (BLOCK);
 
   if (current_binding_level->exception_range)
     expand_end_java_handler (current_binding_level->exception_range);
@@ -1469,7 +1432,7 @@ poplevel (int keep, int reverse, int functionbody)
            }
          *var = NULL;
            
-         bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block), 
+         bind = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block), 
                         BLOCK_EXPR_BODY (block), block);
          BIND_EXPR_BODY (bind) = current_binding_level->stmts;
          
@@ -1494,7 +1457,7 @@ poplevel (int keep, int reverse, int functionbody)
 
   /* In each subblock, record that this is its superior.  */
 
-  for (link = subblocks; link; link = TREE_CHAIN (link))
+  for (link = subblocks; link; link = BLOCK_CHAIN (link))
     BLOCK_SUPERCONTEXT (link) = block;
 
   /* Clear out the meanings of the local variables of this level.  */
@@ -1558,7 +1521,7 @@ poplevel (int keep, int reverse, int functionbody)
       if (block)
        {
          current_binding_level->blocks
-           = chainon (current_binding_level->blocks, block);
+           = block_chainon (current_binding_level->blocks, block);
        }
       /* If we did not make a block for the level just exited,
         any blocks made for inner levels
@@ -1567,7 +1530,7 @@ poplevel (int keep, int reverse, int functionbody)
         of something else.  */
       else if (subblocks)
        current_binding_level->blocks
-         = chainon (current_binding_level->blocks, subblocks);
+         = block_chainon (current_binding_level->blocks, subblocks);
 
       if (bind)
        java_add_stmt (bind);
@@ -1941,7 +1904,10 @@ java_mark_decl_local (tree decl)
 #ifdef ENABLE_CHECKING
   /* Double check that we didn't pass the function to the callgraph early.  */
   if (TREE_CODE (decl) == FUNCTION_DECL)
-    gcc_assert (!cgraph_node (decl)->local.finalized);
+    {
+      struct cgraph_node *node = cgraph_get_node (decl);
+      gcc_assert (!node || !node->local.finalized);
+    }
 #endif
   gcc_assert (!DECL_RTL_SET_P (decl));
 }