Re: [RFC PATCH] *.h: remove extern from function declarations
- From
Jeff King <peff@peff.net>
- Date
- Apr 13, 2019, 01:24 UTC
- Message-ID
- <20190413012424.GA2040@sigill.intra.peff.net>
- In-Reply-To
- <3e3b9d6c8e54b326809b95adabd3be39d2d0770f.1555111963.git.liu.denton@gmail.com>
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 git-for-windows).
> 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...
Show 11 quoted lines
> 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 > #define PACKDIR_FILE_GARBAGE 4 > -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).
-Peff