threads / patch / 33978

v3path: Fix a sparse warning

Subject: [PATCH v3] path: Fix a sparse warning

## tl;dr

One message between May 29, 2013 and May 29, 2013. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Ramsay Jones· May 29, 2013, 23:53 UTC · lore

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 its placement within an preprocessor conditional.

In order to suppress the warning, we simply move the declaration to the top level of the header.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Junio,

As promised, this fixes the build on cygwin. (tested on cygwin and MinGW. I have not tested on Linux, because I would have to re-boot twice, and I wanted to send this out tonight).

Again, sorry for breaking the build.

ATB, Ramsay Jones

 git-compat-util.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to git-compat-util.h +3 −1
diff --git a/git-compat-util.h b/git-compat-util.h
index 660b7f0..aa0404e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -127,6 +127,9 @@
 #else
 #include <poll.h>
 #endif
+
+extern int get_st_mode_bits(const char *path, int *mode);
+
 #if defined(__MINGW32__)
 /* pull in Windows compatibility stuff */
 #include "compat/mingw.h"
@@ -163,7 +166,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>
-- 
1.8.3

← back to recent threads