[PATCH] Undefine strlcpy if needed.
On OS X, strlcpy is already #define'd, which causes warnings in all the files that include `git-compat-util.h'. Note that this only occurs when building without running ./configure. Signed-off-by: Benoit Sigoure --- Resending with the SOB line I forgot. git-compat-util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index f587749..8c001e2 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -495,6 +495,9 @@ extern char *gitstrcasestr(const char *haystack, const char *needle); #endif #ifdef NO_STRLCPY +#ifdef strlcpy +#undef strlcpy +#endif #define strlcpy gitstrlcpy extern size_t gitstrlcpy(char *, const char *, size_t); #endif -- 1.9.2.460.gfb82504 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Undefine strlcpy if needed.
On OS X, strlcpy is already #define'd, which causes warnings in all the files that include `git-compat-util.h'. Note that this only occurs when building without running ./configure. --- git-compat-util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index f587749..8c001e2 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -495,6 +495,9 @@ extern char *gitstrcasestr(const char *haystack, const char *needle); #endif #ifdef NO_STRLCPY +#ifdef strlcpy +#undef strlcpy +#endif #define strlcpy gitstrlcpy extern size_t gitstrlcpy(char *, const char *, size_t); #endif -- 1.9.2.460.gfb82504 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Cleanly redefine (v)snprintf when needed.
When we detect that vsnprintf / snprintf are broken, we #define them to an alternative implementation. On OS X, stdio.h already #define's them, which causes a warning to be issued at the point we re-define them in `git-compat-util.h'. Signed-off-by: Benoit Sigoure --- git-compat-util.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index cbd86c3..614a5e9 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*); #endif #ifdef SNPRINTF_RETURNS_BOGUS +#ifdef snprintf +#undef snprintf +#endif #define snprintf git_snprintf extern int git_snprintf(char *str, size_t maxsize, const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintf extern int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap); -- 1.9.rc1.1.g186f0be.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Cleanly redefine (v)snprintf when needed.
When we detect that vsnprintf / snprintf are broken, we #define them to an alternative implementation. On OS X, stdio.h already #define's them, which causes a warning to be issued at the point we re-define them in `git-compat-util.h'. --- git-compat-util.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index cbd86c3..614a5e9 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*); #endif #ifdef SNPRINTF_RETURNS_BOGUS +#ifdef snprintf +#undef snprintf +#endif #define snprintf git_snprintf extern int git_snprintf(char *str, size_t maxsize, const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintf extern int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap); -- 1.9.rc1.1.g186f0be.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Revert "compat/unsetenv.c: Fix a sparse warning"
This reverts commit ec535cc27e6c4f5e0b1d157e04f5511f166ecd9d. POSIX explicitly states "the [environ] variable, which must be declared by the user if it is to be used directly". Not declaring it causes compilation to fail on OS X. Instead don't declare the variable on MinGW, as it causes a spurious warning there. Signed-off-by: Benoit Sigoure --- Resending as I forgot to Sign-off the previous patch. compat/unsetenv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..bf5fd70 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -2,6 +2,9 @@ void gitunsetenv (const char *name) { +#if !defined(__MINGW32__) + extern char **environ; +#endif int src, dst; size_t nmln; -- 1.8.2.1.539.g4196a96 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Revert "compat/unsetenv.c: Fix a sparse warning"
This reverts commit ec535cc27e6c4f5e0b1d157e04f5511f166ecd9d. POSIX explicitly states "the [environ] variable, which must be declared by the user if it is to be used directly". Not declaring it causes compilation to fail on OS X. Instead don't declare the variable on MinGW, as it causes a spurious warning there. --- compat/unsetenv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..bf5fd70 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -2,6 +2,9 @@ void gitunsetenv (const char *name) { +#if !defined(__MINGW32__) + extern char **environ; +#endif int src, dst; size_t nmln; -- 1.8.2.1.539.g4196a96 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fix compilation on OS X.
On OS X libc headers don't define `environ', and since ec535cc2 removed the redundant declaration this code no longer builds on OS X. --- Makefile | 5 + config.mak.uname | 1 + git-compat-util.h | 4 3 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 0600eb4..774db18 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,8 @@ all:: # # Define NO_UNSETENV if you don't have unsetenv in the C library. # +# Define NO_EXT_ENVIRON if your C library doesn't define `environ'. +# # Define NO_MKDTEMP if you don't have mkdtemp in the C library. # # Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash. @@ -1307,6 +1309,9 @@ ifdef NO_UNSETENV COMPAT_CFLAGS += -DNO_UNSETENV COMPAT_OBJS += compat/unsetenv.o endif +ifdef NO_EXT_ENVIRON + COMPAT_CFLAGS += -DNO_EXT_ENVIRON +endif ifdef NO_SYS_SELECT_H BASIC_CFLAGS += -DNO_SYS_SELECT_H endif diff --git a/config.mak.uname b/config.mak.uname index 7ac541e..ebcfbfd 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -93,6 +93,7 @@ ifeq ($(uname_S),Darwin) NO_STRLCPY = YesPlease endif NO_MEMMEM = YesPlease +NO_EXT_ENVIRON = UnfortunatelyYes USE_ST_TIMESPEC = YesPlease HAVE_DEV_TTY = YesPlease NEEDS_CLIPPED_WRITE = YesPlease diff --git a/git-compat-util.h b/git-compat-util.h index ff193f4..3bac4e9 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -408,6 +408,10 @@ extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); */ extern ssize_t read_in_full(int fd, void *buf, size_t count); +#ifdef NO_EXT_ENVIRON +extern char **environ; +#endif + #ifdef NO_SETENV #define setenv gitsetenv extern int gitsetenv(const char *, const char *, int); -- 1.8.2.1.539.g4196a96 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fix compilation on OS X.
On OS X libc headers don't define `environ', and since ec535cc2 removed the redundant declaration this code no longer builds on OS X. --- compat/unsetenv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..addf3dc 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -1,5 +1,10 @@ #include "../git-compat-util.h" +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + void gitunsetenv (const char *name) { int src, dst; -- 1.8.2.1.539.g4196a96 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html