Re: [cocci] [PATCH] scripts/coccinelle: Add script for using ARRAY_END()
Alejandro Colomar <[email protected]> Mon, 9 Mar 2026 13:16:19 +0100
| Newsgroups | fr.inria.cocci,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aa65s_alHWW3woUb@devuan> |
Hi Julia, On 2026-03-09T12:59:48+0100, Julia Lawall wrote: > > > + > > > +//---------------------------------------------------------- > > > +// For context mode > > > +//---------------------------------------------------------- > > > + > > > > Please omit such extra comment lines. > > No problem to put such comments. Okay; thanks! Although I tend to prefer without them, so I've removed them. Also, a majority of existing scripts don't have them. > > > +@depends on i&&context@ > > > +type T; > > > +T[] a; > > > +expression b; > > > +@@ > > > +( > > > +* (a + ARRAY_SIZE(a)) > > > +| > > > +* (&a[0] + ARRAY_SIZE(a)) > > > +| > > > +* (&a[ARRAY_SIZE(a)]) > > > +| > > > +* (&a[ARRAY_SIZE(a) - b]) > > > +) > > > > Extra space characters may be omitted directly after SmPL asterisks. > > No concern about the spaces either. Okay; I've kept them, as the majority has them. > > … > > > +@r depends on (org || report)@ > > > > You may omit parentheses here. > > > > > > … > > > +@script:python depends on report@ > > > +p << r.p; > > > +@@ > > > + > > > +msg="WARNING: Use ARRAY_END" > > > +coccilib.report.print_report(p[0], msg) > > > > Would the following command variant be a bit nicer? > > > > coccilib.report.print_report(p[0], "WARNING: opportunity for ARRAY_END()") > > Either way. I've taken the suggestion. Thanks for the review! Have a lovely day! Alex > > julia -- <https://www.alejandro-colomar.es>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmmuuhMACgkQ64mZXMKQ wqlD7Q/+MC8nUpjlK/p9rr3OlX/h0Gt6qYb3vFL+1+Y7660U0CQL2Vm6fbrGNXci P8etesjkt76rIR95FJTNxXhAXMeESb6GBm06BCg++RRDACo45PbueJuv7tqlgccS 1dKN7qEvwrEiNbZpGD4vNMaNoXk0MFmjU5weHHmqjNm1MmM/CqLnsiM7nQdFoHkn cxqiG7VQSNKPWZ0/p4eGPphqPDQWSsMW4SRdF1FqwCCbgnyTZIMbLHZ9SqP261v1 nkcnkQU/ZNJqNUTwunB916S8dI5PsOBYRs8rl07iFXJPOCApnL/uC8Px+UI5WZIv 5dZt9YdZag5sUx7Ln91UjwKINUrjneAOTuAPPuUAf4HZuJmIPKL2vKvS44rdEtsO idSu0Bly2q3cpcDcNS3ou9J1+zdJsSu3PoFfLesXX28uCYdF6oT9s8m1XxvQM5zi aSoKoG8ZD2O5YGA45xXJ0ZUsxQIq6HC+myPcVPtLWVHIHo/yBnk7b6TmCn6HgMQQ TSDgxF3YVCqS3xOPoz6LRdTBBPFxz9VF3lV8XKSpMaMnVJgVRoyHmxcJurIOzui+ 9Z8UxtTUfNFOVW4y8b7lyqYFU2bfVLQUbFJ7dHk/at8FZvmFEcnbR4WhWxKXPQ5r LYGj+lCzmOtl912j6MjLeJNv/8sNRWNXYxFpVjNqs2ha7o91Y+Q= =Fthy -----END PGP SIGNATURE-----