From: Junio C Hamano Date: Fri, 26 Jun 2015 06:03:25 +0000 (-0700) Subject: Merge branch 'cb/array-size' into maint X-Git-Tag: v2.5.0-rc1~5^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b1f0802e9127b117bae7a4cfdc81495f7a9a09f3?hp=-c Merge branch 'cb/array-size' into maint * cb/array-size: Fix definition of ARRAY_SIZE for non-gcc builds --- b1f0802e9127b117bae7a4cfdc81495f7a9a09f3 diff --combined git-compat-util.h index 3be44f146b,079b99d7a4..af5af22680 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -58,15 -58,13 +58,13 @@@ #define BUILD_ASSERT_OR_ZERO(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) - #if defined(__GNUC__) && (__GNUC__ >= 3) - # if GIT_GNUC_PREREQ(3, 1) + #if GIT_GNUC_PREREQ(3, 1) /* &arr[0] degrades to a pointer: a different type from an array */ # define BARF_UNLESS_AN_ARRAY(arr) \ BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(__typeof__(arr), \ __typeof__(&(arr)[0]))) - # else - # define BARF_UNLESS_AN_ARRAY(arr) 0 - # endif + #else + # define BARF_UNLESS_AN_ARRAY(arr) 0 #endif /* * ARRAY_SIZE - get the number of elements in a visible array @@@ -127,8 -125,7 +125,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 @@@ -179,9 -176,6 +177,9 @@@ #else #include #endif +#ifdef HAVE_BSD_SYSCTL +#include +#endif #if defined(__MINGW32__) /* pull in Windows compatibility stuff */ @@@ -219,10 -213,16 +217,10 @@@ typedef long intptr_t; typedef unsigned long uintptr_t; #endif -#if defined(__CYGWIN__) -#undef _XOPEN_SOURCE -#include -#define _XOPEN_SOURCE 600 -#else #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include #define _ALL_SOURCE 1 #endif -#endif /* used on Mac OS X */ #ifdef PRECOMPOSE_UNICODE @@@ -261,18 -261,8 +259,18 @@@ extern char *gitbasename(char *) #endif #ifndef NO_OPENSSL +#ifdef __APPLE__ +#define __AVAILABILITY_MACROS_USES_AVAILABILITY 0 +#include +#undef DEPRECATED_ATTRIBUTE +#define DEPRECATED_ATTRIBUTE +#undef __AVAILABILITY_MACROS_USES_AVAILABILITY +#endif #include #include +#ifdef NO_HMAC_CTX_CLEANUP +#define HMAC_CTX_cleanup HMAC_cleanup +#endif #endif /* On most systems would have given us this, but @@@ -534,40 -524,6 +532,40 @@@ extern int git_munmap(void *start, size #define on_disk_bytes(st) ((st).st_blocks * 512) #endif +#ifdef NEEDS_MODE_TRANSLATION +#undef S_IFMT +#undef S_IFREG +#undef S_IFDIR +#undef S_IFLNK +#undef S_IFBLK +#undef S_IFCHR +#undef S_IFIFO +#undef S_IFSOCK +#define S_IFMT 0170000 +#define S_IFREG 0100000 +#define S_IFDIR 0040000 +#define S_IFLNK 0120000 +#define S_IFBLK 0060000 +#define S_IFCHR 0020000 +#define S_IFIFO 0010000 +#define S_IFSOCK 0140000 +#ifdef stat +#undef stat +#endif +#define stat(path, buf) git_stat(path, buf) +extern int git_stat(const char *, struct stat *); +#ifdef fstat +#undef fstat +#endif +#define fstat(fd, buf) git_fstat(fd, buf) +extern int git_fstat(int, struct stat *); +#ifdef lstat +#undef lstat +#endif +#define lstat(path, buf) git_lstat(path, buf) +extern int git_lstat(const char *, struct stat *); +#endif + #define DEFAULT_PACKED_GIT_LIMIT \ ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256)) @@@ -717,7 -673,6 +715,7 @@@ extern char *xstrndup(const char *str, extern void *xrealloc(void *ptr, size_t size); extern void *xcalloc(size_t nmemb, size_t size); extern void *xmmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); +extern void *xmmap_gently(void *start, size_t length, int prot, int flags, int fd, off_t offset); extern ssize_t xread(int fd, void *buf, size_t len); extern ssize_t xwrite(int fd, const void *buf, size_t len); extern ssize_t xpread(int fd, void *buf, size_t len, off_t offset); @@@ -731,11 -686,6 +729,11 @@@ extern char *xgetcwd(void) #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), (alloc) * sizeof(*(x))) +static inline char *xstrdup_or_null(const char *str) +{ + return str ? xstrdup(str) : NULL; +} + static inline size_t xsize_t(off_t len) { if (len > (size_t) len) @@@ -744,7 -694,7 +742,7 @@@ } /* in ctype.c, for kwset users */ -extern const char tolower_trans_tbl[256]; +extern const unsigned char tolower_trans_tbl[256]; /* Sane ctype - no locale, and works with signed chars */ #undef isascii @@@ -928,12 -878,4 +926,12 @@@ struct tm *git_gmtime_r(const time_t * #define gmtime_r git_gmtime_r #endif +#if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__) +#define USE_PARENS_AROUND_GETTEXT_N 1 +#endif + +#ifndef SHELL_PATH +# define SHELL_PATH "/bin/sh" +#endif + #endif