From: Owen Avery Date: Fri, 18 Aug 2023 20:37:46 +0000 (-0400) Subject: gccrs: Rename some structs to avoid ODR issues X-Git-Tag: basepoints/gcc-15~2198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34b0de57741bf3fec3bd013b71b761249095d8e8;p=thirdparty%2Fgcc.git gccrs: 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 --- diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc index 6d4f344a20a3..faea66876f2f 100644 --- a/gcc/rust/backend/rust-tree.cc +++ b/gcc/rust/backend/rust-tree.cc @@ -1334,7 +1334,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 @@ -1349,7 +1349,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 @@ -1368,7 +1368,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), @@ -2251,7 +2251,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; @@ -2262,7 +2262,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; @@ -2276,7 +2276,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); } @@ -2285,7 +2285,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 @@ -2332,7 +2332,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) @@ -4260,7 +4260,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; @@ -4318,7 +4318,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 @@ -4760,7 +4760,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, diff --git a/gcc/rust/backend/rust-tree.h b/gcc/rust/backend/rust-tree.h index e1b44a1ee437..9a1cb74d6178 100644 --- a/gcc/rust/backend/rust-tree.h +++ b/gcc/rust/backend/rust-tree.h @@ -1944,7 +1944,7 @@ typedef struct ptrmem_cst *ptrmem_cst_t; /* hash traits for declarations. Hashes potential overload sets via DECL_NAME. */ -struct named_decl_hash : ggc_remove +struct rust_named_decl_hash : ggc_remove { typedef tree value_type; /* A DECL or OVERLOAD */ typedef tree compare_type; /* An identifier. */ @@ -2060,7 +2060,7 @@ struct GTY (()) cxx_binding /* Datatype used to temporarily save C++ bindings (for implicit instantiations purposes and like). Implemented in decl.cc. */ -struct GTY (()) cxx_saved_binding +struct GTY (()) rust_cxx_saved_binding { /* The name of the current binding. */ tree identifier; @@ -2075,7 +2075,7 @@ struct GTY (()) cxx_saved_binding struct GTY (()) saved_scope { - vec *old_bindings; + vec *old_bindings; tree old_namespace; vec *decl_ns_list; tree class_name; @@ -2123,7 +2123,7 @@ extern GTY (()) struct saved_scope *scope_chain; struct named_label_entry; /* Defined in decl.cc. */ -struct named_label_hash : ggc_remove +struct rust_named_label_hash : ggc_remove { typedef named_label_entry *value_type; typedef tree compare_type; /* An identifier. */ @@ -2169,7 +2169,7 @@ struct GTY (()) language_function BOOL_BITFIELD invalid_constexpr : 1; BOOL_BITFIELD throwing_cleanup : 1; - hash_table *x_named_labels; + hash_table *x_named_labels; /* Tracking possibly infinite loops. This is a vec only because vec doesn't work with gtype. */ @@ -2294,7 +2294,7 @@ struct GTY (()) lang_decl_ns /* Hash table of bound decls. It'd be nice to have this inline, but as the hash_map has a dtor, we can't then put this struct into a union (until moving to c++11). */ - hash_table *bindings; + hash_table *bindings; }; // forked from gcc/cp/cp-tree.h lang_decl_parm @@ -2504,7 +2504,7 @@ public: // forked from gcc/cp/cp-tree.h treee_pair_s -struct GTY (()) tree_pair_s +struct GTY (()) rust_tree_pair_s { tree purpose; tree value; @@ -2512,7 +2512,7 @@ struct GTY (()) tree_pair_s // forked from gcc/cp/cp-tree.h tree_pair_p -typedef tree_pair_s *tree_pair_p; +typedef rust_tree_pair_s *rust_tree_pair_p; // forked from gcc/cp/cp-tree.h lang_type @@ -2602,7 +2602,7 @@ struct GTY (()) lang_type unsigned dummy : 3; tree primary_base; - vec *vcall_indices; + vec *vcall_indices; tree vtables; tree typeinfo_var; vec *vbases;