From patchwork Thu Aug 30 14:43:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 29128 Received: (qmail 122227 invoked by alias); 30 Aug 2018 14:43:30 -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 122124 invoked by uid 89); 30 Aug 2018 14:43:29 -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: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Aug 2018 14:43:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1535640205; 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=G+LhPiK5jQ0hrQdggzMNrl57QB4d8JCw+oyrpAB5+tI=; b=Y5WJDNuciSvMNEdINMdlRNLV9QxeCLqwKq+kw9cSkUEvLKX9OHXuoIWSNdaNRB0K 3k4RBuoBB0xb2vMsstx/iiW/Ik7/JZXq0chCRSPraUMS0yWq/aHMYPGxHl1lsCKm SplfVdtu0/MjIDCdDFg76vMD5Vi1sIMgshXrmpaVBXM=; Received: from ESESBMB501.ericsson.se (Unknown_Domain [153.88.183.114]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id F8.C0.22015.D82088B5; Thu, 30 Aug 2018 16:43:25 +0200 (CEST) Received: from ESESBMB505.ericsson.se (153.88.183.172) 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 16:43:21 +0200 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB505.ericsson.se (153.88.183.172) 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 16:43:21 +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=WyKnYNnS/tYo/I1gae162SvUBAjPthmNnrw/gNNczdo=; b=G8Y/mcXynX5y4M9UXViUMxQkb29i8h2BYkDMMPp4bXzATUuql3JSWN54z5C2VdEHH5h5QbBTvysnyWF69vojtgLoOJG6Uhgh2jR9MeIP2ZVD2RqNAJhf5gBKxSwIRfNoI/XllQX5IdYQEFEXt2f14Ys2GkT6zME2NGag5X9ffDw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.lan (192.222.164.54) by BYAPR15MB2391.namprd15.prod.outlook.com (2603:10b6:a02:8c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Thu, 30 Aug 2018 14:43:15 +0000 From: Simon Marchi To: CC: Keith Seitz , Simon Marchi Subject: [PATCH] Fix compile-cplus-types.c build errors Date: Thu, 30 Aug 2018 10:43:04 -0400 Message-Id: <1535640184-20543-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes 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:262:61: 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, "entering new scope %p\n", new_scope); ~~ ^~~~~~~~~ /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 two by taking the address of the object. Fix the third 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::enter_scope): Take the address of scope object. (compile_cplus_instance::leave_scope): Likewise. (compile_cplus_instance::convert_qualified_base): Compare quals to 0. --- gdb/compile/compile-cplus-types.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 9425fc6..844c8ce 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -259,7 +259,7 @@ compile_cplus_instance::enter_scope (compile_scope &new_scope) if (must_push) { if (debug_compile_cplus_scopes) - fprintf_unfiltered (gdb_stdlog, "entering new scope %p\n", new_scope); + fprintf_unfiltered (gdb_stdlog, "entering new scope %p\n", &new_scope); /* Push the global namespace. */ plugin ().push_namespace (""); @@ -303,7 +303,7 @@ 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 %p\n", ¤t); /* Pop namespaces. */ std::for_each @@ -1055,7 +1055,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;