Subject: Re: [PATCH] coccicheck: optionally batch spatch invocations

From: SZEDER Gábor <[email-masked]>
Date: Tue, 7 May 2019 13:19:06 +0200

On Mon, May 06, 2019 at 07:43:34PM -0400, Jeff King wrote:
> Subject: [PATCH] coccicheck: optionally batch spatch invocations
> 
> In our "make coccicheck" rule, we currently feed each source file to its
> own individual invocation of spatch. This has a few downsides:
> 
>   - it repeats any overhead spatch has for starting up and reading the
>     patch file
> 
>   - any included header files may get processed from multiple
>     invocations. This is slow (we see the same header files multiple
>     times) and may produce a resulting patch with repeated hunks (which
>     cannot be applied without further cleanup)

I wonder what would happen (and how it would perform) if we told
spatch to ignore all include files from our C sources, but then run it
on each of our header files as well.  It still would have to parse the
semantic patches over and over again, but those are rather small
(compared to, say, 'git-compar-util.h' and 'cache.h' that are included
in most of our source files).  But I don't know how the lack of
information about preprocessor macros would affect Coccinelle's
analyzis.

> Ideally we'd just invoke a single instance of spatch per rule-file and
> feed it all source files.

Well, ideally we would invoke spatch with '--dir .' to "process all
files in directory recursively", and exclude those that we are not
interested in (parts of 'compat/', 'sha1dc')...  but alas, such an
exclude mechanism doesn't seem to exist.