]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR other/100463 - many errors using GTY and hash_map
authorMartin Sebor <msebor@redhat.com>
Thu, 27 May 2021 19:37:43 +0000 (13:37 -0600)
committerMartin Sebor <msebor@redhat.com>
Thu, 27 May 2021 19:37:43 +0000 (13:37 -0600)
gcc/ChangeLog:
* ggc.h (gt_ggc_mx): Add overloads for all integers.
(gt_pch_nx):  Same.
* hash-map.h (class hash_map): Add pch_nx_helper overloads for all
integers.
(hash_map::operator==): New function.

gcc/ggc.h
gcc/hash-map.h

index 65f6cb4d19dfe4ec60a180c7a796e03fba12ad3a..92884717f5c72435f6febcb06f926b7a7261e569 100644 (file)
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -332,19 +332,30 @@ gt_pch_nx (const char *)
 {
 }
 
-inline void
-gt_ggc_mx (int)
-{
-}
-
-inline void
-gt_pch_nx (int)
-{
-}
-
-inline void
-gt_pch_nx (unsigned int)
-{
-}
+inline void gt_pch_nx (bool) { }
+inline void gt_pch_nx (char) { }
+inline void gt_pch_nx (signed char) { }
+inline void gt_pch_nx (unsigned char) { }
+inline void gt_pch_nx (short) { }
+inline void gt_pch_nx (unsigned short) { }
+inline void gt_pch_nx (int) { }
+inline void gt_pch_nx (unsigned int) { }
+inline void gt_pch_nx (long int) { }
+inline void gt_pch_nx (unsigned long int) { }
+inline void gt_pch_nx (long long int) { }
+inline void gt_pch_nx (unsigned long long int) { }
+
+inline void gt_ggc_mx (bool) { }
+inline void gt_ggc_mx (char) { }
+inline void gt_ggc_mx (signed char) { }
+inline void gt_ggc_mx (unsigned char) { }
+inline void gt_ggc_mx (short) { }
+inline void gt_ggc_mx (unsigned short) { }
+inline void gt_ggc_mx (int) { }
+inline void gt_ggc_mx (unsigned int) { }
+inline void gt_ggc_mx (long int) { }
+inline void gt_ggc_mx (unsigned long int) { }
+inline void gt_ggc_mx (long long int) { }
+inline void gt_ggc_mx (unsigned long long int) { }
 
 #endif
index 0779c930f0a7fd1e376aabccc4c0e9a8ba76e8f4..dd039f10343567556d73e5077d97a0e175081c25 100644 (file)
@@ -107,27 +107,31 @@ class GTY((user)) hash_map
          gt_pch_nx (&x, op, cookie);
        }
 
-    static void
-      pch_nx_helper (int, gt_pointer_operator, void *)
-       {
-       }
-
-    static void
-      pch_nx_helper (unsigned int, gt_pointer_operator, void *)
-       {
-       }
-
-    static void
-      pch_nx_helper (bool, gt_pointer_operator, void *)
-       {
-       }
-
     template<typename T>
       static void
       pch_nx_helper (T *&x, gt_pointer_operator op, void *cookie)
        {
          op (&x, cookie);
        }
+
+    /* The overloads below should match those in ggc.h.  */
+#define DEFINE_PCH_HELPER(T)                   \
+    static void pch_nx_helper (T, gt_pointer_operator, void *) { }
+
+    DEFINE_PCH_HELPER (bool);
+    DEFINE_PCH_HELPER (char);
+    DEFINE_PCH_HELPER (signed char);
+    DEFINE_PCH_HELPER (unsigned char);
+    DEFINE_PCH_HELPER (short);
+    DEFINE_PCH_HELPER (unsigned short);
+    DEFINE_PCH_HELPER (int);
+    DEFINE_PCH_HELPER (unsigned int);
+    DEFINE_PCH_HELPER (long);
+    DEFINE_PCH_HELPER (unsigned long);
+    DEFINE_PCH_HELPER (long long);
+    DEFINE_PCH_HELPER (unsigned long long);
+
+#undef DEFINE_PCH_HELPER
   };
 
 public:
@@ -273,8 +277,12 @@ public:
       return reference_pair (e.m_key, e.m_value);
     }
 
-    bool
-    operator != (const iterator &other) const
+    bool operator== (const iterator &other) const
+    {
+      return m_iter == other.m_iter;
+    }
+
+    bool operator != (const iterator &other) const
     {
       return m_iter != other.m_iter;
     }