From f51140c2470b50bcaff63b850f5e258c23d5853d Mon Sep 17 00:00:00 2001 From: David Michael Date: Sun, 26 Oct 2014 13:33:12 -0400 Subject: [PATCH 1/3] git-compat-util.h: support variadic macros with the XL C compiler When the XL C compiler is run with an appropriate language level or suboption, it defines a feature test macro to indicate support for variadic macros by defining __C99_MACRO_WITH_VA_ARGS C preprocessor macro. This was tested on z/OS, but it should also work on AIX according to IBM documentation. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- git-compat-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index f587749b7c..bf3a053a26 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -750,7 +750,7 @@ void git_qsort(void *base, size_t nmemb, size_t size, #endif #endif -#if defined(__GNUC__) || (_MSC_VER >= 1400) +#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__C99_MACRO_WITH_VA_ARGS) #define HAVE_VARIADIC_MACROS 1 #endif From 48a031af3cc555e0eb9d30b96f2e0943de7c44ae Mon Sep 17 00:00:00 2001 From: David Michael Date: Sun, 26 Oct 2014 13:33:53 -0400 Subject: [PATCH 2/3] Makefile: reorder linker flags in the git executable rule The XL C compiler can fail due to mixing library path and object file arguments, for example when linking git while building with "gmake LDFLAGS=-L$prefix/lib". Move the ALL_LDFLAGS variable expansion in the git executable rule to be consistent with all the other linking rules, namely to have LDFLAGS such as -L$where before the object files *.o being linked together. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9f984a9e55..4c6847a0be 100644 --- a/Makefile +++ b/Makefile @@ -1735,8 +1735,8 @@ git.sp git.s git.o: EXTRA_CPPFLAGS = \ '-DGIT_INFO_PATH="$(infodir_relative_SQ)"' git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \ - $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) git.o \ + $(BUILTIN_OBJS) $(LIBS) help.sp help.s help.o: common-cmds.h From bfb0e6fcd2826a869383b766712131a07a8059b0 Mon Sep 17 00:00:00 2001 From: David Michael Date: Sun, 26 Oct 2014 13:34:26 -0400 Subject: [PATCH 3/3] compat/bswap.h: detect endianness from XL C compiler macros There is no /usr/include/endian.h equivalent on z/OS, but the compiler will define macros to indicate endianness on host and target hardware. This adds a test for these macros as a last resort for determining byte order. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- compat/bswap.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compat/bswap.h b/compat/bswap.h index f6fd9a6a6c..7fed637ed0 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -122,6 +122,10 @@ static inline uint64_t git_bswap64(uint64_t x) # define GIT_BYTE_ORDER GIT_BIG_ENDIAN # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) # define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN +# elif defined(__THW_BIG_ENDIAN__) && !defined(__THW_LITTLE_ENDIAN__) +# define GIT_BYTE_ORDER GIT_BIG_ENDIAN +# elif defined(__THW_LITTLE_ENDIAN__) && !defined(__THW_BIG_ENDIAN__) +# define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN # else # error "Cannot determine endianness" # endif