| /// Find duplicate field initializations. This has a high rate of false |
| /// positives due to #ifdefs, which Coccinelle is not aware of in a structure |
| // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. |
| // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. |
| // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. |
| // URL: http://coccinelle.lip6.fr/ |
| // Options: -no_includes -include_headers |
| struct I s =@p0 { ... .fld@p = E, ...}; |
| struct I s =@p0 { ... .fld@p = E, ...}; |
| @script:python depends on org@ |
| if int(ps[0].line) < int(pr[0].line) or (int(ps[0].line) == int(pr[0].line) and int(ps[0].column) < int(pr[0].column)): |
| @script:python depends on report@ |
| if int(ps[0].line) < int(pr[0].line) or (int(ps[0].line) == int(pr[0].line) and int(ps[0].column) < int(pr[0].column)): |
| msg = "%s: first occurrence %s, second occurrence %s" % (fld,ps[0].line,pr[0].line) |
| coccilib.report.print_report(p0[0],msg) |