From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1770 invoked by alias); 19 Jun 2019 11:04:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 1759 invoked by uid 89); 19 Jun 2019 11:04:16 -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=reg-tested, hangs, HContent-Transfer-Encoding:8bit 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 11:04:15 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4D143AE1B for ; Wed, 19 Jun 2019 11:04:13 +0000 (UTC) Date: Wed, 19 Jun 2019 11:04:00 -0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb] Fix build breaker with gcc 4.8 Message-ID: <20190619110410.GA14131@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00369.txt.bz2 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? Thanks, - Tom [gdb] Fix build breaker with gcc 4.8 gdb/ChangeLog: 2019-06-19 Tom de Vries * dwarf2read.h (std::hash): New specialization. --- gdb/dwarf2read.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h index 776860e454..494dcb32c1 100644 --- a/gdb/dwarf2read.h +++ b/gdb/dwarf2read.h @@ -99,6 +99,26 @@ struct signatured_type; struct die_info; typedef struct die_info *die_info_ptr; +/* An std::hash specialization, required for use of sect_offset in + std::unordered_map with gcc 4.8. */ + +namespace std +{ + template<> struct hash + { + typedef sect_offset argument_type; + typedef std::size_t result_type; + using underlying_type + = typename std::underlying_type::type; + + result_type operator() (const argument_type &o) const noexcept + { + underlying_type u = static_cast (o); + return std::hash {} (u); + } + }; +}; + /* Collection of data recorded per objfile. This hangs off of dwarf2_objfile_data_key. */