[Cocci] Why some changes are not done ?

Francois-Xavier Le Bail devel.fx.lebail at orange.fr
Fri Nov 24 11:12:55 CET 2017


Hi,

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)
)

on the this source:
https://raw.githubusercontent.com/the-tcpdump-group/tcpdump/6151e2190b0b40bdb6cf56354eb016284762d27b/print-tcp.c

Most of the changes are done (20).
But 2 old macro names are left.

$ git grep -n -E 'EXTRACT_[0-9]+' print-tcp.c
print-tcp.c:871:                tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
print-tcp.c:878:                len32 = htonl(EXTRACT_16BITS(&ip6->ip6_plen));

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

Did I miss something?
-- 
Francois-Xavier


More information about the Cocci mailing list