11d02f252SKees Cook// SPDX-License-Identifier: GPL-2.0-only 21d02f252SKees Cook/// Find places to use string_choices.h's various helpers. 31d02f252SKees Cook// 41d02f252SKees Cook// Confidence: Medium 51d02f252SKees Cook// Options: --no-includes --include-headers 61d02f252SKees Cookvirtual patch 71d02f252SKees Cookvirtual context 81d02f252SKees Cookvirtual report 91d02f252SKees Cook 101d02f252SKees Cook@str_plural depends on patch@ 111d02f252SKees Cookexpression E; 121d02f252SKees Cook@@ 131d02f252SKees Cook( 141d02f252SKees Cook- ((E == 1) ? "" : "s") 151d02f252SKees Cook+ str_plural(E) 161d02f252SKees Cook| 171d02f252SKees Cook- ((E != 1) ? "s" : "") 181d02f252SKees Cook+ str_plural(E) 191d02f252SKees Cook| 201d02f252SKees Cook- ((E > 1) ? "s" : "") 211d02f252SKees Cook+ str_plural(E) 221d02f252SKees Cook) 231d02f252SKees Cook 241d02f252SKees Cook@str_plural_r depends on !patch exists@ 251d02f252SKees Cookexpression E; 261d02f252SKees Cookposition P; 271d02f252SKees Cook@@ 281d02f252SKees Cook( 291d02f252SKees Cook* ((E@P == 1) ? "" : "s") 301d02f252SKees Cook| 311d02f252SKees Cook* ((E@P != 1) ? "s" : "") 321d02f252SKees Cook| 331d02f252SKees Cook* ((E@P > 1) ? "s" : "") 341d02f252SKees Cook) 351d02f252SKees Cook 361d02f252SKees Cook@script:python depends on report@ 371d02f252SKees Cookp << str_plural_r.P; 381d02f252SKees Cooke << str_plural_r.E; 391d02f252SKees Cook@@ 401d02f252SKees Cook 411d02f252SKees Cookcoccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e) 429b97452bSMichal Wajdeczko 439b97452bSMichal Wajdeczko@str_up_down depends on patch@ 449b97452bSMichal Wajdeczkoexpression E; 459b97452bSMichal Wajdeczko@@ 469b97452bSMichal Wajdeczko( 479b97452bSMichal Wajdeczko- ((E) ? "up" : "down") 489b97452bSMichal Wajdeczko+ str_up_down(E) 499b97452bSMichal Wajdeczko) 509b97452bSMichal Wajdeczko 519b97452bSMichal Wajdeczko@str_up_down_r depends on !patch exists@ 529b97452bSMichal Wajdeczkoexpression E; 539b97452bSMichal Wajdeczkoposition P; 549b97452bSMichal Wajdeczko@@ 559b97452bSMichal Wajdeczko( 569b97452bSMichal Wajdeczko* ((E@P) ? "up" : "down") 579b97452bSMichal Wajdeczko) 589b97452bSMichal Wajdeczko 599b97452bSMichal Wajdeczko@script:python depends on report@ 609b97452bSMichal Wajdeczkop << str_up_down_r.P; 619b97452bSMichal Wajdeczkoe << str_up_down_r.E; 629b97452bSMichal Wajdeczko@@ 639b97452bSMichal Wajdeczko 649b97452bSMichal Wajdeczkococcilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e) 650336f898SKees Cook 660336f898SKees Cook@str_down_up depends on patch@ 670336f898SKees Cookexpression E; 680336f898SKees Cook@@ 690336f898SKees Cook( 700336f898SKees Cook- ((E) ? "down" : "up") 710336f898SKees Cook+ str_down_up(E) 720336f898SKees Cook) 730336f898SKees Cook 740336f898SKees Cook@str_down_up_r depends on !patch exists@ 750336f898SKees Cookexpression E; 760336f898SKees Cookposition P; 770336f898SKees Cook@@ 780336f898SKees Cook( 790336f898SKees Cook* ((E@P) ? "down" : "up") 800336f898SKees Cook) 810336f898SKees Cook 820336f898SKees Cook@script:python depends on report@ 830336f898SKees Cookp << str_down_up_r.P; 840336f898SKees Cooke << str_down_up_r.E; 850336f898SKees Cook@@ 860336f898SKees Cook 870336f898SKees Cookcoccilib.report.print_report(p[0], "opportunity for str_down_up(%s)" % e) 88*716bf84eSHongbo Li 89*716bf84eSHongbo Li@str_true_false depends on patch@ 90*716bf84eSHongbo Liexpression E; 91*716bf84eSHongbo Li@@ 92*716bf84eSHongbo Li- ((E) ? "true" : "false") 93*716bf84eSHongbo Li+ str_true_false(E) 94*716bf84eSHongbo Li 95*716bf84eSHongbo Li@str_true_false_r depends on !patch exists@ 96*716bf84eSHongbo Liexpression E; 97*716bf84eSHongbo Liposition P; 98*716bf84eSHongbo Li@@ 99*716bf84eSHongbo Li* ((E@P) ? "true" : "false") 100*716bf84eSHongbo Li 101*716bf84eSHongbo Li@script:python depends on report@ 102*716bf84eSHongbo Lip << str_true_false_r.P; 103*716bf84eSHongbo Lie << str_true_false_r.E; 104*716bf84eSHongbo Li@@ 105*716bf84eSHongbo Li 106*716bf84eSHongbo Licoccilib.report.print_report(p[0], "opportunity for str_true_false(%s)" % e) 107