Skip to content

Commit 3a0a3a8

Browse files
Ramsay Jonesgitster
authored andcommitted
git-compat-util.h: don't define _XOPEN_SOURCE on cygwin
A recent update to the gcc compiler (v4.8.3-5 x86_64) on 64-bit cygwin leads to several new warnings about the implicit declaration of the memmem(), strlcpy() and strcasestr() functions. For example: CC archive.o archive.c: In function 'format_subst': archive.c:44:3: warning: implicit declaration of function 'memmem' \ [-Wimplicit-function-declaration] b = memmem(src, len, "$Format:", 8); ^ archive.c:44:5: warning: assignment makes pointer from integer \ without a cast [enabled by default] b = memmem(src, len, "$Format:", 8); ^ This is because <string.h> on Cygwin used to always declare the above functions, but a recent version of it no longer make them visible when _XOPEN_SOURCE is set (even if _GNU_SOURCE and _BSD_SOURCE is set). In order to suppress the warnings, don't define the _XOPEN_SOURCE macro on cygwin. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7fa1365 commit 3a0a3a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-compat-util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
# endif
7676
#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
7777
!defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
78-
!defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__)
78+
!defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
79+
!defined(__CYGWIN__)
7980
#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
8081
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
8182
#endif

0 commit comments

Comments
 (0)