From patchwork Wed Jun 19 14:35:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 33212 Received: (qmail 66495 invoked by alias); 19 Jun 2019 14:35:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 66484 invoked by uid 89); 19 Jun 2019 14:35:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jun 2019 14:35:09 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CA701AE1B; Wed, 19 Jun 2019 14:35:07 +0000 (UTC) Subject: Re: [PATCH][gdb] Fix build breaker with gcc 4.8 To: Pedro Alves , gdb-patches@sourceware.org References: <20190619110410.GA14131@delia> From: Tom de Vries Message-ID: <41c82ba8-202b-f02d-178f-901d7d69c60d@suse.de> Date: Wed, 19 Jun 2019 16:35:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 19-06-19 14:43, Pedro Alves wrote: > On 6/19/19 12:04 PM, Tom de Vries wrote: >> Hi, >> >> When compiling with gcc 4.8, we run into: >> ... >> /usr/include/c++/4.8/bits/unordered_map.h:100:18: required from \ >> ‘class std::unordered_map >’ >> src/gdb/dwarf2read.h:260:5: required from here >> /usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of \ >> incomplete type ‘struct std::hash’ >> ... >> >> Fix this by adding std::hash. >> >> Build and reg-tested on x86_64-linux with gcc 4.8. >> >> OK for trunk? >> > > hash_enum was added for this: > > https://sourceware.org/ml/gdb-patches/2017-12/msg00210.html > > Can you use it here? > > It's currently used in dwarf2read.c, here: > > std::unordered_map dwarf2_per_cu_data *, > gdb::hash_enum> > Yes, that works for me. OK for trunk? Thanks, - Tom [gdb] Fix build breaker with gcc 4.8 When compiling with gcc 4.8, we run into: ... /usr/include/c++/4.8/bits/unordered_map.h:100:18: required from \ ‘class std::unordered_map >’ src/gdb/dwarf2read.h:260:5: required from here /usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of \ incomplete type ‘struct std::hash’ ... Fix this by setting the Hash template parameter of the unordered_map to gdb::hash_enum, rather than using the default std::hash. Build and reg-tested on x86_64-linux with gcc 4.8. gdb/ChangeLog: 2019-06-19 Tom de Vries * dwarf2read.h (abstract_to_concrete): Change type to std::unordered_map, gdb::hash_enum>. --- gdb/dwarf2read.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h index 776860e454..7113cfd384 100644 --- a/gdb/dwarf2read.h +++ b/gdb/dwarf2read.h @@ -24,6 +24,7 @@ #include "dwarf-index-cache.h" #include "filename-seen-cache.h" #include "gdb_obstack.h" +#include "common/hash_enum.h" /* Hold 'maintenance (set|show) dwarf' commands. */ extern struct cmd_list_element *set_dwarf_cmdlist; @@ -256,7 +257,8 @@ public: /* Mapping from abstract origin DIE to concrete DIEs that reference it as DW_AT_abstract_origin. */ - std::unordered_map> + std::unordered_map, \ + gdb::hash_enum> \ abstract_to_concrete; };