Hi Denton, On Thu, 8 Oct 2020, Denton Liu wrote: > In b199d7147a (*.[ch]: remove extern from function declarations using > sed, 2019-04-29), we used sed to remove extern from function > definitions. In order to help find and remove future instances of this, > teach Makefile the `externcheck` target which runs the sed script > included in that commit on all applicable source files. > > Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx> > --- > > Notes: > I run this target periodically to ensure that no new instances of extern > function definitions are introduced. Is this something that we want to > consider adding for real? Sure, and then hook it up in `ci/run-static-analysis.sh`. But maybe add it _after_ coccicheck-pending, and add it to the `.PHONY` line that's just outside of this patch's context lines? Ciao, Dscho P.S.: I am not really certain that the `\s` is portable, I do not see any mention of it in https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_03 and would therefore expect BSD sed not to handle this correctly. In any case, the `-i` is _not_ portable, as BSD sed takes a mandatory argument (see https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux for more details). > > Makefile | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Makefile b/Makefile > index 5311b1d2c4..791faa24cf 100644 > --- a/Makefile > +++ b/Makefile > @@ -2885,6 +2885,9 @@ COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES)) > fi > coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci))) > > +externcheck: $(filter-out $(THIRD_PARTY_SOURCES),$(filter %.c %.h,$(shell $(FIND_SOURCE_FILES)))) > + sed -i 's/^\(\s*\)extern \([^(]*([^*]\)/\1\2/' $^ > + > # See contrib/coccinelle/README > coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci)) > > -- > 2.29.0.rc0.261.g7178c9af9c > >