OSDN Git Service

PR bootstrap/44048
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 May 2010 05:04:46 +0000 (05:04 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:07:20 +0000 (14:07 +0900)
PR target/44099
gcc/cp:
* cp-tree.def (NULLPTR_TYPE): Remove.
* cp-tree.h (NULLPTR_TYPE_P): New.
(SCALAR_TYPE_P): Use it.
(nullptr_type_node): New.
(cp_tree_index): Add CPTI_NULLPTR_TYPE.
* decl.c (cxx_init_decl_processing): Call record_builtin_type on
nullptr_type_node.
* cvt.c (ocp_convert): Use NULLPTR_TYPE_P instead of NULLPTR_TYPE.
* cxx-pretty-print.c (pp_cxx_constant): Likewise.
* error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise.
* mangle.c (write_type): Likewise.
* name-lookup.c (arg_assoc_type): Likewise.
* typeck.c (build_reinterpret_cast_1): Likewise.
* rtti.c (typeinfo_in_lib_p): Likewise.
(emit_support_tinfos): Remove local nullptr_type_node.
gcc:
* dbxout.c (dbxout_type): Remove NULLPTR_TYPE handling.
* sdbout.c (plain_type_1): Likewise.
* dwarf2out.c (is_base_type): Likewise.
(gen_type_die_with_usage): Likewise.  Generate
DW_TAG_unspecified_type for any LANG_TYPE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159350 138bc75d-0d04-0410-961f-82ee72b054a4

16 files changed:
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.def
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/cxx-pretty-print.c
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/mangle.c
gcc/cp/name-lookup.c
gcc/cp/rtti.c
gcc/cp/typeck.c
gcc/dbxout.c
gcc/dwarf2out.c
gcc/sdbout.c

index 8d8f5b4..0decfd8 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-12  Jason Merrill  <jason@redhat.com>
+
+       PR bootstrap/44048
+       PR target/44099
+       * dbxout.c (dbxout_type): Remove NULLPTR_TYPE handling.
+       * sdbout.c (plain_type_1): Likewise.
+       * dwarf2out.c (is_base_type): Likewise.
+       (gen_type_die_with_usage): Likewise.  Generate
+       DW_TAG_unspecified_type for any LANG_TYPE.
+
 2010-05-12  Jan Hubicka  <jh@suse.cz>
 
        * cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges): Build
index a1b0550..5be74a3 100644 (file)
@@ -1,5 +1,23 @@
 2010-05-12  Jason Merrill  <jason@redhat.com>
 
+       PR bootstrap/44048
+       PR target/44099
+       * cp-tree.def (NULLPTR_TYPE): Remove.
+       * cp-tree.h (NULLPTR_TYPE_P): New.
+       (SCALAR_TYPE_P): Use it.
+       (nullptr_type_node): New.
+       (cp_tree_index): Add CPTI_NULLPTR_TYPE.
+       * decl.c (cxx_init_decl_processing): Call record_builtin_type on
+       nullptr_type_node.
+       * cvt.c (ocp_convert): Use NULLPTR_TYPE_P instead of NULLPTR_TYPE.
+       * cxx-pretty-print.c (pp_cxx_constant): Likewise.
+       * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise.
+       * mangle.c (write_type): Likewise.
+       * name-lookup.c (arg_assoc_type): Likewise.
+       * typeck.c (build_reinterpret_cast_1): Likewise.
+       * rtti.c (typeinfo_in_lib_p): Likewise.
+       (emit_support_tinfos): Remove local nullptr_type_node.
+
        * cp-tree.h (UNKNOWN_TYPE): Remove.
        * decl.c (cxx_init_decl_processing): Use LANG_TYPE instead.
        * error.c (dumy_type, dump_type_prefix, dump_type_suffix): Likewise.
index dccb1d4..0f62059 100644 (file)
@@ -464,7 +464,7 @@ null_ptr_cst_p (tree t)
      an rvalue of type std::nullptr_t. */
   t = integral_constant_value (t);
   if (t == null_node
-      || TREE_CODE (TREE_TYPE (t)) == NULLPTR_TYPE)
+      || NULLPTR_TYPE_P (TREE_TYPE (t)))
     return true;
   if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t))
     {
@@ -783,7 +783,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
      null pointer constant of integral type can be converted to an
      rvalue of type std::nullptr_t. */
   if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to)
