Re: [PATCH v2 0/4] Makefile/coccicheck: fix bugs and speed it up
- From
René Scharfe. <l.s.r@web.de>
- Date
- Mar 6, 2021, 19:08 UTC
- Message-ID
- <e2a1c84b-4dc0-e5db-fbac-16be0135bf81@web.de>
- In-Reply-To
- <87czwctbim.fsf@evledraar.gmail.com>
Am 06.03.21 um 18:52 schrieb Ævar Arnfjörð Bjarmason:
Show 16 quoted lines
> > On Sat, Mar 06 2021, René Scharfe. wrote: > >> Am 06.03.21 um 18:27 schrieb Ævar Arnfjörð Bjarmason: >>> Do these sorts of rules really benefit that much from the type >>> v.s. expression? If yes we'll obviously need to support it, but if (and >>> I haven't looked closely) we can equally rewrite them with "expression" >>> (or it would be good enough) we could be quite a bit faster by >>> default... >> >> Type information is essential for many (most?) semantic patches. >> Untyped replacements could be done more easily using sed or similar. > > We have 65 individual hunks in *.cocci by my count $((/ (cat *.cocci | > grep -c ^@@) 2)), but only 9 of those use the "type T" construct, which > AFAICT is the only thing affected.
I don't understand why using type variables would be the only feature that needs headers. Accessing struct members like in commit.cocci surely needs their definition, no?
Show 6 quoted lines
> There's still plenty of reason to use spatch without headers being > included, it's still doing a full parse and knows that something's a > function, and otherwise cares about C syntax etc. > > Anyway, I'm not saying you don't need it, just that AFAICT it's a small > minority of the rules that require the includes.
https://coccinelle.gitlabpages.inria.fr/website/docs/options.pdf says "If the semantic patch contains type specifications on expression metavariables, then the default is --local-includes. Otherwise the default is --no-includes." So spatch by default already avoids loading includes unless needed, but we override that.
René