From patchwork Fri May 16 15:26:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 972 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id ECB4536006F for ; Fri, 16 May 2014 08:56:57 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id 8C35259EED96; Fri, 16 May 2014 08:56:57 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 4C3E859EED1D for ; Fri, 16 May 2014 08:56:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=GneiCmq5jSdUFr8rXjwOtczvAcDF9oc 1chvRaolQuKy6GegXVFrtG9QkP8pFfVl1rSOH8pGEQGHpYvpkyefXEmST2lrl7fQ WpxJbADYdT6Yg0eK22KNCiHxATqugVKPd7A3fMPiIDm+SMiLHJ04BiyAkXT6kRsA zfvbtQ1FLxSA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=Pf7Dtn1+dSrkQVlt+mTOAXgdzqc=; b=ekxSW 4gaGgYiP0XGY37h95VPnrLUBd381XjQvaq/GEJvz79pedlKWxitCYnq3sm/dH6Np W9pTZVmOEbntAecK59ryt3va4tPpyHbETg0wWauF2A9SL1Z0jgThviutYk9jHZQv kHEGhIzNU6KnbSzowfDHpSMRO0geToozTIFrn8= Received: (qmail 12755 invoked by alias); 16 May 2014 15:56:55 -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 12734 invoked by uid 89); 16 May 2014 15:56:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 May 2014 15:56:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQfrI019075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 16 May 2014 11:26:41 -0400 Received: from barimba.redhat.com (ovpn-113-182.phx2.redhat.com [10.3.113.182]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQcV6006849; Fri, 16 May 2014 11:26:41 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 04/14] add make_unqualified_type Date: Fri, 16 May 2014 09:26:25 -0600 Message-Id: <1400253995-12333-5-git-send-email-tromey@redhat.com> In-Reply-To: <1400253995-12333-1-git-send-email-tromey@redhat.com> References: <1400253995-12333-1-git-send-email-tromey@redhat.com> X-DH-Original-To: gdb@patchwork.siddhesh.in There's seemingly no function to get the unqualified variant of a type, so this patch adds one. This new function will be used in the final patch. 2014-05-16 Tom Tromey * gdbtypes.h (make_unqualified_type): Declare. * gdbtypes.c (make_unqualified_type): New function. --- gdb/ChangeLog | 5 +++++ gdb/gdbtypes.c | 13 +++++++++++++ gdb/gdbtypes.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8e6631a..8e59d15 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -706,6 +706,19 @@ make_restrict_type (struct type *type) NULL); } +/* Make a type without const, volatile, or restrict. */ + +struct type * +make_unqualified_type (struct type *type) +{ + return make_qualified_type (type, + (TYPE_INSTANCE_FLAGS (type) + & ~(TYPE_INSTANCE_FLAG_CONST + | TYPE_INSTANCE_FLAG_VOLATILE + | TYPE_INSTANCE_FLAG_RESTRICT)), + NULL); +} + /* Replace the contents of ntype with the type *type. This changes the contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus the changes are propogated to all types in the TYPE_CHAIN. diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 86b1d62..4f44e27 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1621,6 +1621,8 @@ extern struct type *make_cv_type (int, int, struct type *, struct type **); extern struct type *make_restrict_type (struct type *); +extern struct type *make_unqualified_type (struct type *); + extern void replace_type (struct type *, struct type *); extern int address_space_name_to_int (struct gdbarch *, char *);