Merge tag 'amd-drm-next-5.12-2021-01-08' of https://gitlab.freedesktop.org/agd5f...
[linux-2.6-microblaze.git] / scripts / coccinelle / misc / excluded_middle.cocci
1 // SPDX-License-Identifier: GPL-2.0-only
2 ///
3 /// Condition !A || A && B is equivalent to !A || B.
4 ///
5 // Confidence: High
6 // Copyright: (C) 2020 Denis Efremov ISPRAS
7 // Options: --no-includes --include-headers
8
9 virtual patch
10 virtual context
11 virtual org
12 virtual report
13
14 @r depends on !patch@
15 expression A, B;
16 position p;
17 @@
18
19 * !A || (A &&@p B)
20
21 @depends on patch@
22 expression A, B;
23 @@
24
25   !A ||
26 -       (A && B)
27 +       B
28
29 @script:python depends on report@
30 p << r.p;
31 @@
32
33 coccilib.report.print_report(p[0], "WARNING !A || A && B is equivalent to !A || B")
34
35 @script:python depends on org@
36 p << r.p;
37 @@
38
39 coccilib.org.print_todo(p[0], "WARNING !A || A && B is equivalent to !A || B")