summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-13 05:04:46 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-13 05:04:46 +0000
commitc7ca48eac9a14b2b5233d9deb347bf0e1188ca3f (patch)
tree572a495193f31f2ec341afb86e711e1dd2c80197
parent4fdaf896dddd224958053b670bc9be78f102e789 (diff)
downloadgcc-c7ca48eac9a14b2b5233d9deb347bf0e1188ca3f.tar.gz
PR bootstrap/44048
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
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/call.c10
-rw-r--r--gcc/cp/cp-tree.def3
-rw-r--r--gcc/cp/cp-tree.h9
-rw-r--r--gcc/cp/cvt.c2
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/decl.c19
-rw-r--r--gcc/cp/error.c11
-rw-r--r--gcc/cp/mangle.c12
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/rtti.c8
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/dbxout.c1
-rw-r--r--gcc/dwarf2out.c27
-rw-r--r--gcc/sdbout.c1
16 files changed, 85 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8d8f5b465a8..0decfd807e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a1b05509364..5be74a357d1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index dccb1d4fbfe..0f62059f42e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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);
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index c3e8208b409..c71f94caa61 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index a28a2e30fda..02e81ebd0f2 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index efef5c2a41a..646610a94bf 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -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));
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 55def21f167..02c512a012d 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -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;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5f280ce2cc7..11fac713b3f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 8595719651a..b77a94c4ba8 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -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:
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 05d589293a1..5108950625f 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1933,14 +1933,18 @@ 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;
+ case LANG_TYPE:
+ if (NULLPTR_TYPE_P (type))
+ {
+ write_string ("Dn");
+ break;
+ }
+ /* else fall through. */
+
default:
gcc_unreachable ();
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 845faf37462..88a3e39507d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4859,7 +4859,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))
@@ -4891,6 +4890,7 @@ arg_assoc_type (struct arg_lookup *k, tree type)
return false;
case LANG_TYPE:
gcc_assert (type == unknown_type_node
+ || NULLPTR_TYPE_P (type)
|| type == init_list_type_node);
return false;
case TYPE_PACK_EXPANSION:
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index a36851ddd88..4eb2ba74c06 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -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];
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 5c8fd82688c..0ff857360c0 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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]
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index bce57036bcc..a314e7b4430 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -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
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 467bb268d4d..2e8ed393e5f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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:
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 6a771f4932b..87a00b4a61e 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -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: