From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1043 invoked by alias); 21 Dec 2009 10:00:14 -0000 Received: (qmail 1035 invoked by uid 22791); 21 Dec 2009 10:00:13 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Dec 2009 10:00:08 +0000 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NMf3c-0001WW-OC for gdb-patches@sources.redhat.com; Mon, 21 Dec 2009 11:00:04 +0100 Received: from h86-62-88-129.ln.rinet.ru ([86.62.88.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Dec 2009 11:00:04 +0100 Received: from vladimir by h86-62-88-129.ln.rinet.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Dec 2009 11:00:04 +0100 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: RFA: unbreak typedefed bitfield Followup-To: gmane.comp.gdb.patches Date: Mon, 21 Dec 2009 10:00:00 -0000 Message-ID: References: <200912181541.30891.vladimir@codesourcery.com> <20091218130612.GD2788@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit User-Agent: KNode/4.3.2 X-IsSubscribed: yes 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 X-SW-Source: 2009-12/txt/msg00296.txt.bz2 Tom Tromey wrote: >>>>>> "Joel" == Joel Brobecker writes: > > Joel> I have a general feeling that most of the time, the typedef should > Joel> have never been passed down. But I haven't spent the time and > Joel> effort to try to think globally. > > There are definitely cases where we want to preserve the type that the > user wrote. > > In C, this matters for printing various character types. E.g., both > wchar_t and char32_t may be typedefs of int, but we want to print them > differently if they use different encodings. > > This preservation has to be pervasive, because of things like: > > print (wchar_t) 32 > > This example doesn't work today, but probably should. > > > I agree that check_typedef is a problem. > > Perhaps we could approach the check_typedef problem using a semantic > analyzer to ensure correct use. There are other idioms in gdb that also > require careful attention that would benefit from this; cleanups and > proper use of TRY_CATCH come to mind, but there are probably others. > > Another approach would be to change TYPE_LENGTH to first call > check_typedef. It seems to me that TYPE_LENGTH may return different values before and after check_typedef is called. Is the 'before' value ever or any use? If no, and as you say above in some cases we need to preserve some properties of the typedef, why TYPE_LENGTH could not check if the type is typedef, and if so, return length of the true type? - Volodya