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

Re: [PATCH 2/6] path: Make the 'get_st_mode_bits' symbol a file static

From
Torsten Bögershausen <tboegi@web.de>
Date
Apr 28, 2013, 06:02 UTC
Message-ID
<517CBB6E.205@web.de>
In-Reply-To
<517C1BF9.2050604@ramsay1.demon.co.uk>
On 2013-04-27 20.42, Ramsay Jones wrote:
Show 43 quoted lines
> 
> 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.

It should be in git compat-util.h, so that both compat/cygwin.c and path.c can see it.
So from my understanding, it should be placed here:
(I will send an official patch later)
/Torsten
 
diff -C 3 git-compat-util.h.~9526aa461f6c6900cb892a6fe248150ad436c0d~ git-compat-util.h.new
*** git-compat-util.h.~9526aa461f6c6900cb892a6fe248150ad436c0d~ 2013-04-28 07:53:28.000000000 +0200
--- git-compat-util.h.new       2013-04-28 07:53:58.000000000 +0200
***************
*** 127,132 ****
--- 127,133 ----
  #else
  #include <poll.h>
  #endif
+ int get_st_mode_bits(const char *path, int *mode);
  #if defined(__MINGW32__)
  /* pull in Windows compatibility stuff */
  #include "compat/mingw.h"
***************
*** 163,169 ****
  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>
Previous: Eric SunshineNext: Torsten Bögershausen
Message 3 of 8 in “path: Make the 'get_st_mode_bits' symbol a file static”
  1. 2/6 path: Make the 'get_st_mode_bits' symbol a file staticRamsay Jones, Apr 27, 2013
  2. Eric SunshineApr 28, 2013
  3. Torsten BögershausenApr 28, 2013
  4. Torsten BögershausenApr 28, 2013
  5. Ramsay JonesApr 29, 2013
  6. Junio C HamanoApr 28, 2013
  7. Ramsay JonesApr 29, 2013
  8. Junio C HamanoApr 30, 2013

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.