Add configure test for garbage collector friendliness for GLib. If
[platform/upstream/glib.git] / glibconfig.h.win32.in
1 /* glibconfig.h.win32 */
2 /* Handcrafted for Microsoft C and gcc -mno-cygwin ("mingw32"). */
3
4 #ifndef GLIBCONFIG_H
5 #define GLIBCONFIG_H
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif /* __cplusplus */
10
11 #ifdef _MSC_VER
12 /* Make MSVC more pedantic, this is a recommended pragma list
13  * from _Win32_Programming_ by Rector and Newcomer.
14  */
15 #pragma warning(error:4002)
16 #pragma warning(error:4003)
17 #pragma warning(1:4010)
18 #pragma warning(error:4013)
19 #pragma warning(1:4016)
20 #pragma warning(error:4020)
21 #pragma warning(error:4021)
22 #pragma warning(error:4027)
23 #pragma warning(error:4029)
24 #pragma warning(error:4033)
25 #pragma warning(error:4035)
26 #pragma warning(error:4045)
27 #pragma warning(error:4047)
28 #pragma warning(error:4049)
29 #pragma warning(error:4053)
30 #pragma warning(error:4071)
31 #pragma warning(disable:4101)
32 #pragma warning(error:4150)
33
34 #pragma warning(disable:4244)   /* No possible loss of data warnings */
35 #pragma warning(disable:4305)   /* No truncation from int to char warnings */
36 #endif /* _MSC_VER */
37
38 #include <limits.h>
39 #include <float.h>
40
41 #define G_MINFLOAT      FLT_MIN
42 #define G_MAXFLOAT      FLT_MAX
43 #define G_MINDOUBLE     DBL_MIN
44 #define G_MAXDOUBLE     DBL_MAX
45 #define G_MINSHORT      SHRT_MIN
46 #define G_MAXSHORT      SHRT_MAX
47 #define G_MAXUSHORT     USHRT_MAX
48 #define G_MININT        INT_MIN
49 #define G_MAXINT        INT_MAX
50 #define G_MAXUINT       UINT_MAX
51 #define G_MINLONG       LONG_MIN
52 #define G_MAXLONG       LONG_MAX
53 #define G_MAXULONG      ULONG_MAX
54
55 typedef signed char gint8;
56 typedef unsigned char guint8;
57 typedef signed short gint16;
58 typedef unsigned short guint16;
59 #define G_GINT16_FORMAT "hi"
60 #define G_GUINT16_FORMAT "hu"
61 typedef signed int gint32;
62 typedef unsigned int guint32;
63 #define G_GINT32_FORMAT "i"
64 #define G_GUINT32_FORMAT "u"
65
66 #define G_HAVE_GINT64 1
67
68 /* These are compiler specific */
69 #ifdef _MSC_VER
70 typedef __int64 gint64;
71 typedef unsigned __int64 guint64;
72 #define G_GINT64_CONSTANT(val)  (val##i64)
73 #elif __GNUC__
74 typedef long long gint64;
75 typedef unsigned long long guint64;
76 #define G_GINT64_CONSTANT(val)  (val##LL)
77 #endif
78
79 /* These depend on the C library. Using this file means the we
80  * use the (bundled) Microsoft msvcrt.dll.
81  */
82 #define G_GINT64_FORMAT "I64i"
83 #define G_GUINT64_FORMAT "I64u"
84
85 #define GPOINTER_TO_INT(p)      ((gint)(p))
86 #define GPOINTER_TO_UINT(p)     ((guint)(p))
87
88 #define GINT_TO_POINTER(i)      ((gpointer)(i))
89 #define GUINT_TO_POINTER(u)     ((gpointer)(u))
90
91 #define g_ATEXIT(proc)  (atexit (proc))
92
93 #define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END
94
95 #define G_HAVE_ALLOCA 1
96 #ifdef _MSC_VER
97 #define alloca _alloca
98 #endif
99
100 #define GLIB_MAJOR_VERSION @GLIB_MAJOR_VERSION@
101 #define GLIB_MINOR_VERSION @GLIB_MINOR_VERSION@
102 #define GLIB_MICRO_VERSION @GLIB_MICRO_VERSION@
103
104 #define G_OS_WIN32
105
106 #ifdef  __cplusplus
107 #define G_HAVE_INLINE   1
108 #else   /* !__cplusplus */
109 #define G_HAVE___INLINE 1
110 #endif
111
112 #define G_THREADS_ENABLED
113 /*
114  * The following program can be used to determine the magic values below:
115  * #include <stdio.h>
116  * #include <pthread.h>
117  * main(int argc, char **argv)
118  * {
119  *   int i;
120  *   pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
121  *   printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t));
122  *   printf ("sizeof (pthread_t) = %d\n", sizeof (pthread_t));
123  *   printf ("PTHREAD_MUTEX_INITIALIZER = ");
124  *   for (i = 0; i < sizeof (pthread_mutex_t); i++)
125  *     printf ("%u, ", ((unsigned char *) &m)[i]);
126  *   printf ("\n");
127  *   exit(0);
128  * }
129  */
130
131 #define G_THREADS_IMPL_POSIX
132 typedef struct _GStaticMutex GStaticMutex;
133 struct _GStaticMutex
134 {
135   struct _GMutex *runtime_mutex;
136   union {
137     /* The size of the pad array should be sizeof (pthread_mutex_t) */
138     /* This value corresponds to the 1999-05-30 version of pthreads-win32 */
139     char   pad[4];
140     double dummy_double;
141     void  *dummy_pointer;
142     long   dummy_long;
143   } aligned_pad_u;
144 };
145 /* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */
146 #define G_STATIC_MUTEX_INIT     { NULL, { { 255, 255, 255, 255 } } }
147 #define g_static_mutex_get_mutex(mutex) \
148   (g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \
149    g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
150 /* This represents a system thread as used by the implementation. An
151  * alien implementaion, as loaded by g_thread_init can only count on
152  * "sizeof (gpointer)" bytes to store their info. We however need more
153  * for some of our native implementations. */
154 typedef union _GSystemThread GSystemThread;
155 union _GSystemThread
156 {
157   /* The size of the data array should be sizeof (pthread_t) */
158   /* This value corresponds to the 1999-05-30 version of pthreads-win32 */
159   char   data[4];
160   double dummy_double;
161   void  *dummy_pointer;
162   long   dummy_long;
163 };
164
165 #define GINT16_TO_LE(val)       ((gint16) (val))
166 #define GUINT16_TO_LE(val)      ((guint16) (val))
167 #define GINT16_TO_BE(val)       ((gint16) GUINT16_SWAP_LE_BE (val))
168 #define GUINT16_TO_BE(val)      (GUINT16_SWAP_LE_BE (val))
169
170 #define GINT32_TO_LE(val)       ((gint32) (val))
171 #define GUINT32_TO_LE(val)      ((guint32) (val))
172 #define GINT32_TO_BE(val)       ((gint32) GUINT32_SWAP_LE_BE (val))
173 #define GUINT32_TO_BE(val)      (GUINT32_SWAP_LE_BE (val))
174
175 #define GINT64_TO_LE(val)       ((gint64) (val))
176 #define GUINT64_TO_LE(val)      ((guint64) (val))
177 #define GINT64_TO_BE(val)       ((gint64) GUINT64_SWAP_LE_BE (val))
178 #define GUINT64_TO_BE(val)      (GUINT64_SWAP_LE_BE (val))
179
180 #define GLONG_TO_LE(val)        ((glong) GINT32_TO_LE (val))
181 #define GULONG_TO_LE(val)       ((gulong) GUINT32_TO_LE (val))
182 #define GLONG_TO_BE(val)        ((glong) GINT32_TO_BE (val))
183 #define GULONG_TO_BE(val)       ((gulong) GUINT32_TO_BE (val))
184
185 #define GINT_TO_LE(val)         ((gint) GINT32_TO_LE (val))
186 #define GUINT_TO_LE(val)        ((guint) GUINT32_TO_LE (val))
187 #define GINT_TO_BE(val)         ((gint) GINT32_TO_BE (val))
188 #define GUINT_TO_BE(val)        ((guint) GUINT32_TO_BE (val))
189 #define G_BYTE_ORDER G_LITTLE_ENDIAN
190
191 #define GLIB_SYSDEF_POLLIN      = 1
192 #define GLIB_SYSDEF_POLLOUT     = 4
193 #define GLIB_SYSDEF_POLLPRI     = 2
194 #define GLIB_SYSDEF_POLLERR     = 8
195 #define GLIB_SYSDEF_POLLHUP     = 16
196 #define GLIB_SYSDEF_POLLNVAL    = 32
197
198 #define G_HAVE_WCHAR_H 1
199 #define G_HAVE_WCTYPE_H 1
200
201 #ifdef __cplusplus
202 }
203 #endif /* __cplusplus */
204
205 #endif /* GLIBCONFIG_H */