From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 7 16:26:50 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D72D16A4CE for ; Mon, 7 Feb 2005 16:26:50 +0000 (GMT) Received: from hydra.bec.de (www.ostsee-abc.de [62.206.222.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id C9B1643D2D for ; Mon, 7 Feb 2005 16:26:49 +0000 (GMT) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (unknown [139.30.252.67]) by hydra.bec.de (Postfix) with ESMTP id 60DF735707 for ; Mon, 7 Feb 2005 17:26:43 +0100 (CET) Received: by britannica.bec.de (Postfix, from userid 1001) id 021E3A0; Mon, 7 Feb 2005 17:25:46 +0100 (CET) Date: Mon, 7 Feb 2005 17:25:46 +0100 From: Joerg Sonnenberger To: hackers@freebsd.org Message-ID: <20050207162546.GA41246@britannica.bec.de> Mail-Followup-To: hackers@freebsd.org References: <20050207161012.GA23177@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050207161012.GA23177@odin.ac.hmc.edu> User-Agent: Mutt/1.5.6i Subject: Re: finding casts from a type X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2005 16:26:50 -0000 On Mon, Feb 07, 2005 at 08:10:13AM -0800, Brooks Davis wrote: > I'm trying to figure out an efficent way to find all the places where a > given type (in my case struct ifnet *) is cast to another. Does anyone > know of a tool to do this? I need to include implicit casts to (void > *). I could do it by hand, but this is would be tedious and error prone > given that there are over 330 files that refrence struct ifnet in the > kernel. The ideal solution would be a pragma or something to cause > gcc to generate a warning since once I move struct ifnet out of driver > softc's all casts will be bugs. Initially I need to catch (void *) > casts, but that probably won't be necessicary long term. What about using preprocessor / sed magic to convert struct ifnet to volatile struct ifnet? The few places where this is correctly casted away should be easy to find. Joerg