1 // SPDX-License-Identifier: GPL-2.0-only
3 /// Use resource_size function on resource object
4 /// instead of explicit computation.
7 // Copyright: (C) 2009, 2010 Nicolas Palix, DIKU.
8 // Copyright: (C) 2009, 2010 Julia Lawall, DIKU.
9 // Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6.
10 // URL: http://coccinelle.lip6.fr/
13 // Keywords: resource_size
14 // Version min: 2.6.27 resource_size
22 //----------------------------------------------------------
24 //----------------------------------------------------------
26 @r_context depends on context && !patch && !org@
30 * (res->end - res->start) + 1
32 //----------------------------------------------------------
34 //----------------------------------------------------------
36 @r_patch depends on !context && patch && !org@
40 - (res->end - res->start) + 1
43 //----------------------------------------------------------
45 //----------------------------------------------------------
48 @r_org depends on !context && !patch && (org || report)@
53 (res->end@p - res->start) + 1
55 @rbad_org depends on !context && !patch && (org || report)@
57 position p != r_org.p;
60 res->end@p - res->start
62 @script:python depends on org@
67 msg="ERROR with %s" % (x)
68 msg_safe=msg.replace("[","@(").replace("]",")")
69 coccilib.org.print_todo(p[0], msg_safe)
71 @script:python depends on report@
76 msg="ERROR: Missing resource_size with %s" % (x)
77 coccilib.report.print_report(p[0], msg)
79 @script:python depends on org@
84 msg="WARNING with %s" % (x)
85 msg_safe=msg.replace("[","@(").replace("]",")")
86 coccilib.org.print_todo(p[0], msg_safe)
88 @script:python depends on report@
93 msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x)
94 coccilib.report.print_report(p[0], msg)