From 14c2101daa9fd45e83de153275c7650950f1b7de Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 6 May 2010 16:51:52 -0400 Subject: Add support for C++0x nullptr. gcc: * c-common.c (c_common_reswords): Add nullptr. * c-common.h: Add RID_NULLPTR. Reorganize C++0x rids. * dwarf2out.c (is_base_type): Handle NULLPTR_TYPE. (gen_type_die_with_usage): Likewise. * dbxout.c (dbxout_type): Likewise. * sdbout.c (plain_type_1): Likewise. gcc/cp: * cp-tree.def: Add NULLPTR_TYPE. * cp-tree.h: Add nullptr_node. (cp_tree_index): Add CPTI_NULLPTR. (SCALAR_TYPE_P): Add NULLPTR_TYPE. * call.c (null_ptr_cst_p): Handle nullptr. (standard_conversion): Likewise. (convert_arg_to_ellipsis): Likewise. * mangle.c (write_type): Likewise. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_parser_primary_expression): Likewise. * typeck.c (cp_build_binary_op): Likewise. (build_reinterpret_cast_1): Likewise. * error.c (dump_type): Likewise. (dump_type_prefix, dump_type_suffix): Likewise. * decl.c (cxx_init_decl_processing): Likewise. * cxx-pretty-print.c (pp_cxx_constant): Likewise. * cvt.c (ocp_convert): Likewise. * rtti.c (typeinfo_in_lib_p, emit_support_tinfos): Put nullptr_t tinfo in libsupc++. libstdc++-v3: * config/abi/pre/gnu.ver: Add typeinfo for decltype(nullptr). libiberty: * cp-demangle.c (cplus_demangle_builtin_types): Add nullptr. (cplus_demangle_type): Handle nullptr. From-SVN: r159131 --- gcc/cp/cp-tree.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gcc/cp/cp-tree.h') diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 4fca633..22a7487 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -775,6 +775,8 @@ enum cp_tree_index CPTI_KEYED_CLASSES, + CPTI_NULLPTR, + CPTI_MAX }; @@ -809,6 +811,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL] #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] /* We cache these tree nodes so as to call get_identifier less frequently. */ @@ -3001,8 +3004,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* [basic.types] - Arithmetic types, enumeration types, pointer types, and - pointer-to-member types, are collectively called scalar types. + Arithmetic types, enumeration types, pointer types, + pointer-to-member types, and std::nullptr_t are collectively called + scalar types. Keep these checks in ascending code order. */ #define SCALAR_TYPE_P(TYPE) \ @@ -3010,7 +3014,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) || TREE_CODE (TYPE) == ENUMERAL_TYPE \ || ARITHMETIC_TYPE_P (TYPE) \ || TYPE_PTR_P (TYPE) \ - || TYPE_PTRMEMFUNC_P (TYPE)) + || TYPE_PTRMEMFUNC_P (TYPE) \ + || TREE_CODE (TYPE) == NULLPTR_TYPE) /* Determines whether this type is a C++0x scoped enumeration type. Scoped enumerations types are introduced via "enum class" or -- cgit v1.1