17f904d7eSThomas Gleixner// SPDX-License-Identifier: GPL-2.0-only 297c1cf8fSJulia Lawall/// Find bit operations that include the same argument more than once 397c1cf8fSJulia Lawall//# One source of false positives is when the argument performs a side 497c1cf8fSJulia Lawall//# effect. Another source of false positives is when a neutral value 597c1cf8fSJulia Lawall//# such as 0 for | is used to indicate no information, to maintain the 697c1cf8fSJulia Lawall//# same structure as other similar expressions 797c1cf8fSJulia Lawall/// 897c1cf8fSJulia Lawall// Confidence: Moderate 97f904d7eSThomas Gleixner// Copyright: (C) 2010 Nicolas Palix, DIKU. 107f904d7eSThomas Gleixner// Copyright: (C) 2010 Julia Lawall, DIKU. 117f904d7eSThomas Gleixner// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. 12*f01701ceSJulia Lawall// URL: https://coccinelle.gitlabpages.inria.fr/website 1397c1cf8fSJulia Lawall// Comments: 1493f14468SNicolas Palix// Options: --no-includes --include-headers 1597c1cf8fSJulia Lawall 1697c1cf8fSJulia Lawallvirtual context 1797c1cf8fSJulia Lawallvirtual org 1897c1cf8fSJulia Lawallvirtual report 1997c1cf8fSJulia Lawall 2097c1cf8fSJulia Lawall@r expression@ 2197c1cf8fSJulia Lawallexpression E; 2297c1cf8fSJulia Lawallposition p; 2397c1cf8fSJulia Lawall@@ 2497c1cf8fSJulia Lawall 2597c1cf8fSJulia Lawall( 2697c1cf8fSJulia Lawall* E@p 2797c1cf8fSJulia Lawall & ... & E 2897c1cf8fSJulia Lawall| 2997c1cf8fSJulia Lawall* E@p 3097c1cf8fSJulia Lawall | ... | E 3197c1cf8fSJulia Lawall| 3297c1cf8fSJulia Lawall* E@p 3397c1cf8fSJulia Lawall & ... & !E 3497c1cf8fSJulia Lawall| 3597c1cf8fSJulia Lawall* E@p 3697c1cf8fSJulia Lawall | ... | !E 3797c1cf8fSJulia Lawall| 3897c1cf8fSJulia Lawall* !E@p 3997c1cf8fSJulia Lawall & ... & E 4097c1cf8fSJulia Lawall| 4197c1cf8fSJulia Lawall* !E@p 4297c1cf8fSJulia Lawall | ... | E 4397c1cf8fSJulia Lawall) 4497c1cf8fSJulia Lawall 4597c1cf8fSJulia Lawall@script:python depends on org@ 4697c1cf8fSJulia Lawallp << r.p; 4797c1cf8fSJulia Lawall@@ 4897c1cf8fSJulia Lawall 4997c1cf8fSJulia Lawallcocci.print_main("duplicated argument to & or |",p) 5097c1cf8fSJulia Lawall 5197c1cf8fSJulia Lawall@script:python depends on report@ 5297c1cf8fSJulia Lawallp << r.p; 5397c1cf8fSJulia Lawall@@ 5497c1cf8fSJulia Lawall 5597c1cf8fSJulia Lawallcoccilib.report.print_report(p[0],"duplicated argument to & or |") 56