-       || tcode == NULLPTR_TYPE)
+       || NULLPTR_TYPE_P (to))
       && expr && null_ptr_cst_p (expr))
     conv = build_conv (ck_std, to, conv);
   else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
@@ -924,14 +924,14 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
          || UNSCOPED_ENUM_P (from)
          || fcode == POINTER_TYPE
          || TYPE_PTR_TO_MEMBER_P (from)
-         || fcode == NULLPTR_TYPE)
+         || NULLPTR_TYPE_P (from))
        {
          conv = build_conv (ck_std, to, conv);
          if (fcode == POINTER_TYPE
              || TYPE_PTRMEM_P (from)
              || (TYPE_PTRMEMFUNC_P (from)
                  && conv->rank < cr_pbool)
-              || fcode == NULLPTR_TYPE)
+             || NULLPTR_TYPE_P (from))
            conv->rank = cr_pbool;
          return conv;
        }
@@ -5209,7 +5209,7 @@ convert_arg_to_ellipsis (tree arg)
          < TYPE_PRECISION (double_type_node))
       && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (arg))))
     arg = convert_to_real (double_type_node, arg);
-  else if (TREE_CODE (TREE_TYPE (arg)) == NULLPTR_TYPE)
+  else if (NULLPTR_TYPE_P (TREE_TYPE (arg)))
     arg = null_pointer_node;
   else if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (arg)))
     arg = perform_integral_promotions (arg);
index c3e8208..c71f94c 100644 (file)
@@ -449,9 +449,6 @@ DEFTREECODE (DECLTYPE_TYPE, "decltype_type", tcc_type, 0)
    instantiation time.  */
 DEFTREECODE (TEMPLATE_INFO, "template_info", tcc_exceptional, 0)
 
-/* The type of a nullptr expression. This is a C++0x extension. */
-DEFTREECODE (NULLPTR_TYPE, "decltype(nullptr)", tcc_type, 0)
-
 /*
 Local variables:
 mode:c
index a28a2e3..02e81eb 100644 (file)
@@ -776,6 +776,7 @@ enum cp_tree_index
     CPTI_KEYED_CLASSES,
 
     CPTI_NULLPTR,
+    CPTI_NULLPTR_TYPE,
 
     CPTI_MAX
 };
@@ -812,6 +813,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
 #define global_delete_fndecl           cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
 #define current_aggr                   cp_global_trees[CPTI_AGGR_TAG]
 #define nullptr_node                   cp_global_trees[CPTI_NULLPTR]
+#define nullptr_type_node              cp_global_trees[CPTI_NULLPTR_TYPE]
 
 /* We cache these tree nodes so as to call get_identifier less
    frequently.  */
@@ -3002,6 +3004,11 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    || TREE_CODE (TYPE) == REAL_TYPE \
    || TREE_CODE (TYPE) == COMPLEX_TYPE)
 
