Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2011 09:27:02 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r224472 - in projects/arm_eabi: include sys/arm/include sys/sys
Message-ID:  <201107280927.p6S9R2iE094264@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Jul 28 09:27:01 2011
New Revision: 224472
URL: http://svn.freebsd.org/changeset/base/224472

Log:
  Add support for an unsigned wchar_t required by the ARM EABI.
  
  To do this I have:
  * Moved the wchar_t typedef to machine/_types.h
  * Moved the definitions of WCHAR_MIN and WCHAR_MAX to machine/_wchar.h

Added:
  projects/arm_eabi/sys/arm/include/_wchar.h
Modified:
  projects/arm_eabi/include/wchar.h
  projects/arm_eabi/sys/arm/include/_stdint.h
  projects/arm_eabi/sys/arm/include/_types.h
  projects/arm_eabi/sys/sys/_types.h

Modified: projects/arm_eabi/include/wchar.h
==============================================================================
--- projects/arm_eabi/include/wchar.h	Thu Jul 28 03:11:12 2011	(r224471)
+++ projects/arm_eabi/include/wchar.h	Thu Jul 28 09:27:01 2011	(r224472)
@@ -64,6 +64,7 @@
 #include <sys/_null.h>
 #include <sys/_types.h>
 #include <machine/_limits.h>
+#include <machine/_wchar.h>
 #include <_ctype.h>
 
 #ifndef _MBSTATE_T_DECLARED
@@ -88,11 +89,6 @@ typedef	__wint_t	wint_t;
 #define	_WINT_T_DECLARED
 #endif
 
-#ifndef	WCHAR_MIN 
-#define	WCHAR_MIN	__INT_MIN
-#define	WCHAR_MAX	__INT_MAX
-#endif
-
 #ifndef WEOF
 #define	WEOF 	((wint_t)-1)
 #endif

Modified: projects/arm_eabi/sys/arm/include/_stdint.h
==============================================================================
--- projects/arm_eabi/sys/arm/include/_stdint.h	Thu Jul 28 03:11:12 2011	(r224471)
+++ projects/arm_eabi/sys/arm/include/_stdint.h	Thu Jul 28 09:27:01 2011	(r224472)
@@ -52,6 +52,8 @@
 
 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
 
+#include <machine/_wchar.h>
+
 /*
  * ISO/IEC 9899:1999
  * 7.18.2.1 Limits of exact-width integer types
@@ -149,12 +151,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: projects/arm_eabi/sys/arm/include/_types.h
==============================================================================
--- projects/arm_eabi/sys/arm/include/_types.h	Thu Jul 28 03:11:12 2011	(r224471)
+++ projects/arm_eabi/sys/arm/include/_types.h	Thu Jul 28 09:27:01 2011	(r224472)
@@ -120,4 +120,10 @@ typedef	char *			__va_list;
 typedef __va_list		__gnuc_va_list;	/* compatibility w/GNU headers*/
 #endif
 
+#ifdef __ARM_EABI__
+typedef unsigned int	__wchar_t;
+#else
+typedef int		__wchar_t;
+#endif
+
 #endif /* !_MACHINE__TYPES_H_ */

Added: projects/arm_eabi/sys/arm/include/_wchar.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/arm/include/_wchar.h	Thu Jul 28 09:27:01 2011	(r224472)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE__WCHAR_H_
+#define _MACHINE__WCHAR_H_
+
+/*
+ * Limits of wchar_t. __UINT_MAX and __INT_{MIN,MAX} are used as UINT32_MAX
+ * and INT32_{MIN,MAX} are not always defined when this is included.
+ */
+#ifdef __ARM_EABI__
+#define	WCHAR_MIN	(0)
+#define	WCHAR_MAX	__UINT_MAX
+#else
+#define	WCHAR_MIN	__INT_MIN
+#define	WCHAR_MAX	__INT_MAX
+#endif
+
+#endif /* _ARM_INCLUDE__WCHAR_H_ */
+

Modified: projects/arm_eabi/sys/sys/_types.h
==============================================================================
--- projects/arm_eabi/sys/sys/_types.h	Thu Jul 28 03:11:12 2011	(r224471)
+++ projects/arm_eabi/sys/sys/_types.h	Thu Jul 28 09:27:01 2011	(r224472)
@@ -86,7 +86,6 @@ typedef int		__cpusetid_t;	/* cpuset ide
  */
 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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107280927.p6S9R2iE094264>