GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / scripts / coccinelle / resource_size.cocci
blob1935a58b39d931a7f82567319ff7e40cabefaee4
1 ///
2 /// Use resource_size function on resource object
3 /// instead of explicit computation.
4 ///
5 //  Confidence: High
6 //  Copyright: (C) 2009, 2010 Nicolas Palix, DIKU.  GPLv2.
7 //  Copyright: (C) 2009, 2010 Julia Lawall, DIKU.  GPLv2.
8 //  Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6.  GPLv2.
9 //  URL: http://coccinelle.lip6.fr/
10 //  Options:
12 //  Keywords: resource_size
13 //  Version min: 2.6.27 resource_size
16 virtual context
17 virtual patch
18 virtual org
19 virtual report
21 //----------------------------------------------------------
22 //  For context mode
23 //----------------------------------------------------------
25 @r_context depends on context && !patch && !org@
26 struct resource *res;
29 * (res->end - res->start) + 1
31 //----------------------------------------------------------
32 //  For patch mode
33 //----------------------------------------------------------
35 @r_patch depends on !context && patch && !org@
36 struct resource *res;
39 - (res->end - res->start) + 1
40 + resource_size(res)
42 //----------------------------------------------------------
43 //  For org mode
44 //----------------------------------------------------------
47 @r_org depends on !context && !patch && (org || report)@
48 struct resource *res;
49 position p;
52  (res->end@p - res->start) + 1
54 @rbad_org depends on !context && !patch && (org || report)@
55 struct resource *res;
56 position p != r_org.p;
59  res->end@p - res->start
61 @script:python depends on org@
62 p << r_org.p;
63 x << r_org.res;
66 msg="ERROR with %s" % (x)
67 msg_safe=msg.replace("[","@(").replace("]",")")
68 coccilib.org.print_todo(p[0], msg_safe)
70 @script:python depends on report@
71 p << r_org.p;
72 x << r_org.res;
75 msg="ERROR: Missing resource_size with %s" % (x)
76 coccilib.report.print_report(p[0], msg)
78 @script:python depends on org@
79 p << rbad_org.p;
80 x << rbad_org.res;
83 msg="WARNING with %s" % (x)
84 msg_safe=msg.replace("[","@(").replace("]",")")
85 coccilib.org.print_todo(p[0], msg_safe)
87 @script:python depends on report@
88 p << rbad_org.p;
89 x << rbad_org.res;
92 msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x)
93 coccilib.report.print_report(p[0], msg)