From 74dc547e24c143e53bdcfdc02a718cf09abbf0f2 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sun, 24 Jun 2012 04:15:58 +0000 Subject: 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 --- include/wchar.h | 6 ++---- sys/arm/include/_stdint.h | 6 ------ sys/arm/include/_types.h | 10 ++++++++++ sys/ia64/include/_stdint.h | 6 ------ sys/ia64/include/_types.h | 4 ++++ sys/mips/include/_stdint.h | 6 ------ sys/mips/include/_types.h | 4 ++++ sys/powerpc/include/_stdint.h | 6 ------ sys/powerpc/include/_types.h | 4 ++++ sys/sparc64/include/_stdint.h | 6 ------ sys/sparc64/include/_types.h | 4 ++++ sys/sys/_types.h | 9 ++++----- sys/sys/stdint.h | 4 ++++ sys/x86/include/_stdint.h | 6 ------ sys/x86/include/_types.h | 4 ++++ 15 files changed, 40 insertions(+), 45 deletions(-) diff --git a/include/wchar.h b/include/wchar.h index 1ebb72f58223..9e8d807c5f27 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -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) diff --git a/sys/arm/include/_stdint.h b/sys/arm/include/_stdint.h index 2a4f75afb4e5..50861284d8bc 100644 --- a/sys/arm/include/_stdint.h +++ b/sys/arm/include/_stdint.h @@ -149,12 +149,6 @@ /* Limit of size_t. */ #define SIZE_MAX UINT32_MAX -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h index 338c19c11136..7915d0b7cafd 100644 --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -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. */ diff --git a/sys/ia64/include/_stdint.h b/sys/ia64/include/_stdint.h index e36c6598861b..cb3b1a230595 100644 --- a/sys/ia64/include/_stdint.h +++ b/sys/ia64/include/_stdint.h @@ -149,12 +149,6 @@ /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/ia64/include/_types.h b/sys/ia64/include/_types.h index 66ac0ccb6c4b..2876648d6674 100644 --- a/sys/ia64/include/_types.h +++ b/sys/ia64/include/_types.h @@ -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. diff --git a/sys/mips/include/_stdint.h b/sys/mips/include/_stdint.h index cf183733b224..510b8eae32c8 100644 --- a/sys/mips/include/_stdint.h +++ b/sys/mips/include/_stdint.h @@ -186,12 +186,6 @@ #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/mips/include/_types.h b/sys/mips/include/_types.h index a92f7fb2363d..ba0ee302aec2 100644 --- a/sys/mips/include/_types.h +++ b/sys/mips/include/_types.h @@ -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. diff --git a/sys/powerpc/include/_stdint.h b/sys/powerpc/include/_stdint.h index a014ac69f51e..6ad1fd257d43 100644 --- a/sys/powerpc/include/_stdint.h +++ b/sys/powerpc/include/_stdint.h @@ -189,12 +189,6 @@ #define SIZE_MAX UINT32_MAX #endif -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h index 8c09ae741f53..55ec0617318a 100644 --- a/sys/powerpc/include/_types.h +++ b/sys/powerpc/include/_types.h @@ -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. diff --git a/sys/sparc64/include/_stdint.h b/sys/sparc64/include/_stdint.h index e36c6598861b..cb3b1a230595 100644 --- a/sys/sparc64/include/_stdint.h +++ b/sys/sparc64/include/_stdint.h @@ -149,12 +149,6 @@ /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h index 5899401ff29c..aa8a299a2f81 100644 --- a/sys/sparc64/include/_types.h +++ b/sys/sparc64/include/_types.h @@ -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. diff --git a/sys/sys/_types.h b/sys/sys/_types.h index c59afd31cb55..27ecaf4f0e12 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -80,14 +80,13 @@ typedef int __cpusetid_t; /* cpuset identifier. */ * 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 */ diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h index aa5ac81d1017..762e8795496a 100644 --- a/sys/sys/stdint.h +++ b/sys/sys/stdint.h @@ -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_ */ diff --git a/sys/x86/include/_stdint.h b/sys/x86/include/_stdint.h index 903b9e7e97c7..d9ee3166236b 100644 --- a/sys/x86/include/_stdint.h +++ b/sys/x86/include/_stdint.h @@ -180,12 +180,6 @@ #define SIZE_MAX UINT32_MAX #endif -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* 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 diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h index e2806e56a424..2d6bfbca2bb7 100644 --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -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. -- cgit v1.2.3