+/* True iff TYPE is cv decltype(nullptr).  */
+#define NULLPTR_TYPE_P(TYPE)                           \
+  (TREE_CODE (TYPE) == LANG_TYPE                       \
+   && TYPE_MAIN_VARIANT (TYPE) == nullptr_type_node)
+
 /* [basic.types]
 
    Arithmetic types, enumeration types, pointer types,
@@ -3015,7 +3022,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    || ARITHMETIC_TYPE_P (TYPE)                 \
    || TYPE_PTR_P (TYPE)                                \
    || TYPE_PTRMEMFUNC_P (TYPE)                  \
-   || TREE_CODE (TYPE) == NULLPTR_TYPE)
+   || NULLPTR_TYPE_P (TYPE))
 
 /* Determines whether this type is a C++0x scoped enumeration
    type. Scoped enumerations types are introduced via "enum class" or
index efef5c2..646610a 100644 (file)
@@ -704,7 +704,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
 
       return fold_if_not_in_template (convert_to_integer (type, e));
     }
-  if (code == NULLPTR_TYPE && e && null_ptr_cst_p (e))
+  if (NULLPTR_TYPE_P (type) && e && null_ptr_cst_p (e))
     return nullptr_node;
   if (POINTER_TYPE_P (type) || TYPE_PTR_TO_MEMBER_P (type))
     return fold_if_not_in_template (cp_convert_to_pointer (type, e));
index 55def21..02c512a 100644 (file)
@@ -340,7 +340,7 @@ pp_cxx_constant (cxx_pretty_printer *pp, tree t)
       break;
 
     case INTEGER_CST:
-      if (TREE_CODE (TREE_TYPE (t)) == NULLPTR_TYPE)
+      if (NULLPTR_TYPE_P (TREE_TYPE (t)))
        {
          pp_string (pp, "nullptr");
          break;
index 5f280ce..11fac71 100644 (file)
@@ -3527,16 +3527,15 @@ cxx_init_decl_processing (void)
     global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype);
     push_cp_library_fn (VEC_DELETE_EXPR, deltype);
 
-    {
-      tree nullptr_type_node = make_node (NULLPTR_TYPE);
-      TYPE_SIZE (nullptr_type_node) = bitsize_int (GET_MODE_BITSIZE (ptr_mode));
-      TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
-      TYPE_UNSIGNED (nullptr_type_node) = 1;
-      TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
-      SET_TYPE_MODE (nullptr_type_node, Pmode);
-      nullptr_node = make_node (INTEGER_CST);
-      TREE_TYPE (nullptr_node) = nullptr_type_node;
-    }
+    nullptr_type_node = make_node (LANG_TYPE);
+    TYPE_SIZE (nullptr_type_node) = bitsize_int (GET_MODE_BITSIZE (ptr_mode));
+    TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
+    TYPE_UNSIGNED (nullptr_type_node) = 1;
+    TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
+    SET_TYPE_MODE (nullptr_type_node, Pmode);
+    record_builtin_type (RID_MAX, "decltype(nullptr)", nullptr_type_node);
+    nullptr_node = make_node (INTEGER_CST);
+    TREE_TYPE (nullptr_node) = nullptr_type_node;
   }
 
   abort_fndecl
index 8595719..b77a94c 100644 (file)
@@ -339,7 +339,10 @@ dump_type (tree t, int flags)
       else if (t == unknown_type_node)
        pp_string (cxx_pp, M_("<unresolved overloaded function type>"));
       else
-       gcc_unreachable ();
+       {
+         pp_cxx_cv_qualifier_seq (cxx_pp, t);
+         pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
+       }
       break;
 
     case TREE_LIST:
@@ -477,10 +480,6 @@ dump_type (tree t, int flags)
       pp_cxx_right_paren (cxx_pp);
       break;
 
-    case NULLPTR_TYPE:
-      pp_string (cxx_pp, "std::nullptr_t");
-      break;
-
     default:
       pp_unsupported_tree (cxx_pp, t);
       /* Fall through to error.  */
@@ -709,7 +708,6 @@ dump_type_prefix (tree t, int flags)
     case DECLTYPE_TYPE:
     case TYPE_PACK_EXPANSION:
     case FIXED_POINT_TYPE:
-    case NULLPTR_TYPE:
       dump_type (t, flags);
       pp_base (cxx_pp)->padding = pp_before;
       break;
@@ -812,7 +810,6 @@ dump_type_suffix (tree t, int flags)
     case DECLTYPE_TYPE:
     case TYPE_PACK_EXPANSION:
     case FIXED_POINT_TYPE:
-    case NULLPTR_TYPE:
       break;
 
     default:
index b160744..89ccbaf 100644 (file)
@@ -1932,10 +1932,6 @@ write_type (tree type)
               write_char ('E');
               break;
 
-           case NULLPTR_TYPE:
-              write_string ("Dn");
-              break;
-
            case TYPEOF_TYPE:
              sorry ("mangling typeof, use decltype instead");
              break;
index 465e711..405bf16 100644 (file)
@@ -4879,7 +4879,6 @@ arg_assoc_type (struct arg_lookup *k, tree type)
     case BOOLEAN_TYPE:
     case FIXED_POINT_TYPE:
     case DECLTYPE_TYPE:
-    case NULLPTR_TYPE:
       return false;
     case RECORD_TYPE:
       if (TYPE_PTRMEMFUNC_P (type))
