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

[PATCH] Fix a strchrnul() related build error

From
EMEmil Medve <emilian.medve@freescale.com>
Date
Nov 12, 2007, 21:01 UTC
Message-ID
<1194901282-2468-1-git-send-email-Emilian.Medve@Freescale.com>

Systems/environments without glibc (such as CygWin), and as a consequence whithout the __GLIBC_PREREQ() macro, fail to build with the following error message:

    CC git.o
In file included from builtin.h:4,
                 from git.c:1:
git-compat-util.h:187:48: missing binary operator before token "("
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---
Here is a relevant comment from my Linux box features.h:
/* Convenience macros to test the versions of glibc and gcc.
   Use them like this:
   #if __GNUC_PREREQ (2,8)
   ... code requiring gcc 2.8 or later ...
   #endif
   Note - they won't work for gcc1 or glibc1, since the _MINOR macros
   were not defined then.  */
My CygWin gcc version is:

$ gcc -dumpversion 3.4.4

This applies to next
 git-compat-util.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 3d147b6..c4ed308 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -184,7 +184,13 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
                 const void *needle, size_t needlelen);
 #endif
 
-#if !defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 1)
+#ifndef __GLIBC_PREREQ
+#define NO_STRCHRNUL
+#elif !__GLIBC_PREREQ(2, 1)
+#define NO_STRCHRNUL
+#endif
+
+#ifdef NO_STRCHRNUL
 #define strchrnul gitstrchrnul
 static inline char *gitstrchrnul(const char *s, int c)
 {
-- 
1.5.3.5.1466.gfa36
Next: Johannes Schindelin
Message 1 of 3 in “Fix a strchrnul() related build error”
  1. Fix a strchrnul() related build errorEmil Medve, Nov 12, 2007
  2. Johannes SchindelinNov 12, 2007
  3. Medve EmilianNov 12, 2007

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.