This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add win32/win64 compatibility definitions to stddef.h


The following patch adds _WIN32/_WIN64 compatibility
definitions to gcc's stddef.h.  OK for trunk and the
4.4 branch?  (Note: I don't have write access.)

--
Ozkan


	* gcc/ginclude/stddef.h: Add _WIN32/_WIN64 compatibility
	definitions.

--- gcc/ginclude/stddef.h~	2009-08-24 10:04:06.000000000 +0300
+++ gcc/ginclude/stddef.h	2009-08-24 14:44:40.000000000 +0300
@@ -144,7 +144,11 @@ _TYPE_wchar_t;
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
 #ifndef __PTRDIFF_TYPE__
+#if defined(_WIN64)
+#define __PTRDIFF_TYPE__ long long int
+#else
 #define __PTRDIFF_TYPE__ long int
+#endif  /* _WIN64 */
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #endif /* _GCC_PTRDIFF_T */
@@ -205,7 +209,11 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define __size_t
 #endif
 #ifndef __SIZE_TYPE__
+#if defined(_WIN64)
+#define __SIZE_TYPE__ long long unsigned int
+#else
 #define __SIZE_TYPE__ long unsigned int
+#endif  /* _WIN64 */
 #endif
 #if !(defined (__GNUG__) && defined (size_t))
 typedef __SIZE_TYPE__ size_t;
@@ -317,8 +325,12 @@ typedef __rune_t        rune_t;
 #endif

 #ifndef __WCHAR_TYPE__
+#if defined(_WIN32)
+#define __WCHAR_TYPE__ unsigned short /* for MS runtime compatibility */
+#else
 #define __WCHAR_TYPE__ int
-#endif
+#endif  /* _WIN32 */
+#endif  /* __WCHAR_TYPE__ */
 #ifndef __cplusplus
 typedef __WCHAR_TYPE__ wchar_t;
 #endif
@@ -347,8 +359,12 @@ typedef __WCHAR_TYPE__ wchar_t;
 #define _WINT_T

 #ifndef __WINT_TYPE__
+#if defined(_WIN32)
+#define __WINT_TYPE__ unsigned short  /* for MS runtime compatibility */
+#else
 #define __WINT_TYPE__ unsigned int
-#endif
+#endif  /* _WIN32 */
+#endif  /* __WINT_TYPE__ */
 typedef __WINT_TYPE__ wint_t;
 #endif
 #undef __need_wint_t
@@ -393,13 +409,17 @@ typedef __WINT_TYPE__ wint_t;

 #if defined (_STDDEF_H) || defined (__need_NULL)
 #undef NULL		/* in case <stdio.h> has defined it. */
-#ifdef __GNUG__
+#if defined(__GNUG__) && __GNUG__ >= 3
 #define NULL __null
 #else   /* G++ */
 #ifndef __cplusplus
 #define NULL ((void *)0)
 #else   /* C++ */
+#ifndef _WIN64
 #define NULL 0
+#else
+#define NULL 0LL
+#endif  /* W64 */
 #endif  /* C++ */
 #endif  /* G++ */
 #endif	/* NULL not defined and <stddef.h> or need NULL.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]