From: Tom Tromey Date: Mon, 15 Mar 2021 14:59:17 +0000 (-0600) Subject: Fix GDB build with GCC 4.8.2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=675da9a57e0ab1c384e0dfd20ddf715a83c18673;p=binutils-gdb.git Fix GDB build with GCC 4.8.2 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 PR build/27579: * rust-exp.y (maker_map): Use gdb::hash_enum. * stap-probe.c (stap_maker_map): Use gdb::hash_enum. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2315d5bc6ea..0ac6b29443e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-03-15 Tom Tromey + + PR build/27579: + * rust-exp.y (maker_map): Use gdb::hash_enum. + * stap-probe.c (stap_maker_map): Use gdb::hash_enum. + 2021-03-15 Simon Marchi * dwarf2/read.c (create_debug_type_hash_table): Remove colon at 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 +#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 maker_map; +static std::unordered_map> 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 +#include "gdbsupport/hash_enum.h" #include @@ -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 stap_maker_map; +static std::unordered_map> stap_maker_map; /* Helper function to create a binary operation. */ static expr::operation_up