1 // Use the macro ARRAY_SIZE when possible
4 // Copyright: (C) Gilles Muller, Julia Lawall, EMN, INRIA, DIKU. GPLv2.
5 // URL: http://coccinelle.lip6.fr/rules/array.html
6 // Options: -I ... -all_includes can give more complete results
13 #include <linux/kernel.h>
15 /////////////////////////////////////
16 /////////////////////////////////////
17 @depends on i && patch && !org@
22 - (sizeof(E)/sizeof(*E))
25 @depends on i && patch && !org@
30 - (sizeof(E)/sizeof(E[...]))
33 @depends on i && patch && !org@
38 - (sizeof(E)/sizeof(T))
41 @n_patch depends on patch && !org@
45 - #define AS(E) ARRAY_SIZE(E)
47 @ depends on patch && !org@
49 identifier n_patch.AS;
56 /////////////////////////////////////
57 /////////////////////////////////////
58 @arr_ptr depends on i && !patch && org@
64 (sizeof(E@p)/sizeof(*E))
66 @arr_tab depends on i && !patch && org@
72 (sizeof(E@p)/sizeof(E[...]))
74 @arr_typ depends on i && !patch && org@
80 (sizeof(E@p)/sizeof(T))
82 @n_org depends on !patch && org@
86 #define AS(E) ARRAY_SIZE(E)
88 @arr_def depends on !patch && org@
100 cocci.print_main(e,p)
106 cocci.print_main(e,p)
112 cocci.print_main(e,p)
118 cocci.print_main(e,p)