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 9virtual patch 10virtual context 11virtual org 12virtual report 13 14@r depends on !patch@ 15expression A, B; 16position p; 17@@ 18 19* !A || (A &&@p B) 20 21@depends on patch@ 22expression A, B; 23@@ 24 25 !A || 26- (A && B) 27+ B 28 29@script:python depends on report@ 30p << r.p; 31@@ 32 33coccilib.report.print_report(p[0], "WARNING !A || A && B is equivalent to !A || B") 34 35@script:python depends on org@ 36p << r.p; 37@@ 38 39coccilib.org.print_todo(p[0], "WARNING !A || A && B is equivalent to !A || B") 40