[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0908121748160.8540@pc-004.diku.dk>
Date: Wed, 12 Aug 2009 17:57:06 +0200 (CEST)
From: Julia Lawall <julia@...u.dk>
To: "Luis R. Rodriguez" <mcgrof@...il.com>
Cc: Nicolas Palix <npalix@...u.dk>, Joe Perches <joe@...ches.com>,
devel@...uxdriverproject.org, linux-kernel@...r.kernel.org,
yoann padioleau <yoann.padioleau@...il.com>
Subject: Re: Typedef removal tool
> BTW I was under the impression spatch wouldn't touch header files or
> dive in to untangle macros. Is that incorrect? Would the cocci files
> allow spatch to not only change typdef usages with simple struct uses
> but also redefine a typedef declaration to a simple struct definition
> through header files? For upstream work I don't expect as much macro
> mess as you would with typical vendor drivers. For drivers which do
> need to get ported I do expect an tangling web of macro mess one may
> need to put up with at times.
spatch looks at header files to a user-controllable degree: -no_includes
means ignore all #includes, -local_includes means consider include
files in the current directory, and -all_includes means consider all
direct #includes. There is no option to consider files that are included
by included files.
If a header file is included, then spatch is willing to generate patches
for transformations within the header file. An inconvenience is that
if a single header file is included multiple times, a patch will be
generated for it each time as well. In the worst case, these patches
might not even be consistent.
There is also an increasing effort to take into account macro definitions,
when they are available and useful. I don't know the exact current status
of that, however. Perhaps Yoann (in CC) can explain.
In the general case, there it is not possible to write a rule to change a
typedef to a simple structure declaration with the same name as the
typedef. The problem is that typedef declares something that is parsed as
a type and the name of a struct is an identifier. Spacth doesn't allow
you to put a type in a position where an identifier is expected.
Nicolas' code, however, gets around the problem by using python to
generate new semantic patches. In the new semantic patch, the typedef
name is just a constant, and thus parsed as convenient for the position in
which it appears (once as a type name and once as a struct name).
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists