From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14275 invoked by alias); 30 Aug 2018 15:13:54 -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 14131 invoked by uid 89); 30 Aug 2018 15:13:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Aug 2018 15:13:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1535642028; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=G8N5mR8hsonV521QCyeqRqbBkLaNEpvIIAuhXVXjlQ8=; b=OzRFk9THXNit7cw//pSgLQ8J3KEpKbQUS+sRtQGlwYOjG1vGQnRC2/+L/d0gTyag 65sCCMVJ9bWUosFOydTPQymyCF3geWNV6EHwFxyJGAHua/4NtPpRcBAX6pT7VNPK TlPC9WKsRl+4OhzCYGrzvL7AseKg0MCOR/tJKQVGAck=; Received: from ESESBMB501.ericsson.se (Unknown_Domain [153.88.183.114]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id FF.64.21978.CA9088B5; Thu, 30 Aug 2018 17:13:48 +0200 (CEST) Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 30 Aug 2018 17:13:47 +0200 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Thu, 30 Aug 2018 17:13:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=My4Crl1kz4X9ZBWevcLb9JycVrQq+VcgoDcYCfet6bw=; b=kHRRIzttSd8Qhk/nlpKJOLK/Y2RmNT8AhaV2tKvc6khf9TIU1o39UgKanUIfdUq4HdzTNZLBxhHd565ZIoE4zkYVj62QSWoQIkKfojg+0I9beIZB9sThE++38uf7AVFjK5OQmYqQ+g+eDEVozW6k8FNHx3XWvigAp89ZNI1Wysw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [10.0.0.110] (192.222.164.54) by DM6PR15MB2393.namprd15.prod.outlook.com (2603:10b6:5:8d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Thu, 30 Aug 2018 15:13:45 +0000 Subject: Re: [PATCH] Fix compile-cplus-types.c build errors To: Tom Tromey CC: , Keith Seitz , Joel Brobecker References: <1535640184-20543-1-git-send-email-simon.marchi@ericsson.com> <87sh2v3ndq.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Thu, 30 Aug 2018 15:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87sh2v3ndq.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00831.txt.bz2 On 2018-08-30 11:06 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Fix the third one by comparing to 0 instead. I think the current > Simon> comparison simply uses the wrong enum type. Comparing to 0 seems like > Simon> the right thing to do, because we want to check whether any flags are > Simon> specified. > > I think this is fine, but at the same time, it seems reasonable to me to > want to compare an enum flags object against an enumerator from the > underlying type. So maybe enum_flags should have operator== and operator!=. > > What do you think of this? I am trying to think of a counter-example > where this would cause problems. I think this is already possible (but I have not tested). In this case, it's actually comparing against an enumerator from a completely different enum type. Here's what I pushed. Keith has already fixed the first error, this fixes the others. @Joel, I used host_address_to_string. >From a0dc02a6df86011462293cc11b4e35c0f18effd0 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 30 Aug 2018 11:09:48 -0400 Subject: [PATCH] Fix compile-cplus-types.c build errors I see these errors when building with clang: CXX compile/compile-cplus-types.o /home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs] fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current); ~~ ^~~~~~~ /home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare] if (quals != GCC_CP_REF_QUAL_NONE) ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~ Fix the first one by using host_address_to_string. Fix the second one by comparing to 0 instead. I think the current comparison simply uses the wrong enum type. Comparing to 0 seems like the right thing to do, because we want to check whether any flags are specified. gdb/ChangeLog: * compile/compile-cplus-types.c (compile_cplus_instance::leave_scope): Take the address of scope object. (compile_cplus_instance::convert_qualified_base): Compare quals to 0. --- gdb/ChangeLog | 8 ++++++++ gdb/compile/compile-cplus-types.c | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2e59caf..66c2e33 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2018-08-30 Simon Marchi + + * compile/compile-cplus-types.c + (compile_cplus_instance::leave_scope): Take the address of scope + object. + (compile_cplus_instance::convert_qualified_base): Compare quals + to 0. + 2018-08-30 Keith Seitz * compile/compile-cplus-types.c (compile_cplus_instance::enter_scope): diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index e86a573..7fc4136 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -306,7 +306,10 @@ compile_cplus_instance::leave_scope () if (current.m_pushed) { if (debug_compile_cplus_scopes) - fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current); + { + fprintf_unfiltered (gdb_stdlog, "leaving scope %s\n", + host_address_to_string (¤t)); + } /* Pop namespaces. */ std::for_each @@ -1058,7 +1061,7 @@ compile_cplus_instance::convert_qualified_base (gcc_type base, { gcc_type result = base; - if (quals != GCC_CP_REF_QUAL_NONE) + if (quals != 0) result = plugin ().build_qualified_type (base, quals); return result; -- 2.7.4