index a36851d..4eb2ba7 100644 (file)
@@ -1046,9 +1046,13 @@ typeinfo_in_lib_p (tree type)
     case BOOLEAN_TYPE:
     case REAL_TYPE:
     case VOID_TYPE:
-    case NULLPTR_TYPE:
       return true;
 
+    case LANG_TYPE:
+      if (NULLPTR_TYPE_P (type))
+       return true;
+      /* else fall through.  */
+
     default:
       return false;
     }
@@ -1454,7 +1458,6 @@ emit_support_tinfos (void)
 {
   /* Dummy static variable so we can put nullptr in the array; it will be
      set before we actually start to walk the array.  */
-  static tree nullptr_type_node;
   static tree *const fundamentals[] =
   {
     &void_type_node,
@@ -1484,7 +1487,6 @@ emit_support_tinfos (void)
   if (!dtor || DECL_EXTERNAL (dtor))
     return;
   doing_runtime = 1;
-  nullptr_type_node = TREE_TYPE (nullptr_node);
   for (ix = 0; fundamentals[ix]; ix++)
     {
       tree bltn = *fundamentals[ix];
index 5c8fd82..0ff8573 100644 (file)
@@ -6028,7 +6028,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
      an integral type; the conversion has the same meaning and
      validity as a conversion of (void*)0 to the integral type.  */
   if (CP_INTEGRAL_TYPE_P (type)
-      && (TYPE_PTR_P (intype) || TREE_CODE (intype) == NULLPTR_TYPE))
+      && (TYPE_PTR_P (intype) || NULLPTR_TYPE_P (intype)))
     {
       if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
         {
@@ -6038,7 +6038,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
           else
             return error_mark_node;
         }
-      if (TREE_CODE (intype) == NULLPTR_TYPE)
+      if (NULLPTR_TYPE_P (intype))
         return build_int_cst (type, 0);
     }
   /* [expr.reinterpret.cast]
index bce5703..a314e7b 100644 (file)
@@ -1867,7 +1867,6 @@ dbxout_type (tree type, int full)
     {
     case VOID_TYPE:
     case LANG_TYPE:
-    case NULLPTR_TYPE:
       /* For a void type, just define it as itself; i.e., "5=5".
         This makes us consider it defined
         without saying what it is.  The debugger will make it
index 467bb26..2e8ed39 100644 (file)
@@ -12104,7 +12104,6 @@ is_base_type (tree type)
     case ENUMERAL_TYPE:
     case FUNCTION_TYPE:
     case METHOD_TYPE:
-    case NULLPTR_TYPE:
     case POINTER_TYPE:
     case REFERENCE_TYPE:
     case OFFSET_TYPE:
@@ -19186,18 +19185,6 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
         when appropriate.  */
       return;
 
-    case NULLPTR_TYPE:
-      {
-        dw_die_ref type_die = lookup_type_die (type);
-        if (type_die == NULL)
-          {
-            type_die = new_die (DW_TAG_unspecified_type, comp_unit_die, type);
-            add_name_attribute (type_die, "decltype(nullptr)");
-            equate_type_number_to_die (type, type_die);
-          }
-      }
-      return;
-
     case VOID_TYPE:
     case INTEGER_TYPE:
     case REAL_TYPE:
@@ -19208,7 +19195,19 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
       break;
 
     case LANG_TYPE:
-      /* No Dwarf representation currently defined.  */
+      /* Just use DW_TAG_unspecified_type.  */
+      {
+        dw_die_ref type_die = lookup_type_die (type);
+        if (type_die == NULL)
+          {
+           tree name = TYPE_NAME (type);
+           if (TREE_CODE (name) == TYPE_DECL)
+             name = DECL_NAME (name);
+            type_die = new_die (DW_TAG_unspecified_type, comp_unit_die, type);
+            add_name_attribute (type_die, IDENTIFIER_POINTER (name));
+            equate_type_number_to_die (type, type_die);
+          }
+      }
       break;
 
     default:
index 6a771f4..87a00b4 100644 (file)
@@ -493,7 +493,6 @@ plain_type_1 (tree type, int level)
   switch (TREE_CODE (type))
     {
     case VOID_TYPE:
-    case NULLPTR_TYPE:
       return T_VOID;
     case BOOLEAN_TYPE:
     case INTEGER_TYPE: