scripts/coccinelle/api/string_choices.cocci
Source file repositories/reference/linux-study-clean/scripts/coccinelle/api/string_choices.cocci
File Facts
- System
- Linux kernel
- Corpus path
scripts/coccinelle/api/string_choices.cocci- Extension
.cocci- Size
- 6046 bytes
- Lines
- 303
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: scripts
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/// Find places to use string_choices.h's various helpers.
//
// Confidence: Medium
// Options: --no-includes --include-headers
virtual patch
virtual context
virtual report
@str_plural depends on patch@
expression E;
@@
(
- ((E == 1) ? "" : "s")
+ str_plural(E)
|
- ((E > 1) ? "s" : "")
+ str_plural(E)
)
@str_plural_r depends on !patch@
expression E;
position P;
@@
(
* (E@P == 1) ? "" : "s"
|
* (E@P > 1) ? "s" : ""
)
@script:python depends on report@
p << str_plural_r.P;
e << str_plural_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e)
@str_up_down depends on patch disable neg_if_exp@
expression E;
@@
- ((E) ? "up" : "down")
+ str_up_down(E)
@str_up_down_r depends on !patch disable neg_if_exp@
expression E;
position P;
@@
* E@P ? "up" : "down"
@script:python depends on report@
p << str_up_down_r.P;
e << str_up_down_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e)
@str_down_up depends on patch disable neg_if_exp@
expression E;
@@
- ((E) ? "down" : "up")
+ str_down_up(E)
@str_down_up_r depends on !patch disable neg_if_exp@
expression E;
position P;
@@
* E@P ? "down" : "up"
@script:python depends on report@
p << str_down_up_r.P;
Annotation
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.