Re: [PATCH] git_fopen: fix a sparse 'not declared' warning
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 24, 2017, 01:37 UTC
- Message-ID
- <xmqqshky37se.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <130ef8bd-1c7b-0206-e1cd-076afae7e292@ramsayjones.plus.com>
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 23 quoted lines
> Commit 8f4f6e53d2 ("config.mak.uname: set FREAD_READS_DIRECTORIES for
> Linux and FreeBSD", 20-04-2017) caused sparse to issue a 'not declared,
> should it be static?' warning on Linux. This is a result of the method
> employed by 'compat/fopen.c' to suppress the (possible) redefinition of
> the (system) fopen macro, which also removes the extern declaration of
> the git_fopen function.
>
> In order to suppress the warning, introduce a new macro to suppress the
> definition (or possibly the re-definition) of the fopen symbol as a
> macro override. This new macro (SUPPRESS_FOPEN_REDEFINITION) is only
> defined in 'compat/fopen.c', just prior to the inclusion of the
> 'git-compat-util.h' header file.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Duy,
>
> Could you (or Junio) please add this to your 'nd/fopen-errors'
> branch, either as a separate patch or squash it into commit
> 8f4f6e53d2 ("config.mak.uname: set FREAD_READS_DIRECTORIES for
> Linux and FreeBSD", 20-04-2017). I think it would be better as a
> separate commit, but I will leave you to decide on that. ;-)Yeah, I think it makes sense to have this as a separate patch, applying even before the other series.
Thanks.