git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH 2/6] path: Make the 'get_st_mode_bits' symbol a file static
Date: Mon, 29 Apr 2013 22:57:40 +0100	[thread overview]
Message-ID: <517EECD4.800@ramsay1.demon.co.uk> (raw)
In-Reply-To: <517CBB6E.205@web.de>

Torsten Bögershausen wrote:
> On 2013-04-27 20.42, Ramsay Jones wrote:
>>
>> On MinGW, sparse issues an "'get_st_mode_bits' not declared. Should
>> it be static?" warning. The MinGW and MSVC builds do not see the
>> declaration of this function, within git-compat-util.h, due to it's
>> placement within an preprocessor conditional. (So, one solution would
>> be to simply move the declaration to the top level of the header.)
>>
>> In order to suppress the warning, since this symbol does not need
>> more than file visibility, we simply remove the declaration from
>> the header and add the static modifier to the function definition.
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> ---
>>  git-compat-util.h | 1 -
>>  path.c            | 2 +-
>>  2 files changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index e955bb5..3a990b3 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -163,7 +163,6 @@
>>  typedef long intptr_t;
>>  typedef unsigned long uintptr_t;
>>  #endif
>> -int get_st_mode_bits(const char *path, int *mode);
>>  #if defined(__CYGWIN__)
>>  #undef _XOPEN_SOURCE
>>  #include <grp.h>
>> diff --git a/path.c b/path.c
>> index 04ff148..cc2e9ac 100644
>> --- a/path.c
>> +++ b/path.c
>> @@ -11,7 +11,7 @@
>>   * may return wrong permission bits. Most of the time we do not care,
>>   * but the callsites of this wrapper do care.
>>   */
>> -int get_st_mode_bits(const char *path, int *mode)
>> +static int get_st_mode_bits(const char *path, int *mode)
>>  {
>>  	struct stat st;
>>  	if (lstat(path, &st) < 0)
>>
> Sorry for breaking the MiNGW/MSVC builds.
> It seams that the get_st_mode_bits is badly placed.

You didn't break the build; simply provoked a warning.

As I said in the commit message, an alternative is to
simply move the declaration to the top level of the
header (out of the preprocessor conditional).

ATB,
Ramsay Jones

  parent reply	other threads:[~2013-04-29 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 18:42 [PATCH 2/6] path: Make the 'get_st_mode_bits' symbol a file static Ramsay Jones
2013-04-28  2:26 ` Eric Sunshine
2013-04-28  6:02 ` Torsten Bögershausen
2013-04-28 11:32   ` Torsten Bögershausen
2013-04-29 21:57   ` Ramsay Jones [this message]
2013-04-28 19:06 ` Junio C Hamano
2013-04-29 22:53   ` Ramsay Jones
2013-04-30 17:00     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517EECD4.800@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).