On Fri, May 03, 2019 at 01:45:03PM -0400, Jeff King wrote: > On Fri, May 03, 2019 at 04:42:11PM +0200, SZEDER Gábor wrote: > > > > Since you *could* include it, I now assume that Coccinelle does not need > > > to follow the `#include`s (otherwise, it would have complained about not > > > finding the `windows.h` header in your setup). > > > > We invoke Coccinelle/spatch with the '--all-includes' option, see the > > SPATCH_FLAGS make variable. And it does indeed include header files: > > I've seen it find something to transform in 'cache.h', and then the > > resulting 'contrib/coccinelle/<whatever>.cocci.patch' included the > > exact same transformation as many times as the number of files > > including 'cache.h'... which is a lot :) > > I think spatch is smart enough not to hit the same header multiple > times. But the problem is that we invoke it once per file, so it > actually processes cache.h many times. That's slow, but also produces > bogus patches. > > Jacob Keller's patches to collapse this to a single invocation do fix it > (and I've used them selectively in the past rather than cleaning up the > resulting patch manually ;) ). > > Sort of tangential to your point, I guess, but it might be a topic to > revisit. I simply applied the changes manually to 'cache.h', and rerun 'make contrib/coccinelle/<...>.cocci.patch'. This approach is reliable and has less undesirable side-effects :) and it doesn't happen that often to be a considerable burden.