git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] Makefile: create externcheck target

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 8, 2020, 09:32 UTC
Message-ID
<nycvar.QRO.7.76.6.2010081125390.50@tvgsbejvaqbjf.bet>
In-Reply-To
<1c2ee1c40ccde18a008262aeaf23a17da2064eae.1602142232.git.liu.denton@gmail.com>
Hi Denton,
On Thu, 8 Oct 2020, Denton Liu wrote:
Show 13 quoted lines
> 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@gmail.com>
> ---
>
> 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).

Show 22 quoted lines
>
>  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
>
>
Previous: Denton LiuNext: Denton Liu
Message 4 of 7 in “compat/mingw.h: drop extern from function declaration”
  1. compat/mingw.h: drop extern from function declarationDenton Liu, Oct 7, 2020
  2. Johannes SchindelinOct 7, 2020
  3. Makefile: create externcheck targetDenton Liu, Oct 8, 2020
  4. Johannes SchindelinOct 8, 2020
  5. Denton LiuOct 8, 2020
  6. Johannes SchindelinOct 8, 2020
  7. Junio C HamanoOct 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.