]>
git.proxmox.com Git - libgit2.git/blob - src/cc-compat.h
2 * Copyright (C) 2009-2012 the libgit2 contributors
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
7 #ifndef INCLUDE_compat_h__
8 #define INCLUDE_compat_h__
11 * See if our compiler is known to support flexible array members.
13 #ifndef GIT_FLEX_ARRAY
14 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
15 # define GIT_FLEX_ARRAY /* empty */
16 # elif defined(__GNUC__)
18 # define GIT_FLEX_ARRAY /* empty */
20 # define GIT_FLEX_ARRAY 0 /* older GNU extension */
24 /* Default to safer but a bit wasteful traditional style */
25 # ifndef GIT_FLEX_ARRAY
26 # define GIT_FLEX_ARRAY 1
31 # define GIT_TYPEOF(x) (__typeof__(x))
33 # define GIT_TYPEOF(x)
36 #define GIT_UNUSED(x) ((void)(x))
38 /* Define the printf format specifer to use for size_t output */
39 #if defined(_MSC_VER) || defined(__MINGW32__)
45 /* Micosoft Visual C/C++ */
47 /* disable "deprecated function" warnings */
48 # pragma warning ( disable : 4996 )
49 /* disable "conditional expression is constant" level 4 warnings */
50 # pragma warning ( disable : 4127 )
53 #if defined (_MSC_VER)
54 typedef unsigned char bool;
63 # define va_copy(dst, src) __va_copy(dst, src)
65 # define va_copy(dst, src) ((dst) = (src))
69 #endif /* INCLUDE_compat_h__ */