From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111822 invoked by alias); 11 Jul 2015 13:19:02 -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 111807 invoked by uid 89); 11 Jul 2015 13:19:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 11 Jul 2015 13:19:00 +0000 Received: by wicmz13 with SMTP id mz13so31464600wic.0 for ; Sat, 11 Jul 2015 06:18:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=oZ8MjSEUX7dYbA2zYxsDQZQef9s0pU+zYbgrl/fuWGQ=; b=HbMreHjSjQgf3nc1gTCCF185RY3dG2eMFhQt/2+Db9NqkL1QqmjoVPwVWMAcSfNGC/ 3EYAGEkb86Kb114FlSYAYf2iTejO9aP/Ksu3aW2HJ3eSPk24ZQ1mJkETP8HjI5iH9ZHn fMPy1zmUoge2bfuQqHp7j46KuYI8oHfrwhZ4w737Sx3R7opgNPlfxO58aJRsURCTSaal 0WUP4CAdyMsFKfm0xsrGQsVunvVczi9fbnXLFzhcl8y+oyyrba6ENzKVQLb+wDN9N1fS 9AFHXmWANbjQuWef/T6RdEXEnlceV8blczjzkPTmjYdgauzCEb08nI8kvJW9jFsWMO26 swog== X-Gm-Message-State: ALoCoQkq7KhBR0RipObNxJvSGi3f+Pkj0Qy9jyn+QoDCsqO7L3kOf9uLCX66kK/0prXWJqeMJCvD X-Received: by 10.194.109.36 with SMTP id hp4mr52340334wjb.4.1436620737164; Sat, 11 Jul 2015 06:18:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.157.79 with HTTP; Sat, 11 Jul 2015 06:18:17 -0700 (PDT) In-Reply-To: <559BFB12.6050606@redhat.com> References: <1436213157-21480-1-git-send-email-simon.marchi@ericsson.com> <559BFB12.6050606@redhat.com> From: Doug Evans Date: Sat, 11 Jul 2015 13:19:00 -0000 Message-ID: Subject: Re: [PATCH] Remove CHECK_TYPEDEF, use check_typedef instead To: Pedro Alves Cc: Simon Marchi , gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00346.txt.bz2 On Tue, Jul 7, 2015 at 11:15 AM, Pedro Alves wrote: > ... > Or even rename it while at it: > > void > peel_typedefs (struct type **type) > { > *type = check_typedef (*type); > } > > And so you'd write: > > > - CHECK_TYPEDEF (result); > > + peel_typedefs (&result); > > Then the code ends up self documenting, and there's no way to > forget to assign the return of the function back to the > argument. Hi. If we get into renaming, it would be really nice to fix another problem with check_typedefs. Many don't know (or forget) that it actually serves (at least) two main purposes. The first is the obvious removal of typedefs. The second is the resolution of opaque types. Forgetting the second purpose has caused bugs in the past, and just makes the code harder to read than it should be. btw, a third potential use down the road is the completion of reading in of debug info for types being read in lazily. I know of at least one patch that looked at this, and check_typedefs is the obvious place to do this. I'm not advocating for a really_long_function_name_that_mentions_all_actions, just pointing out that the current situation is lacking. Something like "resolve_type" might work for me, but I haven't put too much time into it.