]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Rename some structs to avoid ODR issues
authorOwen Avery <powerboat9.gamer@gmail.com>
Fri, 18 Aug 2023 20:37:46 +0000 (16:37 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:33 +0000 (19:00 +0100)
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 <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-tree.cc
gcc/rust/backend/rust-tree.h

index 6d4f344a20a3918583fcf48c5c5e04704f5025f8..faea66876f2fb7917035e2cd09ba7582c631cddd 100644 (file)
@@ -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<tree_node>
+struct rust_conv_type_hasher : ggc_ptr_hash<tree_node>
 {
   /* 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<tree_node>
   static bool equal (tree node, tree type) { return TREE_TYPE (node) == type; }
 };
 
-static GTY (()) hash_table<conv_type_hasher> *conv_type_names;
+static GTY (()) hash_table<rust_conv_type_hasher> *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<conv_type_hasher>::create_ggc (31);
+    conv_type_names = hash_table<rust_conv_type_hasher>::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<tree_node>
+struct rust_cplus_array_hasher : ggc_ptr_hash<tree_node>
 {
   typedef cplus_array_info *compare_type;
 
@@ -2262,7 +2262,7 @@ struct cplus_array_hasher : ggc_ptr_hash<tree_node>
 /* 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_hasher> *cplus_array_htab;
+static GTY (()) hash_table<rust_cplus_array_hasher> *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<cplus_array_hasher>::create_ggc (61);
+       cplus_array_htab = hash_table<rust_cplus_array_hasher>::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<source_location_table_entry>
 {
   typedef source_location_table_entry value_type;
@@ -4318,7 +4318,7 @@ struct source_location_table_entry_hash
 };
 
 static GTY (())
-  hash_table<source_location_table_entry_hash> *source_location_table;
+  hash_table<rust_source_location_table_entry_hash> *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<source_location_table_entry_hash>::create_ggc (64);
+      = hash_table<rust_source_location_table_entry_hash>::create_ggc (64);
   const line_map_ordinary *map;
   source_location_table_entry entry;
   entry.loc = linemap_resolve_location (line_table, loc,
index e1b44a1ee437851d2c20d13cb92c5b9cf91369c0..9a1cb74d6178e5dc1dfd6a6fea33ac06c9ec7737 100644 (file)
@@ -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<tree>
+struct rust_named_decl_hash : ggc_remove<tree>
 {
   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<cxx_saved_binding, va_gc> *old_bindings;
+  vec<rust_cxx_saved_binding, va_gc> *old_bindings;
   tree old_namespace;
   vec<tree, va_gc> *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<named_label_entry *>
+struct rust_named_label_hash : ggc_remove<named_label_entry *>
 {
   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<named_label_hash> *x_named_labels;
+  hash_table<rust_named_label_hash> *x_named_labels;
 
   /* Tracking possibly infinite loops.  This is a vec<tree> only because
      vec<bool> 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<named_decl_hash> *bindings;
+  hash_table<rust_named_decl_hash> *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<tree_pair_s, va_gc> *vcall_indices;
+  vec<rust_tree_pair_s, va_gc> *vcall_indices;
   tree vtables;
   tree typeinfo_var;
   vec<tree, va_gc> *vbases;