[C++ PATCH] 'std' identifier not needed
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01707.html * 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. From-SVN: r277365
This commit is contained in:
parent
61d5466b6d
commit
5a7c450582
@ -1,3 +1,15 @@
|
|||||||
|
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>
|
2019-10-23 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
Implement P1286R2, Contra CWG1778
|
Implement P1286R2, Contra CWG1778
|
||||||
|
@ -149,7 +149,6 @@ enum cp_tree_index
|
|||||||
CPTI_PFN_IDENTIFIER,
|
CPTI_PFN_IDENTIFIER,
|
||||||
CPTI_VPTR_IDENTIFIER,
|
CPTI_VPTR_IDENTIFIER,
|
||||||
CPTI_GLOBAL_IDENTIFIER,
|
CPTI_GLOBAL_IDENTIFIER,
|
||||||
CPTI_STD_IDENTIFIER,
|
|
||||||
CPTI_ANON_IDENTIFIER,
|
CPTI_ANON_IDENTIFIER,
|
||||||
CPTI_AUTO_IDENTIFIER,
|
CPTI_AUTO_IDENTIFIER,
|
||||||
CPTI_DECLTYPE_AUTO_IDENTIFIER,
|
CPTI_DECLTYPE_AUTO_IDENTIFIER,
|
||||||
@ -289,7 +288,6 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
|
|||||||
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
|
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
|
||||||
/* The name of the ::, std & anon namespaces. */
|
/* The name of the ::, std & anon namespaces. */
|
||||||
#define global_identifier cp_global_trees[CPTI_GLOBAL_IDENTIFIER]
|
#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]
|
#define anon_identifier cp_global_trees[CPTI_ANON_IDENTIFIER]
|
||||||
/* auto and declspec(auto) identifiers. */
|
/* auto and declspec(auto) identifiers. */
|
||||||
#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
|
#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
|
||||||
@ -3335,9 +3333,7 @@ struct GTY(()) lang_decl {
|
|||||||
|
|
||||||
/* Nonzero if NODE is the std namespace. */
|
/* Nonzero if NODE is the std namespace. */
|
||||||
#define DECL_NAMESPACE_STD_P(NODE) \
|
#define DECL_NAMESPACE_STD_P(NODE) \
|
||||||
(TREE_CODE (NODE) == NAMESPACE_DECL \
|
((NODE) == std_node)
|
||||||
&& CP_DECL_CONTEXT (NODE) == global_namespace \
|
|
||||||
&& DECL_NAME (NODE) == std_identifier)
|
|
||||||
|
|
||||||
/* In a TREE_LIST in an attribute list, indicates that the attribute
|
/* In a TREE_LIST in an attribute list, indicates that the attribute
|
||||||
must be applied at instantiation time. */
|
must be applied at instantiation time. */
|
||||||
|
@ -4178,7 +4178,6 @@ initialize_predefined_identifiers (void)
|
|||||||
{"_vptr", &vptr_identifier, cik_normal},
|
{"_vptr", &vptr_identifier, cik_normal},
|
||||||
{"__vtt_parm", &vtt_parm_identifier, cik_normal},
|
{"__vtt_parm", &vtt_parm_identifier, cik_normal},
|
||||||
{"::", &global_identifier, cik_normal},
|
{"::", &global_identifier, cik_normal},
|
||||||
{"std", &std_identifier, cik_normal},
|
|
||||||
/* The demangler expects anonymous namespaces to be called
|
/* The demangler expects anonymous namespaces to be called
|
||||||
something starting with '_GLOBAL__N_'. It no longer needs
|
something starting with '_GLOBAL__N_'. It no longer needs
|
||||||
to be unique to the TU. */
|
to be unique to the TU. */
|
||||||
@ -4262,7 +4261,7 @@ cxx_init_decl_processing (void)
|
|||||||
current_lang_name = lang_name_c;
|
current_lang_name = lang_name_c;
|
||||||
|
|
||||||
/* Create the `std' namespace. */
|
/* Create the `std' namespace. */
|
||||||
push_namespace (std_identifier);
|
push_namespace (get_identifier ("std"));
|
||||||
std_node = current_namespace;
|
std_node = current_namespace;
|
||||||
pop_namespace ();
|
pop_namespace ();
|
||||||
|
|
||||||
@ -4392,14 +4391,14 @@ cxx_init_decl_processing (void)
|
|||||||
tree bad_alloc_type_node;
|
tree bad_alloc_type_node;
|
||||||
tree bad_alloc_decl;
|
tree bad_alloc_decl;
|
||||||
|
|
||||||
push_namespace (std_identifier);
|
push_nested_namespace (std_node);
|
||||||
bad_alloc_id = get_identifier ("bad_alloc");
|
bad_alloc_id = get_identifier ("bad_alloc");
|
||||||
bad_alloc_type_node = make_class_type (RECORD_TYPE);
|
bad_alloc_type_node = make_class_type (RECORD_TYPE);
|
||||||
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
|
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
|
||||||
bad_alloc_decl
|
bad_alloc_decl
|
||||||
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
|
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
|
||||||
DECL_CONTEXT (bad_alloc_decl) = current_namespace;
|
DECL_CONTEXT (bad_alloc_decl) = current_namespace;
|
||||||
pop_namespace ();
|
pop_nested_namespace (std_node);
|
||||||
|
|
||||||
new_eh_spec
|
new_eh_spec
|
||||||
= add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1);
|
= add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1);
|
||||||
@ -4451,11 +4450,11 @@ cxx_init_decl_processing (void)
|
|||||||
|
|
||||||
if (aligned_new_threshold)
|
if (aligned_new_threshold)
|
||||||
{
|
{
|
||||||
push_namespace (std_identifier);
|
push_nested_namespace (std_node);
|
||||||
tree align_id = get_identifier ("align_val_t");
|
tree align_id = get_identifier ("align_val_t");
|
||||||
align_type_node = start_enum (align_id, NULL_TREE, size_type_node,
|
align_type_node = start_enum (align_id, NULL_TREE, size_type_node,
|
||||||
NULL_TREE, /*scoped*/true, NULL);
|
NULL_TREE, /*scoped*/true, NULL);
|
||||||
pop_namespace ();
|
pop_nested_namespace (std_node);
|
||||||
|
|
||||||
/* operator new (size_t, align_val_t); */
|
/* operator new (size_t, align_val_t); */
|
||||||
newtype = build_function_type_list (ptr_type_node, size_type_node,
|
newtype = build_function_type_list (ptr_type_node, size_type_node,
|
||||||
@ -4663,10 +4662,10 @@ cxx_builtin_function (tree decl)
|
|||||||
{
|
{
|
||||||
tree std_decl = copy_decl (decl);
|
tree std_decl = copy_decl (decl);
|
||||||
|
|
||||||
push_namespace (std_identifier);
|
push_nested_namespace (std_node);
|
||||||
DECL_CONTEXT (std_decl) = FROB_CONTEXT (std_node);
|
DECL_CONTEXT (std_decl) = FROB_CONTEXT (std_node);
|
||||||
pushdecl (std_decl);
|
pushdecl (std_decl);
|
||||||
pop_namespace ();
|
pop_nested_namespace (std_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
|
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
|
||||||
|
@ -51,14 +51,14 @@ init_exception_processing (void)
|
|||||||
tree tmp;
|
tree tmp;
|
||||||
|
|
||||||
/* void std::terminate (); */
|
/* void std::terminate (); */
|
||||||
push_namespace (std_identifier);
|
push_nested_namespace (std_node);
|
||||||
tmp = build_function_type_list (void_type_node, NULL_TREE);
|
tmp = build_function_type_list (void_type_node, NULL_TREE);
|
||||||
terminate_fn = build_cp_library_fn_ptr ("terminate", tmp,
|
terminate_fn = build_cp_library_fn_ptr ("terminate", tmp,
|
||||||
ECF_NOTHROW | ECF_NORETURN
|
ECF_NOTHROW | ECF_NORETURN
|
||||||
| ECF_COLD);
|
| ECF_COLD);
|
||||||
gcc_checking_assert (TREE_THIS_VOLATILE (terminate_fn)
|
gcc_checking_assert (TREE_THIS_VOLATILE (terminate_fn)
|
||||||
&& TREE_NOTHROW (terminate_fn));
|
&& TREE_NOTHROW (terminate_fn));
|
||||||
pop_namespace ();
|
pop_nested_namespace (std_node);
|
||||||
|
|
||||||
/* void __cxa_call_unexpected(void *); */
|
/* void __cxa_call_unexpected(void *); */
|
||||||
tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
|
tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
|
||||||
|
@ -168,10 +168,10 @@ init_rtti_processing (void)
|
|||||||
{
|
{
|
||||||
tree type_info_type;
|
tree type_info_type;
|
||||||
|
|
||||||
push_namespace (std_identifier);
|
push_nested_namespace (std_node);
|
||||||
type_info_type = xref_tag (class_type, get_identifier ("type_info"),
|
type_info_type = xref_tag (class_type, get_identifier ("type_info"),
|
||||||
/*tag_scope=*/ts_current, false);
|
/*tag_scope=*/ts_current, false);
|
||||||
pop_namespace ();
|
pop_nested_namespace (std_node);
|
||||||
const_type_info_type_node
|
const_type_info_type_node
|
||||||
= cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST);
|
= cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST);
|
||||||
type_info_ptr_type = build_pointer_type (const_type_info_type_node);
|
type_info_ptr_type = build_pointer_type (const_type_info_type_node);
|
||||||
|
Loading…
Reference in New Issue
Block a user