Author: andrew
Date: Sun Jun 24 04:15:58 2012
New Revision: 237517
URL: http://svn.freebsd.org/changeset/base/237517

Log:
  Make the wchar_t type machine dependent.
  
  This is required for ARM EABI. Section 7.1.1 of the Procedure Call for the
  ARM Architecture (AAPCS) defines wchar_t as either an unsigned int or an
  unsigned short with the former preferred.
  
  Because of this requirement we need to move the definition of __wchar_t to
  a machine dependent header. It also cleans up the macros defining the limits
  of wchar_t by defining __WCHAR_MIN and __WCHAR_MAX in the same machine
  dependent header then using them to define WCHAR_MIN and WCHAR_MAX
  respectively.
  
  Discussed with:       bde

Modified:
  head/include/wchar.h
  head/sys/arm/include/_stdint.h
  head/sys/arm/include/_types.h
  head/sys/ia64/include/_stdint.h
  head/sys/ia64/include/_types.h
  head/sys/mips/include/_stdint.h
  head/sys/mips/include/_types.h
  head/sys/powerpc/include/_stdint.h
  head/sys/powerpc/include/_types.h
  head/sys/sparc64/include/_stdint.h
  head/sys/sparc64/include/_types.h
  head/sys/sys/_types.h
  head/sys/sys/stdint.h
  head/sys/x86/include/_stdint.h
  head/sys/x86/include/_types.h

Modified: head/include/wchar.h
==============================================================================
--- head/include/wchar.h        Sun Jun 24 01:32:42 2012        (r237516)
+++ head/include/wchar.h        Sun Jun 24 04:15:58 2012        (r237517)
@@ -88,10 +88,8 @@ typedef      __wint_t        wint_t;
 #define        _WINT_T_DECLARED
 #endif
 
-#ifndef        WCHAR_MIN 
-#define        WCHAR_MIN       __INT_MIN
-#define        WCHAR_MAX       __INT_MAX
-#endif
+#define        WCHAR_MIN       __WCHAR_MIN
+#define        WCHAR_MAX       __WCHAR_MAX
 
 #ifndef WEOF
 #define        WEOF    ((wint_t)-1)

Modified: head/sys/arm/include/_stdint.h
==============================================================================
--- head/sys/arm/include/_stdint.h      Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/arm/include/_stdint.h      Sun Jun 24 04:15:58 2012        
(r237517)
@@ -149,12 +149,6 @@
 /* Limit of size_t. */
 #define        SIZE_MAX        UINT32_MAX
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/arm/include/_types.h
==============================================================================
--- head/sys/arm/include/_types.h       Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/arm/include/_types.h       Sun Jun 24 04:15:58 2012        
(r237517)
@@ -105,6 +105,16 @@ typedef    __uint32_t      __vm_paddr_t;
 typedef        __uint64_t      __vm_pindex_t;
 typedef        __uint32_t      __vm_size_t;
 
+#ifdef __ARM_EABI__
+typedef        unsigned int    __wchar_t;
+#define        __WCHAR_MIN     0               /* min value for a wchar_t */
+#define        __WCHAR_MAX     __UINT_MAX      /* max value for a wchar_t */
+#else
+typedef        int             __wchar_t;
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
+#endif
+
 /*
  * Unusual type definitions.
  */

Modified: head/sys/ia64/include/_stdint.h
==============================================================================
--- head/sys/ia64/include/_stdint.h     Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/ia64/include/_stdint.h     Sun Jun 24 04:15:58 2012        
(r237517)
@@ -149,12 +149,6 @@
 /* Limit of size_t. */
 #define        SIZE_MAX        UINT64_MAX
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/ia64/include/_types.h
==============================================================================
--- head/sys/ia64/include/_types.h      Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/ia64/include/_types.h      Sun Jun 24 04:15:58 2012        
(r237517)
@@ -96,6 +96,10 @@ typedef      __int64_t       __vm_ooffset_t;
 typedef        __uint64_t      __vm_paddr_t;
 typedef        __uint64_t      __vm_pindex_t;
 typedef        __uint64_t      __vm_size_t;
+typedef        int             __wchar_t;
+
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.

Modified: head/sys/mips/include/_stdint.h
==============================================================================
--- head/sys/mips/include/_stdint.h     Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/mips/include/_stdint.h     Sun Jun 24 04:15:58 2012        
(r237517)
@@ -186,12 +186,6 @@
 #define        SIG_ATOMIC_MIN  INT32_MIN
 #define        SIG_ATOMIC_MAX  INT32_MAX
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/mips/include/_types.h
==============================================================================
--- head/sys/mips/include/_types.h      Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/mips/include/_types.h      Sun Jun 24 04:15:58 2012        
(r237517)
@@ -145,6 +145,10 @@ typedef    __uint32_t      __vm_paddr_t;
 
 typedef        __int64_t       __vm_ooffset_t;
 typedef        __uint64_t      __vm_pindex_t;
+typedef        int             __wchar_t;
+
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.

