+2019-10-23 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
+ (std_identifier): Delete.
+ (DECL_NAME_SPACE_STD_P): Compare against std_node.
+ * decl.c (initialize_predefined_identifiers): 'std' is not needed.
+ (cxx_init_decl_processing): Adjust creation of ::std. Use
+ {push,pop}_nested_namespace.
+ (cxx_builtin_function): Use {push,pop}_nested_namespace.
+ * except.c (init_exception_processing): Likewise.
+ * rtti.c (init_rtti_processing): Likewise.
+
2019-10-23 Jason Merrill <jason@redhat.com>
Implement P1286R2, Contra CWG1778
CPTI_PFN_IDENTIFIER,
CPTI_VPTR_IDENTIFIER,
CPTI_GLOBAL_IDENTIFIER,
- CPTI_STD_IDENTIFIER,
CPTI_ANON_IDENTIFIER,
CPTI_AUTO_IDENTIFIER,
CPTI_DECLTYPE_AUTO_IDENTIFIER,
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
/* The name of the ::, std & anon namespaces. */
#define global_identifier cp_global_trees[CPTI_GLOBAL_IDENTIFIER]
-#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
#define anon_identifier cp_global_trees[CPTI_ANON_IDENTIFIER]
/* auto and declspec(auto) identifiers. */
#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
/* Nonzero if NODE is the std namespace. */
#define DECL_NAMESPACE_STD_P(NODE) \
- (TREE_CODE (NODE) == NAMESPACE_DECL \
- && CP_DECL_CONTEXT (NODE) == global_namespace \
- && DECL_NAME (NODE) == std_identifier)
+ ((NODE) == std_node)
/* In a TREE_LIST in an attribute list, indicates that the attribute
must be applied at instantiation time. */
{"_vptr", &vptr_identifier, cik_normal},
{"__vtt_parm", &vtt_parm_identifier, cik_normal},
{"::", &global_identifier, cik_normal},
- {"std", &std_identifier, cik_normal},
/* The demangler expects anonymous namespaces to be called
something starting with '_GLOBAL__N_'. It no longer needs
to be unique to the TU. */
current_lang_name = lang_name_c;
/* Create the `std' namespace. */
- push_namespace (std_identifier);
+ push_namespace (get_identifier ("std"));
std_node = current_namespace;
pop_namespace ();
tree bad_alloc_type_node;
tree bad_alloc_decl;
- push_namespace (std_identifier);
+ push_nested_namespace (std_node);
bad_alloc_id = get_identifier ("bad_alloc");
bad_alloc_type_node = make_class_type (RECORD_TYPE);
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
bad_alloc_decl
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
DECL_CONTEXT (bad_alloc_decl) = current_namespace;
- pop_namespace ();
+ pop_nested_namespace (std_node);
new_eh_spec
= add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1);
if (aligned_new_threshold)
{
- push_namespace (std_identifier);
+ push_nested_namespace (std_node);
tree align_id = get_identifier ("align_val_t");
align_type_node = start_enum (align_id, NULL_TREE, size_type_node,
NULL_TREE, /*scoped*/true, NULL);
- pop_namespace ();
+ pop_nested_namespace (std_node);
/* operator new (size_t, align_val_t); */
newtype = build_function_type_list (ptr_type_node, size_type_node,
{
tree std_decl = copy_decl (decl);
- push_namespace (std_identifier);
+ push_nested_namespace (std_node);
DECL_CONTEXT (std_decl) = FROB_CONTEXT (std_node);
pushdecl (std_decl);
- pop_namespace ();
+ pop_nested_namespace (std_node);
}
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
tree tmp;
/* void std::terminate (); */
- push_namespace (std_identifier);
+ push_nested_namespace (std_node);
tmp = build_function_type_list (void_type_node, NULL_TREE);
terminate_fn = build_cp_library_fn_ptr ("terminate", tmp,
ECF_NOTHROW | ECF_NORETURN
| ECF_COLD);
gcc_checking_assert (TREE_THIS_VOLATILE (terminate_fn)
&& TREE_NOTHROW (terminate_fn));
- pop_namespace ();
+ pop_nested_namespace (std_node);
/* void __cxa_call_unexpected(void *); */
tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
{
tree type_info_type;
- push_namespace (std_identifier);
+ push_nested_namespace (std_node);
type_info_type = xref_tag (class_type, get_identifier ("type_info"),
/*tag_scope=*/ts_current, false);
- pop_namespace ();
+ pop_nested_namespace (std_node);
const_type_info_type_node
= cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST);
type_info_ptr_type = build_pointer_type (const_type_info_type_node);