public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Fix GDB build with GCC 4.8.2
Date: Mon, 15 Mar 2021 11:32:29 -0600	[thread overview]
Message-ID: <20210315173229.3500896-1-tromey@adacore.com> (raw)

PR build/27579 points out that the expression rewrite series
introduced a build failure with GCC 4.8.2.  The bug is that there's no
std::hash specialization for enum exp_opcode.  This patch fixes the
problem by using gdb::hash_enum.

2021-03-15  Tom Tromey  <tromey@adacore.com>

	PR build/27579:
	* rust-exp.y (maker_map): Use gdb::hash_enum.
	* stap-probe.c (stap_maker_map): Use gdb::hash_enum.
---
 gdb/ChangeLog    | 6 ++++++
 gdb/rust-exp.y   | 4 +++-
 gdb/stap-probe.c | 4 +++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index 9a5bdd7a836..04003409887 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -43,6 +43,7 @@
 #include "gdbarch.h"
 #include "rust-exp.h"
 #include <unordered_map>
+#include "gdbsupport/hash_enum.h"
 
 #define GDB_YY_REMAP_PREFIX rust
 #include "yy-remap.h"
@@ -2202,7 +2203,8 @@ typedef expr::operation_up binop_maker_ftype (expr::operation_up &&,
 /* Map from an expression opcode to a function that will create an
    instance of the appropriate operation subclass.  Only binary
    operations are handled this way.  */
-static std::unordered_map<exp_opcode, binop_maker_ftype *> maker_map;
+static std::unordered_map<exp_opcode, binop_maker_ftype *,
+			  gdb::hash_enum<exp_opcode>> maker_map;
 
 /* Lower a rust_op to a gdb expression.  STATE is the parser state.
    OPERATION is the operation to lower.  TOP is a pointer to the
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 5995c2824dc..7f6d98a8ef2 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -38,6 +38,7 @@
 #include "elf-bfd.h"
 #include "expop.h"
 #include <unordered_map>
+#include "gdbsupport/hash_enum.h"
 
 #include <ctype.h>
 
@@ -436,7 +437,8 @@ typedef expr::operation_up binop_maker_ftype (expr::operation_up &&,
 					      expr::operation_up &&);
 /* Map from an expression opcode to a function that can create a
    binary operation of that type.  */
-static std::unordered_map<exp_opcode, binop_maker_ftype *> stap_maker_map;
+static std::unordered_map<exp_opcode, binop_maker_ftype *,
+			  gdb::hash_enum<exp_opcode>> stap_maker_map;
 
 /* Helper function to create a binary operation.  */
 static expr::operation_up
-- 
2.26.2


                 reply	other threads:[~2021-03-15 17:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315173229.3500896-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).