[pushed] Fix build failure with GCC 4.8

Message ID 20230915162312.2872477-1-tromey@adacore.com
State New
Headers
Series [pushed] Fix build failure with GCC 4.8 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged

Commit Message

Tom Tromey Sept. 15, 2023, 4:23 p.m. UTC
  A user pointed out that the build failed with GCC 4.8.  The problem
was that the form used by the std::hash specialization of ptid_t was
not accepted.  This patch rewrites this code into a form that is
acceptable to the older compiler.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
 gdbsupport/ptid.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdbsupport/ptid.h b/gdbsupport/ptid.h
index f8644d47633..96c7d9c8bfd 100644
--- a/gdbsupport/ptid.h
+++ b/gdbsupport/ptid.h
@@ -157,8 +157,10 @@  class ptid_t
   tid_type m_tid;
 };
 
+namespace std
+{
 template<>
-struct std::hash<ptid_t>
+struct hash<ptid_t>
 {
   size_t operator() (const ptid_t &ptid) const
   {
@@ -169,6 +171,7 @@  struct std::hash<ptid_t>
 	    + long_hash (ptid.tid ()));
   }
 };
+}
 
 /* The null or zero ptid, often used to indicate no process. */