Modified: head/sys/powerpc/include/_stdint.h
==============================================================================
--- head/sys/powerpc/include/_stdint.h  Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/powerpc/include/_stdint.h  Sun Jun 24 04:15:58 2012        
(r237517)
@@ -189,12 +189,6 @@
 #define        SIZE_MAX        UINT32_MAX
 #endif
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/powerpc/include/_types.h
==============================================================================
--- head/sys/powerpc/include/_types.h   Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/powerpc/include/_types.h   Sun Jun 24 04:15:58 2012        
(r237517)
@@ -133,6 +133,10 @@ typedef    __uint32_t      __vm_size_t;
 #endif
 typedef        __int64_t       __vm_ooffset_t;
 typedef        __uint64_t      __vm_pindex_t;
+typedef        int             __wchar_t;
+
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.

Modified: head/sys/sparc64/include/_stdint.h
==============================================================================
--- head/sys/sparc64/include/_stdint.h  Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/sparc64/include/_stdint.h  Sun Jun 24 04:15:58 2012        
(r237517)
@@ -149,12 +149,6 @@
 /* Limit of size_t. */
 #define        SIZE_MAX        UINT64_MAX
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/sparc64/include/_types.h
==============================================================================
--- head/sys/sparc64/include/_types.h   Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/sparc64/include/_types.h   Sun Jun 24 04:15:58 2012        
(r237517)
@@ -92,6 +92,10 @@ typedef      __int64_t       __vm_ooffset_t;
 typedef        __uint64_t      __vm_paddr_t;
 typedef        __uint64_t      __vm_pindex_t;
 typedef        __uint64_t      __vm_size_t;
+typedef        int             __wchar_t;
+
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.

Modified: head/sys/sys/_types.h
==============================================================================
--- head/sys/sys/_types.h       Sun Jun 24 01:32:42 2012        (r237516)
+++ head/sys/sys/_types.h       Sun Jun 24 04:15:58 2012        (r237517)
@@ -80,14 +80,13 @@ typedef int         __cpusetid_t;   /* cpuset ide
  * ANSI C), but they use __ct_rune_t instead of int.
  *
  * NOTE: rune_t is not covered by ANSI nor other standards, and should not
- * be instantiated outside of lib/libc/locale.  Use wchar_t.  wchar_t and
- * rune_t must be the same type.  Also, wint_t must be no narrower than
- * wchar_t, and should be able to hold all members of the largest
- * character set plus one extra value (WEOF), and must be at least 16 bits.
+ * be instantiated outside of lib/libc/locale.  Use wchar_t.  wint_t and
+ * rune_t must be the same type.  Also, wint_t should be able to hold all
+ * members of the largest character set plus one extra value (WEOF), and
+ * must be at least 16 bits.
  */
 typedef        int             __ct_rune_t;    /* arg type for ctype funcs */
 typedef        __ct_rune_t     __rune_t;       /* rune_t (see above) */
-typedef        __ct_rune_t     __wchar_t;      /* wchar_t (see above) */
 typedef        __ct_rune_t     __wint_t;       /* wint_t (see above) */
 
 typedef        __uint32_t      __dev_t;        /* device number */

Modified: head/sys/sys/stdint.h
==============================================================================
--- head/sys/sys/stdint.h       Sun Jun 24 01:32:42 2012        (r237516)
+++ head/sys/sys/stdint.h       Sun Jun 24 04:15:58 2012        (r237517)
@@ -71,4 +71,8 @@ typedef       __uintmax_t             uintmax_t;
 #define        __WORDSIZE              32
 #endif
 
+/* Limits of wchar_t. */
+#define        WCHAR_MIN       __WCHAR_MIN
+#define        WCHAR_MAX       __WCHAR_MAX
+
 #endif /* !_SYS_STDINT_H_ */

Modified: head/sys/x86/include/_stdint.h
==============================================================================
--- head/sys/x86/include/_stdint.h      Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/x86/include/_stdint.h      Sun Jun 24 04:15:58 2012        
(r237517)
@@ -180,12 +180,6 @@
 #define        SIZE_MAX        UINT32_MAX
 #endif
 
-#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
-/* Limits of wchar_t. */
-#define        WCHAR_MIN       INT32_MIN
-#define        WCHAR_MAX       INT32_MAX
-#endif
-
 /* Limits of wint_t. */
 #define        WINT_MIN        INT32_MIN
 #define        WINT_MAX        INT32_MAX

Modified: head/sys/x86/include/_types.h
==============================================================================
--- head/sys/x86/include/_types.h       Sun Jun 24 01:32:42 2012        
(r237516)
+++ head/sys/x86/include/_types.h       Sun Jun 24 04:15:58 2012        
(r237517)
@@ -142,6 +142,10 @@ typedef    __uint32_t      __vm_size_t;
 #endif
 typedef        __int64_t       __vm_ooffset_t;
 typedef        __uint64_t      __vm_pindex_t;
+typedef        int             __wchar_t;
+
+#define        __WCHAR_MIN     __INT_MIN       /* min value for a wchar_t */
+#define        __WCHAR_MAX     __INT_MAX       /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to