From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3683 invoked by alias); 15 Jul 2011 18:28:04 -0000 Received: (qmail 3675 invoked by uid 22791); 15 Jul 2011 18:28:03 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GD X-Spam-Check-By: sourceware.org Received: from mail-ew0-f41.google.com (HELO mail-ew0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Jul 2011 18:27:47 +0000 Received: by ewy9 with SMTP id 9so937580ewy.0 for ; Fri, 15 Jul 2011 11:27:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.43.27 with SMTP id k27mr1367106eeb.59.1310754466537; Fri, 15 Jul 2011 11:27:46 -0700 (PDT) Received: by 10.14.127.208 with HTTP; Fri, 15 Jul 2011 11:27:46 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 Jul 2011 18:50:00 -0000 Message-ID: Subject: Re: [1/4] RFC: skip DIEs which only declare an enum From: Daniel Jacobowitz To: Tom Tromey Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-07/txt/msg00398.txt.bz2 On Fri, Jul 15, 2011 at 2:06 PM, Tom Tromey wrote: > With -gdwarf-4: > > -PASS: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42 > -PASS: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42 > +FAIL: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42 > +FAIL: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42 > > What happens here is that gcc emits multiple .debug_type CUs. =A0While > reading one such CU, we see an empty declaration for PrivEnum. =A0This > gets turned into a symbol, and later we end up with an incomplete type. > > This patch fixes the problem by simply skipping declaration-only enums. > This makes it so only the full definition is put into the symbol table, > letting check_typedef work. > > This is one of the patches I am less sure about. =A0Is it really safe? = =A0It > also may change the error a user sees in some obscure case -- but to my > mind there is not much practical difference between "type not found" and > "type found but useless". Generally speaking, I agree with your sentiment. Can't you forward-declare enums in the latest C++ draft, though? If the declaration is all we have, something like (enum X) 42 is more useful than (both examples made up; I don't know what we print. We ought to be able to resolve the incomplete type if we have both. But I know that doesn't always work right. --=20 Thanks, Daniel