finding casts from a type

Joerg Sonnenberger joerg at britannica.bec.de
Mon Feb 7 08:26:50 PST 2005


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


More information about the freebsd-hackers mailing list