]>
git.proxmox.com Git - libgit2.git/blob - src/cc-compat.h
2 * Copyright (C) 2009-2011 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)
37 # define GIT_UNUSED(x)
40 # define GIT_UNUSED(x) x __attribute__ ((__unused__))
42 # define GIT_UNUSED(x) x
47 #define GIT_UNUSED_ARG(x) ((void)(x)); /* note trailing ; */
49 #define GIT_UNUSED_ARG(x)
53 * Does our compiler/platform support the C99 <inttypes.h> and
54 * <stdint.h> header files. (C99 requires that <inttypes.h>
55 * includes <stdint.h>).
57 #if !defined(_MSC_VER)
58 # define GIT_HAVE_INTTYPES_H 1
61 /* Define the printf format specifer to use for size_t output */
62 #if defined(_MSC_VER) || defined(__MINGW32__)
68 /* Micosoft Visual C/C++ */
70 /* disable "deprecated function" warnings */
71 # pragma warning ( disable : 4996 )
72 /* disable "conditional expression is constant" level 4 warnings */
73 # pragma warning ( disable : 4127 )
76 #endif /* INCLUDE_compat_h__ */