summaryrefslogtreecommitdiff
path: root/scripts/coccinelle/api/string_choices.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle/api/string_choices.cocci')
-rw-r--r--scripts/coccinelle/api/string_choices.cocci19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coccinelle/api/string_choices.cocci
index 6942ad7c4224..c3c5bc94fab0 100644
--- a/scripts/coccinelle/api/string_choices.cocci
+++ b/scripts/coccinelle/api/string_choices.cocci
@@ -104,3 +104,22 @@ e << str_true_false_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_true_false(%s)" % e)
+
+@str_false_true depends on patch@
+expression E;
+@@
+- ((E) ? "false" : "true")
++ str_false_true(E)
+
+@str_false_true_r depends on !patch exists@
+expression E;
+position P;
+@@
+* ((E@P) ? "false" : "true")
+
+@script:python depends on report@
+p << str_false_true_r.P;
+e << str_false_true_r.E;
+@@
+
+coccilib.report.print_report(p[0], "opportunity for str_false_true(%s)" % e)