1// SPDX-License-Identifier: GPL-2.0-only 2/// Find places to use string_choices.h's various helpers. 3// 4// Confidence: Medium 5// Options: --no-includes --include-headers 6virtual patch 7virtual context 8virtual report 9 10@str_plural depends on patch@ 11expression E; 12@@ 13( 14- ((E == 1) ? "" : "s") 15+ str_plural(E) 16| 17- ((E != 1) ? "s" : "") 18+ str_plural(E) 19| 20- ((E > 1) ? "s" : "") 21+ str_plural(E) 22) 23 24@str_plural_r depends on !patch exists@ 25expression E; 26position P; 27@@ 28( 29* ((E@P == 1) ? "" : "s") 30| 31* ((E@P != 1) ? "s" : "") 32| 33* ((E@P > 1) ? "s" : "") 34) 35 36@script:python depends on report@ 37p << str_plural_r.P; 38e << str_plural_r.E; 39@@ 40 41coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e) 42