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

[PATCH] git-compat-util.h: don't define _XOPEN_SOURCE on cygwin

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Nov 23, 2014, 17:14 UTC
Message-ID
<5472160F.6030509@ramsay1.demon.co.uk>

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 seems to be caused by a change to the system headers which
results in the _XOPEN_SOURCE macro now having prioity over the
_GNU_SOURCE and _BSD_SOURCE macros (they are simply ignored).
This in turn leads to the declarations of the above functions
to be suppressed.

In order to suppress the warnings, don't define the _XOPEN_SOURCE macro on cygwin

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 git-compat-util.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 400e921..cef2691 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -75,7 +75,8 @@
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
       !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
-      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__)
+      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
+      !defined(__CYGWIN__)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
-- 
2.1.0
Message 1 of 1 in “git-compat-util.h: don't define _XOPEN_SOURCE on cygwin”
  1. git-compat-util.h: don't define _XOPEN_SOURCE on cygwinRamsay Jones, Nov 23, 2014

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.