[PATCH] Fix a strchrnul() related build error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux