diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cc-compat.h | 55 | ||||
-rw-r--r-- | src/common.h | 3 | ||||
-rw-r--r-- | src/win32/msvc-compat.h | 50 | ||||
-rw-r--r-- | src/win32/posix.h | 3 |
4 files changed, 38 insertions, 73 deletions
diff --git a/src/cc-compat.h b/src/cc-compat.h index cce4ca9b1..c243f1d20 100644 --- a/src/cc-compat.h +++ b/src/cc-compat.h @@ -11,36 +11,36 @@ * See if our compiler is known to support flexible array members. */ #ifndef GIT_FLEX_ARRAY -# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define GIT_FLEX_ARRAY /* empty */ -# elif defined(__GNUC__) -# if (__GNUC__ >= 3) -# define GIT_FLEX_ARRAY /* empty */ -# else -# define GIT_FLEX_ARRAY 0 /* older GNU extension */ +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define GIT_FLEX_ARRAY /* empty */ +# elif defined(__GNUC__) +# if (__GNUC__ >= 3) +# define GIT_FLEX_ARRAY /* empty */ +# else +# define GIT_FLEX_ARRAY 0 /* older GNU extension */ +# endif # endif -# endif /* Default to safer but a bit wasteful traditional style */ -# ifndef GIT_FLEX_ARRAY -# define GIT_FLEX_ARRAY 1 -# endif +# ifndef GIT_FLEX_ARRAY +# define GIT_FLEX_ARRAY 1 +# endif #endif #ifdef __GNUC__ -# define GIT_TYPEOF(x) (__typeof__(x)) +# define GIT_TYPEOF(x) (__typeof__(x)) #else -# define GIT_TYPEOF(x) +# define GIT_TYPEOF(x) #endif #ifdef __cplusplus -# define GIT_UNUSED(x) +# define GIT_UNUSED(x) #else -# ifdef __GNUC__ -# define GIT_UNUSED(x) x __attribute__ ((__unused__)) -# else -# define GIT_UNUSED(x) x -# endif +# ifdef __GNUC__ +# define GIT_UNUSED(x) x __attribute__ ((__unused__)) +# else +# define GIT_UNUSED(x) x +# endif #endif #if defined(_MSC_VER) @@ -49,28 +49,19 @@ #define GIT_UNUSED_ARG(x) #endif -/* - * Does our compiler/platform support the C99 <inttypes.h> and - * <stdint.h> header files. (C99 requires that <inttypes.h> - * includes <stdint.h>). - */ -#if !defined(_MSC_VER) -# define GIT_HAVE_INTTYPES_H 1 -#endif - /* Define the printf format specifer to use for size_t output */ #if defined(_MSC_VER) || defined(__MINGW32__) -# define PRIuZ "Iu" +# define PRIuZ "Iu" #else -# define PRIuZ "zu" +# define PRIuZ "zu" #endif /* Micosoft Visual C/C++ */ #if defined(_MSC_VER) /* disable "deprecated function" warnings */ -# pragma warning ( disable : 4996 ) +# pragma warning ( disable : 4996 ) /* disable "conditional expression is constant" level 4 warnings */ -# pragma warning ( disable : 4127 ) +# pragma warning ( disable : 4127 ) #endif #endif /* INCLUDE_compat_h__ */ diff --git a/src/common.h b/src/common.h index f4ea1ebf7..f7a41d47e 100644 --- a/src/common.h +++ b/src/common.h @@ -11,9 +11,6 @@ #include "git2/thread-utils.h" #include "cc-compat.h" -#ifdef GIT_HAVE_INTTYPES_H -# include <inttypes.h> -#endif #include <assert.h> #include <errno.h> #include <limits.h> diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h index 64ed18476..93a123f96 100644 --- a/src/win32/msvc-compat.h +++ b/src/win32/msvc-compat.h @@ -10,48 +10,28 @@ #if defined(_MSC_VER) /* access() mode parameter #defines */ -# define F_OK 0 /* existence check */ -# define W_OK 2 /* write mode check */ -# define R_OK 4 /* read mode check */ +# define F_OK 0 /* existence check */ +# define W_OK 2 /* write mode check */ +# define R_OK 4 /* read mode check */ -# define lseek _lseeki64 -# define stat _stat64 -# define fstat _fstat64 +# define lseek _lseeki64 +# define stat _stat64 +# define fstat _fstat64 /* stat: file mode type testing macros */ -# define _S_IFLNK 0120000 -# define S_IFLNK _S_IFLNK +# define _S_IFLNK 0120000 +# define S_IFLNK _S_IFLNK -# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) -# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) -# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) +# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) +# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) +# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) -# define mode_t unsigned short +# define mode_t unsigned short /* case-insensitive string comparison */ -# define strcasecmp _stricmp -# define strncasecmp _strnicmp - -#if (_MSC_VER >= 1600) -# include <stdint.h> -#else -/* add some missing <stdint.h> typedef's */ -typedef signed char int8_t; -typedef unsigned char uint8_t; - -typedef short int16_t; -typedef unsigned short uint16_t; - -typedef long int32_t; -typedef unsigned long uint32_t; - -typedef long long int64_t; -typedef unsigned long long uint64_t; - -typedef long long intmax_t; -typedef unsigned long long uintmax_t; -#endif +# define strcasecmp _stricmp +# define strncasecmp _strnicmp #endif diff --git a/src/win32/posix.h b/src/win32/posix.h index 6d783222e..442717e42 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -11,9 +11,6 @@ #include "fnmatch.h" #include "utf8-conv.h" -/* Define the printf format for 64 bit types */ -#define PRId64 "I64d" - GIT_INLINE(int) p_link(const char *GIT_UNUSED(old), const char *GIT_UNUSED(new)) { GIT_UNUSED_ARG(old) |