1 // SPDX-License-Identifier: GPL-2.0-only
2 /// These iterators only exit normally when the loop cursor is NULL, so there
3 /// is no point to call of_node_put on the final value.
6 // Copyright: (C) 2010-2012 Nicolas Palix.
7 // Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
8 // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
9 // URL: http://coccinelle.lip6.fr/
11 // Options: --no-includes --include-headers
19 iterator name for_each_node_by_name;
24 for_each_node_by_name(np,...) {
32 iterator name for_each_node_by_type;
37 for_each_node_by_type(np,...) {
45 iterator name for_each_compatible_node;
50 for_each_compatible_node(np,...) {
58 iterator name for_each_matching_node;
63 for_each_matching_node(np,...) {
70 // ----------------------------------------------------------------------
72 @r depends on !patch forall@
73 //iterator name for_each_node_by_name;
74 //iterator name for_each_node_by_type;
75 //iterator name for_each_compatible_node;
76 //iterator name for_each_matching_node;
83 *for_each_node_by_name@p1(np,...)
89 *for_each_node_by_type@p1(np,...)
95 *for_each_compatible_node@p1(np,...)
101 *for_each_matching_node@p1(np,...)
108 * of_node_put@p2(np);
110 @script:python depends on org@
115 cocci.print_main("unneeded of_node_put",p2)
116 cocci.print_secs("iterator",p1)
118 @script:python depends on report@
123 msg = "ERROR: of_node_put not needed after iterator on line %s" % (p1[0].line)
124 coccilib.report.print_report(p2[0], msg)