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]

Make Unicode strings tests use __CHAR16_TYPE__ and __CHAR32_TYPE__


All the tests of u"" and U"" strings should be using __CHAR16_TYPE__ and 
__CHAR32_TYPE__ for their typedefs, since those won't always be typedefs 
for the same fixed types on all platforms.  I've applied this patch to 
trunk to make them use those predefines accordingly.  (This issue does not 
apply for C++ tests since there char16_t and char32_t are built-in types.)

Index: gcc.dg/utf32-2.c
===================================================================
--- gcc.dg/utf32-2.c	(revision 141655)
+++ gcc.dg/utf32-2.c	(working copy)
@@ -4,7 +4,7 @@
 /* { dg-xfail-run-if "PR36470" { "avr-*-*" } { "*" } { "" } } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef unsigned int char32_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf32-4.c
===================================================================
--- gcc.dg/utf32-4.c	(revision 141655)
+++ gcc.dg/utf32-4.c	(working copy)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99" } */
 
-typedef unsigned int char32_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 char32_t	c0 = U'';		/* { dg-error "empty character" } */
 char32_t	c1 = U'ab';		/* { dg-warning "constant too long" } */
Index: gcc.dg/utf16-2.c
===================================================================
--- gcc.dg/utf16-2.c	(revision 141655)
+++ gcc.dg/utf16-2.c	(working copy)
@@ -3,7 +3,7 @@
 /* { dg-do run } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef short unsigned int char16_t;
+typedef __CHAR16_TYPE__ char16_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf16-4.c
===================================================================
--- gcc.dg/utf16-4.c	(revision 141655)
+++ gcc.dg/utf16-4.c	(working copy)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99" } */
 
-typedef short unsigned int char16_t;
+typedef __CHAR16_TYPE__ char16_t;
 
 char16_t	c0 = u'';		/* { dg-error "empty character" } */
 char16_t	c1 = u'ab';		/* { dg-warning "constant too long" } */
Index: gcc.dg/utf-inc-init.c
===================================================================
--- gcc.dg/utf-inc-init.c	(revision 141655)
+++ gcc.dg/utf-inc-init.c	(working copy)
@@ -4,8 +4,8 @@
 /* { dg-options "-std=gnu99" } */
 
 typedef __SIZE_TYPE__ size_t;
-typedef short unsigned int char16_t;
-typedef unsigned int char32_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 extern int memcmp (const void *, const void *, size_t);
 extern void abort (void);
Index: gcc.dg/utf32-1.c
===================================================================
--- gcc.dg/utf32-1.c	(revision 141655)
+++ gcc.dg/utf32-1.c	(working copy)
@@ -4,7 +4,7 @@
 /* { dg-xfail-run-if "PR36470" { "avr-*-*" } { "*" } { "" } } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef unsigned int char32_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf32-3.c
===================================================================
--- gcc.dg/utf32-3.c	(revision 141655)
+++ gcc.dg/utf32-3.c	(working copy)
@@ -4,7 +4,7 @@
 /* { dg-xfail-run-if "PR36470" { "avr-*-*" } { "*" } { "" } } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef unsigned int char32_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf16-1.c
===================================================================
--- gcc.dg/utf16-1.c	(revision 141655)
+++ gcc.dg/utf16-1.c	(working copy)
@@ -3,7 +3,7 @@
 /* { dg-do run } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef short unsigned int char16_t;
+typedef __CHAR16_TYPE__ char16_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf16-3.c
===================================================================
--- gcc.dg/utf16-3.c	(revision 141655)
+++ gcc.dg/utf16-3.c	(working copy)
@@ -3,7 +3,7 @@
 /* { dg-do run } */
 /* { dg-options "-std=gnu99 -Wall -Werror" } */
 
-typedef short unsigned int char16_t;
+typedef __CHAR16_TYPE__ char16_t;
 
 extern void abort (void);
 
Index: gcc.dg/utf-cvt.c
===================================================================
--- gcc.dg/utf-cvt.c	(revision 141655)
+++ gcc.dg/utf-cvt.c	(working copy)
@@ -4,8 +4,8 @@
 /* { dg-excess-errors "short and int are 16bit" { target { "avr-*-*" } } } */
 /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
 
-typedef short unsigned int	char16_t;
-typedef unsigned int		char32_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 extern void f_c (char);
 extern void fsc (signed char);
Index: gcc.dg/utf-array-short-wchar.c
===================================================================
--- gcc.dg/utf-array-short-wchar.c	(revision 141655)
+++ gcc.dg/utf-array-short-wchar.c	(working copy)
@@ -5,8 +5,8 @@
 
 #include <wchar.h>
 
-typedef short unsigned int	char16_t;
-typedef unsigned int		char32_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
 
 const char	s_0[]	= "ab";
 const char	s_1[]	= u"ab";	/* { dg-error "from wide string" } */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 141655)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-11-06  Joseph Myers  <joseph@codesourcery.com>
+
+	* gcc.dg/utf-array-short-wchar.c, gcc.dg/utf-cvt.c,
+	gcc.dg/utf-inc-init.c, gcc.dg/utf16-1.c, gcc.dg/utf16-2.c,
+	gcc.dg/utf16-3.c, gcc.dg/utf16-4.c, gcc.dg/utf32-1.c,
+	gcc.dg/utf32-2.c, gcc.dg/utf32-3.c, gcc.dg/utf32-4.c: Use
+	__CHAR16_TYPE__ and __CHAR32_TYPE__ typedefs.
+
 2008-11-06  Richard Guenther  <rguenther@suse.de>
 
 	* gcc.dg/torture/pr37969.c: New testcase.

-- 
Joseph S. Myers
joseph@codesourcery.com


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