From 8e2e7fa0211f49fe8f4c8b156468320ccfa711a0 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Fri, 18 Aug 2023 16:37:46 -0400 Subject: Rename some structs to avoid ODR issues gcc/rust/ChangeLog: * backend/rust-tree.cc (struct conv_type_hasher): Rename to ... (struct rust_conv_type_hasher): ... here. (struct cplus_array_hasher): Rename to ... (struct rust_cplus_array_hasher): ... here. (struct source_location_table_entry_hash): Rename to ... (struct rust_source_location_table_entry_hash): ... here. * backend/rust-tree.h (struct named_decl_hash): Rename to ... (struct rust_named_decl_hash): ... here. (struct cxx_saved_binding): Rename to ... (struct rust_cxx_saved_binding): ... here. (struct named_label_hash): Rename to ... (struct rust_named_label_hash): ... here. (struct tree_pair_s): Rename to ... (struct rust_tree_pair_s): ... here. (struct tree_pair_p): Rename to ... (struct rust_tree_pair_p): ... here. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-tree.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'gcc/rust/backend/rust-tree.cc') diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc index a276af8..c687f9d 100644 --- a/gcc/rust/backend/rust-tree.cc +++ b/gcc/rust/backend/rust-tree.cc @@ -1336,7 +1336,7 @@ struct find_parameter_pack_data // forked from gcc/cp/lex.cc conv_type_hasher /* Hasher for the conversion operator name hash table. */ -struct conv_type_hasher : ggc_ptr_hash +struct rust_conv_type_hasher : ggc_ptr_hash { /* Hash NODE, an identifier node in the table. TYPE_UID is suitable, as we're not concerned about matching canonicalness @@ -1351,7 +1351,7 @@ struct conv_type_hasher : ggc_ptr_hash static bool equal (tree node, tree type) { return TREE_TYPE (node) == type; } }; -static GTY (()) hash_table *conv_type_names; +static GTY (()) hash_table *conv_type_names; // forked from gcc/cp/lex.cc make_conv_op_name @@ -1370,7 +1370,7 @@ make_conv_op_name (tree type) return error_mark_node; if (conv_type_names == NULL) - conv_type_names = hash_table::create_ggc (31); + conv_type_names = hash_table::create_ggc (31); tree *slot = conv_type_names->find_slot_with_hash (type, (hashval_t) TYPE_UID (type), @@ -2253,7 +2253,7 @@ struct cplus_array_info // forked from gcc/cp/tree.cc cplus_array_hasher -struct cplus_array_hasher : ggc_ptr_hash +struct rust_cplus_array_hasher : ggc_ptr_hash { typedef cplus_array_info *compare_type; @@ -2264,7 +2264,7 @@ struct cplus_array_hasher : ggc_ptr_hash /* Hash an ARRAY_TYPE. K is really of type `tree'. */ hashval_t -cplus_array_hasher::hash (tree t) +rust_cplus_array_hasher::hash (tree t) { hashval_t hash; @@ -2278,7 +2278,7 @@ cplus_array_hasher::hash (tree t) of type `cplus_array_info*'. */ bool -cplus_array_hasher::equal (tree t1, cplus_array_info *t2) +rust_cplus_array_hasher::equal (tree t1, cplus_array_info *t2) { return (TREE_TYPE (t1) == t2->type && TYPE_DOMAIN (t1) == t2->domain); } @@ -2287,7 +2287,7 @@ cplus_array_hasher::equal (tree t1, cplus_array_info *t2) /* Hash table containing dependent array types, which are unsuitable for the language-independent type hash table. */ -static GTY (()) hash_table *cplus_array_htab; +static GTY (()) hash_table *cplus_array_htab; // forked from gcc/cp/tree.cc is_byte_access_type @@ -2334,7 +2334,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) hashval_t hash; if (cplus_array_htab == NULL) - cplus_array_htab = hash_table::create_ggc (61); + cplus_array_htab = hash_table::create_ggc (61); hash = TYPE_UID (elt_type); if (index_type) @@ -4262,7 +4262,7 @@ namespace Rust { /* Traits class for function start hash maps below. */ -struct source_location_table_entry_hash +struct rust_source_location_table_entry_hash : ggc_remove { typedef source_location_table_entry value_type; @@ -4320,7 +4320,7 @@ struct source_location_table_entry_hash }; static GTY (()) - hash_table *source_location_table; + hash_table *source_location_table; static GTY (()) unsigned int source_location_id; // Above is forked from gcc/cp/cp-gimplify.cc @@ -4763,7 +4763,7 @@ fold_builtin_source_location (location_t loc) return build_zero_cst (const_ptr_type_node); if (source_location_table == NULL) source_location_table - = hash_table::create_ggc (64); + = hash_table::create_ggc (64); const line_map_ordinary *map; source_location_table_entry entry; entry.loc = linemap_resolve_location (line_table, loc, -- cgit v1.1