threads / patch / 10838

patchFix a strchrnul() related build error

Subject: [PATCH] Fix a strchrnul() related build error

## tl;dr

3 messages between Nov 12, 2007 and Nov 12, 2007. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Emil Medve· Nov 12, 2007, 21:01 UTC · lore

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(-)
Show changes to git-compat-util.h +7 −1
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

← back to recent threads