1 // SPDX-License-Identifier: GPL-2.0-only 1 // SPDX-License-Identifier: GPL-2.0-only 2 /// Find places to use string_choices.h's vari 2 /// Find places to use string_choices.h's various helpers. 3 // 3 // 4 // Confidence: Medium 4 // Confidence: Medium 5 // Options: --no-includes --include-headers 5 // Options: --no-includes --include-headers 6 virtual patch 6 virtual patch 7 virtual context 7 virtual context 8 virtual report 8 virtual report 9 9 10 @str_plural depends on patch@ 10 @str_plural depends on patch@ 11 expression E; 11 expression E; 12 @@ 12 @@ 13 ( 13 ( 14 - ((E == 1) ? "" : "s") 14 - ((E == 1) ? "" : "s") 15 + str_plural(E) 15 + str_plural(E) 16 | 16 | 17 - ((E > 1) ? "s" : "") 17 - ((E > 1) ? "s" : "") 18 + str_plural(E) 18 + str_plural(E) 19 ) 19 ) 20 20 21 @str_plural_r depends on !patch@ 21 @str_plural_r depends on !patch@ 22 expression E; 22 expression E; 23 position P; 23 position P; 24 @@ 24 @@ 25 ( 25 ( 26 * (E@P == 1) ? "" : "s" 26 * (E@P == 1) ? "" : "s" 27 | 27 | 28 * (E@P > 1) ? "s" : "" 28 * (E@P > 1) ? "s" : "" 29 ) 29 ) 30 30 31 @script:python depends on report@ 31 @script:python depends on report@ 32 p << str_plural_r.P; 32 p << str_plural_r.P; 33 e << str_plural_r.E; 33 e << str_plural_r.E; 34 @@ 34 @@ 35 35 36 coccilib.report.print_report(p[0], "opportunit 36 coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e) 37 37 38 @str_up_down depends on patch disable neg_if_e 38 @str_up_down depends on patch disable neg_if_exp@ 39 expression E; 39 expression E; 40 @@ 40 @@ 41 - ((E) ? "up" : "down") 41 - ((E) ? "up" : "down") 42 + str_up_down(E) 42 + str_up_down(E) 43 43 44 @str_up_down_r depends on !patch disable neg_i 44 @str_up_down_r depends on !patch disable neg_if_exp@ 45 expression E; 45 expression E; 46 position P; 46 position P; 47 @@ 47 @@ 48 * E@P ? "up" : "down" 48 * E@P ? "up" : "down" 49 49 50 @script:python depends on report@ 50 @script:python depends on report@ 51 p << str_up_down_r.P; 51 p << str_up_down_r.P; 52 e << str_up_down_r.E; 52 e << str_up_down_r.E; 53 @@ 53 @@ 54 54 55 coccilib.report.print_report(p[0], "opportunit 55 coccilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e) 56 56 57 @str_down_up depends on patch disable neg_if_e 57 @str_down_up depends on patch disable neg_if_exp@ 58 expression E; 58 expression E; 59 @@ 59 @@ 60 - ((E) ? "down" : "up") 60 - ((E) ? "down" : "up") 61 + str_down_up(E) 61 + str_down_up(E) 62 62 63 @str_down_up_r depends on !patch disable neg_i 63 @str_down_up_r depends on !patch disable neg_if_exp@ 64 expression E; 64 expression E; 65 position P; 65 position P; 66 @@ 66 @@ 67 * E@P ? "down" : "up" 67 * E@P ? "down" : "up" 68 68 69 @script:python depends on report@ 69 @script:python depends on report@ 70 p << str_down_up_r.P; 70 p << str_down_up_r.P; 71 e << str_down_up_r.E; 71 e << str_down_up_r.E; 72 @@ 72 @@ 73 73 74 coccilib.report.print_report(p[0], "opportunit 74 coccilib.report.print_report(p[0], "opportunity for str_down_up(%s)" % e) 75 75 76 @str_true_false depends on patch disable neg_i 76 @str_true_false depends on patch disable neg_if_exp@ 77 expression E; 77 expression E; 78 @@ 78 @@ 79 - ((E) ? "true" : "false") 79 - ((E) ? "true" : "false") 80 + str_true_false(E) 80 + str_true_false(E) 81 81 82 @str_true_false_r depends on !patch disable ne 82 @str_true_false_r depends on !patch disable neg_if_exp@ 83 expression E; 83 expression E; 84 position P; 84 position P; 85 @@ 85 @@ 86 * E@P ? "true" : "false" 86 * E@P ? "true" : "false" 87 87 88 @script:python depends on report@ 88 @script:python depends on report@ 89 p << str_true_false_r.P; 89 p << str_true_false_r.P; 90 e << str_true_false_r.E; 90 e << str_true_false_r.E; 91 @@ 91 @@ 92 92 93 coccilib.report.print_report(p[0], "opportunit 93 coccilib.report.print_report(p[0], "opportunity for str_true_false(%s)" % e) 94 94 95 @str_false_true depends on patch disable neg_i 95 @str_false_true depends on patch disable neg_if_exp@ 96 expression E; 96 expression E; 97 @@ 97 @@ 98 - ((E) ? "false" : "true") 98 - ((E) ? "false" : "true") 99 + str_false_true(E) 99 + str_false_true(E) 100 100 101 @str_false_true_r depends on !patch disable ne 101 @str_false_true_r depends on !patch disable neg_if_exp@ 102 expression E; 102 expression E; 103 position P; 103 position P; 104 @@ 104 @@ 105 * E@P ? "false" : "true" 105 * E@P ? "false" : "true" 106 106 107 @script:python depends on report@ 107 @script:python depends on report@ 108 p << str_false_true_r.P; 108 p << str_false_true_r.P; 109 e << str_false_true_r.E; 109 e << str_false_true_r.E; 110 @@ 110 @@ 111 111 112 coccilib.report.print_report(p[0], "opportunit 112 coccilib.report.print_report(p[0], "opportunity for str_false_true(%s)" % e) 113 113 114 @str_hi_lo depends on patch disable neg_if_exp 114 @str_hi_lo depends on patch disable neg_if_exp@ 115 expression E; 115 expression E; 116 @@ 116 @@ 117 - ((E) ? "hi" : "lo") 117 - ((E) ? "hi" : "lo") 118 + str_hi_lo(E) 118 + str_hi_lo(E) 119 119 120 @str_hi_lo_r depends on !patch disable neg_if_ 120 @str_hi_lo_r depends on !patch disable neg_if_exp@ 121 expression E; 121 expression E; 122 position P; 122 position P; 123 @@ 123 @@ 124 * E@P ? "hi" : "lo" 124 * E@P ? "hi" : "lo" 125 125 126 @script:python depends on report@ 126 @script:python depends on report@ 127 p << str_hi_lo_r.P; 127 p << str_hi_lo_r.P; 128 e << str_hi_lo_r.E; 128 e << str_hi_lo_r.E; 129 @@ 129 @@ 130 130 131 coccilib.report.print_report(p[0], "opportunit 131 coccilib.report.print_report(p[0], "opportunity for str_hi_lo(%s)" % e) 132 132 133 @str_high_low depends on patch disable neg_if_ 133 @str_high_low depends on patch disable neg_if_exp@ 134 expression E; 134 expression E; 135 @@ 135 @@ 136 - ((E) ? "high" : "low") 136 - ((E) ? "high" : "low") 137 + str_high_low(E) 137 + str_high_low(E) 138 138 139 @str_high_low_r depends on !patch disable neg_ 139 @str_high_low_r depends on !patch disable neg_if_exp@ 140 expression E; 140 expression E; 141 position P; 141 position P; 142 @@ 142 @@ 143 * E@P ? "high" : "low" 143 * E@P ? "high" : "low" 144 144 145 @script:python depends on report@ 145 @script:python depends on report@ 146 p << str_high_low_r.P; 146 p << str_high_low_r.P; 147 e << str_high_low_r.E; 147 e << str_high_low_r.E; 148 @@ 148 @@ 149 149 150 coccilib.report.print_report(p[0], "opportunit 150 coccilib.report.print_report(p[0], "opportunity for str_high_low(%s)" % e) 151 151 152 @str_lo_hi depends on patch disable neg_if_exp 152 @str_lo_hi depends on patch disable neg_if_exp@ 153 expression E; 153 expression E; 154 @@ 154 @@ 155 - ((E) ? "lo" : "hi") 155 - ((E) ? "lo" : "hi") 156 + str_lo_hi(E) 156 + str_lo_hi(E) 157 157 158 @str_lo_hi_r depends on !patch disable neg_if_ 158 @str_lo_hi_r depends on !patch disable neg_if_exp@ 159 expression E; 159 expression E; 160 position P; 160 position P; 161 @@ 161 @@ 162 * E@P ? "lo" : "hi" 162 * E@P ? "lo" : "hi" 163 163 164 @script:python depends on report@ 164 @script:python depends on report@ 165 p << str_lo_hi_r.P; 165 p << str_lo_hi_r.P; 166 e << str_lo_hi_r.E; 166 e << str_lo_hi_r.E; 167 @@ 167 @@ 168 168 169 coccilib.report.print_report(p[0], "opportunit 169 coccilib.report.print_report(p[0], "opportunity for str_lo_hi(%s)" % e) 170 170 171 @str_low_high depends on patch disable neg_if_ 171 @str_low_high depends on patch disable neg_if_exp@ 172 expression E; 172 expression E; 173 @@ 173 @@ 174 - ((E) ? "low" : "high") 174 - ((E) ? "low" : "high") 175 + str_low_high(E) 175 + str_low_high(E) 176 176 177 @str_low_high_r depends on !patch disable neg_ 177 @str_low_high_r depends on !patch disable neg_if_exp@ 178 expression E; 178 expression E; 179 position P; 179 position P; 180 @@ 180 @@ 181 * E@P ? "low" : "high" 181 * E@P ? "low" : "high" 182 182 183 @script:python depends on report@ 183 @script:python depends on report@ 184 p << str_low_high_r.P; 184 p << str_low_high_r.P; 185 e << str_low_high_r.E; 185 e << str_low_high_r.E; 186 @@ 186 @@ 187 187 188 coccilib.report.print_report(p[0], "opportunit 188 coccilib.report.print_report(p[0], "opportunity for str_low_high(%s)" % e) 189 189 190 @str_enable_disable depends on patch@ 190 @str_enable_disable depends on patch@ 191 expression E; 191 expression E; 192 @@ 192 @@ 193 - ((E) ? "enable" : "disable") 193 - ((E) ? "enable" : "disable") 194 + str_enable_disable(E) 194 + str_enable_disable(E) 195 195 196 @str_enable_disable_r depends on !patch@ 196 @str_enable_disable_r depends on !patch@ 197 expression E; 197 expression E; 198 position P; 198 position P; 199 @@ 199 @@ 200 * E@P ? "enable" : "disable" 200 * E@P ? "enable" : "disable" 201 201 202 @script:python depends on report@ 202 @script:python depends on report@ 203 p << str_enable_disable_r.P; 203 p << str_enable_disable_r.P; 204 e << str_enable_disable_r.E; 204 e << str_enable_disable_r.E; 205 @@ 205 @@ 206 206 207 coccilib.report.print_report(p[0], "opportunit 207 coccilib.report.print_report(p[0], "opportunity for str_enable_disable(%s)" % e) 208 208 209 @str_enabled_disabled depends on patch@ 209 @str_enabled_disabled depends on patch@ 210 expression E; 210 expression E; 211 @@ 211 @@ 212 - ((E) ? "enabled" : "disabled") 212 - ((E) ? "enabled" : "disabled") 213 + str_enabled_disabled(E) 213 + str_enabled_disabled(E) 214 214 215 @str_enabled_disabled_r depends on !patch@ 215 @str_enabled_disabled_r depends on !patch@ 216 expression E; 216 expression E; 217 position P; 217 position P; 218 @@ 218 @@ 219 * E@P ? "enabled" : "disabled" 219 * E@P ? "enabled" : "disabled" 220 220 221 @script:python depends on report@ 221 @script:python depends on report@ 222 p << str_enabled_disabled_r.P; 222 p << str_enabled_disabled_r.P; 223 e << str_enabled_disabled_r.E; 223 e << str_enabled_disabled_r.E; 224 @@ 224 @@ 225 225 226 coccilib.report.print_report(p[0], "opportunit 226 coccilib.report.print_report(p[0], "opportunity for str_enabled_disabled(%s)" % e) 227 227 228 @str_read_write depends on patch disable neg_i 228 @str_read_write depends on patch disable neg_if_exp@ 229 expression E; 229 expression E; 230 @@ 230 @@ 231 - ((E) ? "read" : "write") 231 - ((E) ? "read" : "write") 232 + str_read_write(E) 232 + str_read_write(E) 233 233 234 @str_read_write_r depends on !patch disable ne 234 @str_read_write_r depends on !patch disable neg_if_exp@ 235 expression E; 235 expression E; 236 position P; 236 position P; 237 @@ 237 @@ 238 * E@P ? "read" : "write" 238 * E@P ? "read" : "write" 239 239 240 @script:python depends on report@ 240 @script:python depends on report@ 241 p << str_read_write_r.P; 241 p << str_read_write_r.P; 242 e << str_read_write_r.E; 242 e << str_read_write_r.E; 243 @@ 243 @@ 244 244 245 coccilib.report.print_report(p[0], "opportunit 245 coccilib.report.print_report(p[0], "opportunity for str_read_write(%s)" % e) 246 246 247 @str_write_read depends on patch disable neg_i 247 @str_write_read depends on patch disable neg_if_exp@ 248 expression E; 248 expression E; 249 @@ 249 @@ 250 - ((E) ? "write" : "read") 250 - ((E) ? "write" : "read") 251 + str_write_read(E) 251 + str_write_read(E) 252 252 253 @str_write_read_r depends on !patch disable ne 253 @str_write_read_r depends on !patch disable neg_if_exp@ 254 expression E; 254 expression E; 255 position P; 255 position P; 256 @@ 256 @@ 257 * E@P ? "write" : "read" 257 * E@P ? "write" : "read" 258 258 259 @script:python depends on report@ 259 @script:python depends on report@ 260 p << str_write_read_r.P; 260 p << str_write_read_r.P; 261 e << str_write_read_r.E; 261 e << str_write_read_r.E; 262 @@ 262 @@ 263 263 264 coccilib.report.print_report(p[0], "opportunit 264 coccilib.report.print_report(p[0], "opportunity for str_write_read(%s)" % e) 265 265 266 @str_on_off depends on patch@ 266 @str_on_off depends on patch@ 267 expression E; 267 expression E; 268 @@ 268 @@ 269 - ((E) ? "on" : "off") 269 - ((E) ? "on" : "off") 270 + str_on_off(E) 270 + str_on_off(E) 271 271 272 @str_on_off_r depends on !patch@ 272 @str_on_off_r depends on !patch@ 273 expression E; 273 expression E; 274 position P; 274 position P; 275 @@ 275 @@ 276 * E@P ? "on" : "off" 276 * E@P ? "on" : "off" 277 277 278 @script:python depends on report@ 278 @script:python depends on report@ 279 p << str_on_off_r.P; 279 p << str_on_off_r.P; 280 e << str_on_off_r.E; 280 e << str_on_off_r.E; 281 @@ 281 @@ 282 282 283 coccilib.report.print_report(p[0], "opportunit 283 coccilib.report.print_report(p[0], "opportunity for str_on_off(%s)" % e) 284 284 285 @str_yes_no depends on patch@ 285 @str_yes_no depends on patch@ 286 expression E; 286 expression E; 287 @@ 287 @@ 288 - ((E) ? "yes" : "no") 288 - ((E) ? "yes" : "no") 289 + str_yes_no(E) 289 + str_yes_no(E) 290 290 291 @str_yes_no_r depends on !patch@ 291 @str_yes_no_r depends on !patch@ 292 expression E; 292 expression E; 293 position P; 293 position P; 294 @@ 294 @@ 295 * E@P ? "yes" : "no" 295 * E@P ? "yes" : "no" 296 296 297 @script:python depends on report@ 297 @script:python depends on report@ 298 p << str_yes_no_r.P; 298 p << str_yes_no_r.P; 299 e << str_yes_no_r.E; 299 e << str_yes_no_r.E; 300 @@ 300 @@ 301 301 302 coccilib.report.print_report(p[0], "opportunit 302 coccilib.report.print_report(p[0], "opportunity for str_yes_no(%s)" % e)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.