On Thu, May 02, 2019 at 02:04:22AM +0200, SZEDER Gábor wrote: > On Wed, May 01, 2019 at 06:01:08AM -0400, Denton Liu wrote: [snip] > > > > -- >8 -- > > Subject: [PATCH] Makefile: filter out compat/ from coccicheck > > > > Since most files in compat/ are pulled from external sources, ensure > > that they do not get modified when we run coccicheck because we do not > > want them to differ from upstream as much as possible. > > > > Make exceptions for mingw.c and win32/*.c as these are files that we > > have created and not pulled from upstream. > > I'm not sure that we really need these exceptions. > > C_SOURCES comes from C_OBJ, i.e. it is basically all '*.c' source > files that we compile, taking the platform and Makefile knobs into > account. On Linux we don't compile 'compat/mingw.c' and > 'compat/win32/*.c', so when running 'make coccicheck' on Linux it > won't look into these source files anyway, so we don't need these > exceptions. On Windows, however... well, is it even possible to > build and run Coccinelle on Windows in the first place, with all its > OCaml dependencies?! If not, then these exceptions won't do any good. I assumed that Coccinelle runs on Windows but now that you mention it, Cocci's origin was as a Linux refactoring tool so I'm not really sure if it actually does run. Unfortunately, I don't have a Windows box available to test it out on so let's assume that it doesn't work on Windows, unless someone says otherwise. > > Anyway, if we do want these exceptions, then what about > 'compat/win32mmap.c' and 'compat/winansi.c'? They look like "ours" as > well. Good point, I wasn't really sure which ones were ours so I just went off of what Johannes said. If we decide to keep the exceptions, I'll dig through the log messages to find all of "our" files. > > > FWIW, out of curiosity I've run 'make coccicheck' on Linux with > 'compat/mingw.c' and its friends explicitly added to C_SOURCES, and it > seems to work... it even found two places in 'mingw.c' where > COPY_ARRAY could replace memcpy() :) > Since you mentioned this, shouldn't we run Coccinelle on all of our source files, not just the ones that are compiled? Since the Windows-files aren't checked, they are in a blindspot for us. I guess a point against that would be if one were patching a file that they couldn't even test-compile, then it could be possible that faulty patches are sent, but I guess we have enough people on the mailing list that could verify the patches so I don't think that's a problem. Perhaps we could implement a 'coccicheckall' target which excludes contrib/ but excepts mingw.c and friends?