OSDN Git Service

* attribs.c (strip_attrs): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-lang.c
index 5f38fbb..a1359cd 100644 (file)
@@ -78,8 +78,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl
 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
 #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME mangle_decl
 #undef LANG_HOOKS_MARK_ADDRESSABLE
@@ -131,9 +129,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
 #undef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P
 #define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
   cp_auto_var_in_fn_p
-#undef LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING
-#define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \
-  cp_copy_res_decl_for_inlining
 #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
 #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p
 #undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
@@ -228,7 +223,7 @@ cxx_get_alias_set (tree t)
     /* The base variant of a type must be in the same alias set as the
        complete type.  */
     return get_alias_set (TYPE_CONTEXT (t));
-  
+
   /* Punt on PMFs until we canonicalize functions properly.  */
   if (TYPE_PTRMEMFUNC_P (t))
     return 0;
@@ -265,15 +260,15 @@ cp_expr_size (tree exp)
       /* The backend should not be interested in the size of an expression
         of a type with both of these set; all copies of such types must go
         through a constructor or assignment op.  */
-      if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
-         && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))
-         /* But storing a CONSTRUCTOR isn't a copy.  */
-         && TREE_CODE (exp) != CONSTRUCTOR)
-       abort ();
+      gcc_assert (!TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
+                 || !TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))
+                 /* But storing a CONSTRUCTOR isn't a copy.  */
+                 || TREE_CODE (exp) == CONSTRUCTOR);
+      
       /* This would be wrong for a type with virtual bases, but they are
-        caught by the abort above.  */
+        caught by the assert above.  */
       return (is_empty_class (TREE_TYPE (exp))
-             ? size_zero_node 
+             ? size_zero_node
              : CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp)));
     }
   else
@@ -287,13 +282,14 @@ cp_tree_size (enum tree_code code)
 {
   switch (code)
     {
+    case TINST_LEVEL:          return sizeof (struct tinst_level_s);
     case PTRMEM_CST:           return sizeof (struct ptrmem_cst);
     case BASELINK:             return sizeof (struct tree_baselink);
     case TEMPLATE_PARM_INDEX:  return sizeof (template_parm_index);
     case DEFAULT_ARG:          return sizeof (struct tree_default_arg);
     case OVERLOAD:             return sizeof (struct tree_overload);
     default:
-      abort ();
+      gcc_unreachable ();
     }
   /* NOTREACHED */
 }
@@ -317,9 +313,23 @@ cp_var_mod_type_p (tree type, tree fn)
   return false;
 }
 
+/* This compares two types for equivalence ("compatible" in C-based languages).
+   This routine should only return 1 if it is sure.  It should not be used
+   in contexts where erroneously returning 0 causes problems.  */
+
 static int cxx_types_compatible_p (tree x, tree y)
 {
-  return same_type_ignoring_top_level_qualifiers_p (x, y);
+  if (same_type_ignoring_top_level_qualifiers_p (x, y))
+    return 1;
+
+  /* Once we get to the middle-end, references and pointers are
+     interchangeable.  FIXME should we try to replace all references with
+     pointers?  */
+  if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y)
+      && same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
+    return 1;
+
+  return 0;
 }
 
 /* Construct a C++-aware pretty-printer for CONTEXT.  It is assumed