[cocci] [PATCH 01/11] coccinelle: Add script to reorder capable() calls
Markus Elfring
Markus.Elfring at web.de
Mon Nov 25 17:48:18 UTC 2024
…
> +++ b/scripts/coccinelle/api/capable_order.cocci
> @@ -0,0 +1,98 @@
…
> + at ignore@
> +identifier F1 = { capable, ns_capable, sockopt_ns_capable };
> +identifier F2 = { capable, ns_capable, sockopt_ns_capable };
May a key word repetition avoided here?
+identifier F1 = { capable, ns_capable, sockopt_ns_capable },
+ F2 = { capable, ns_capable, sockopt_ns_capable };
…
> +//----------------------------------------------------------
> +// For patch mode
> +//----------------------------------------------------------
I suggest to omit such a comment.
> +@ depends on patch@
…
> +(
> +- F at p(EL) op E
> ++ E op F(EL)
> +|
> +- E1 op1 F at p(EL) op2 E2
> ++ E1 op1 E2 op2 F(EL)
> +)
How do you think about to omit extra space characters at the beginning
of any SmPL lines?
> +//----------------------------------------------------------
> +// For context mode
> +//----------------------------------------------------------
> +
> + at r1 depends on !patch exists@
How good do the provided data fit to the operation modes “org” and “report”?
> +//----------------------------------------------------------
> +// For org mode
> +//----------------------------------------------------------
I suggest to omit such a comment.
> +
> + at script:python depends on org@
> +p << r1.p;
> +@@
> +
> +cocci.print_main("WARNING opportunity for capable reordering",p)
How do you think about to use a statement like the following?
coccilib.org.print_todo(p[0], "WARNING: opportunity for reordering of capable() calls")
> +//----------------------------------------------------------
> +// For report mode
> +//----------------------------------------------------------
I suggest to omit such a comment.
> + at script:python depends on report@
> +p << r1.p;
> +@@
> +
> +msg = "WARNING opportunity for capable reordering"
> +coccilib.report.print_report(p[0], msg)
Can the following code variant be a bit nicer?
coccilib.report.print_report(p[0], "WARNING: opportunity for reordering of capable() calls")
Regards,
Markus
More information about the Linux-security-module-archive
mailing list