Web lists-archives.com

Re: [RFC PATCH] *.h: remove extern from function declarations

On Fri, Apr 12, 2019 at 04:48:21PM -0700, Denton Liu wrote:

> Junio mentioned that there was a push to drop extern from function
> declarations in headers[1]. I decided to do a mass refactoring so we
> could get rid of everything at once, although I'm not sure if that's
> welcome. But I'll send the patch anyway since I already wrote it.

The bothersome thing with a mass change is that it probably conflicts
with topics in flight.  Like for example, my patch that removes all of
the externs in packfile.h. :)

Merging with pu is a good way to gauge the damage (though it's not the
whole story, as there are other long-running forks like

> I merged my change with "pu" and these are the files that it conflicts
> with:

So it sounds like you did that and the result is not _too_ bad. But I'm
not sure about doing it automatically with sed. For example...

> diff --git a/packfile.h b/packfile.h
> index d70c6d9afb..dab50405e0 100644
> --- a/packfile.h
> +++ b/packfile.h
> [...]
> @@ -43,10 +43,10 @@ void for_each_file_in_pack_dir(const char *objdir,
>  #define PACKDIR_FILE_PACK 1
>  #define PACKDIR_FILE_IDX 2
> -extern void (*report_garbage)(unsigned seen_bits, const char *path);
> +void (*report_garbage)(unsigned seen_bits, const char *path);

This one is a function pointer, and so the extern is actually changing
the visibility of the declared variable. It needs to stay.

(I didn't read the whole patch carefully, but I knew to look for this
one in particular since I had to deal with it in my patch, too).