[Cocci] Why some changes are not done ?
julia.lawall at lip6.fr
Fri Nov 24 12:00:11 CET 2017
On Fri, 24 Nov 2017, Francois-Xavier Le Bail wrote:
> On 24/11/2017 11:23, Julia Lawall wrote:
> > On Fri, 24 Nov 2017, Francois-Xavier Le Bail wrote:
> >> I use the following Coccinelle script to rename some macros:
> >> @@
> >> expression E;
> >> @@
> >> (
> >> -EXTRACT_16BITS(E)
> >> +EXTRACT_BE_16BITS(E)
> >> |
> >> -EXTRACT_32BITS(E)
> >> +EXTRACT_BE_32BITS(E)
> >> )
> >> [...]>> It seems that the problem is link to macro USES_APPLE_DEPRECATED_API on line 835.
> >> If I comment this macro, the changes are done.
> >> On Apple systems:
> >> #define USES_APPLE_DEPRECATED_API DIAG_OFF(deprecated-declarations)
> >> On other systems (like the one I use):
> >> #define USES_APPLE_DEPRECATED_API
> > Just make a file macros.h and put in it
> > #define USES_APPLE_DEPRECATED_API
> > Then run spatch with --macro-file macros.h (or if that doesn't work then
> > --macro-file-builtins macros.h). Then it will ignore this code.
> It works with '--macro-file macros.h', Thanks you !
> Is there a way to have changes done also in macro definitions?
> #define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp)))
Normally changes should happen in macro definitions as well, but there may
be a problem in parsing it due to some confusion about the parsing of a
preceding macro. You can run spatch --parse-c file.c to see where there
are parsing issues.
More information about the Cocci