[PATCH] fix wide character literal use in some test cases
Jan Beulich
JBeulich@novell.com
Fri Jan 6 12:53:00 GMT 2006
This abstracts the use of constants for calls to wmemset() in some of
the
test cases. On targets with 16-bit wide characters or with
-fshort-wchar
using 32-bit literals results in compiler warnings, respectively
leading to
failures of these tests.
I'd like to ask at once for approval to apply the same patch to the 4.1
tree.
Bootstrapped and tested on x86_64-unknown-linux-gnu and
i686-pc-linux-gnu,
and built and tested for i686-novell-netware built on
i686-pc-linux-gnu.
libstdc++-v3/
2006-01-06 Jan Beulich <jbeulich@novell.com>
* testsuite/22_locale/codecvt/in/wchar_t/1.cc (DEADBEAF): New.
(test01): Use it.
* testsuite/22_locale/codecvt/in/wchar_t/5.cc: Likewise.
* testsuite/22_locale/codecvt/in/wchar_t/6.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc: Likewise.
---
/home/jbeulich/src/gcc/trunk/2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc 2005-12-01
10:49:25.000000000 +0100
+++
2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/1.cc 2005-12-06
17:42:33.000000000 +0100
@@ -23,6 +23,12 @@
#include <locale>
#include <testsuite_hooks.h>
+#if __WCHAR_MAX__ > 0xffff
+# define DEADBEEF 0xdeadbeef
+#else
+# define DEADBEEF 0xdead
+#endif
+
// Need to explicitly set the state(mbstate_t) to zero.
// How to do this is not specified by the ISO C99 standard, so we
// might need to add some operators to make the intuiative case
@@ -56,8 +62,8 @@ void test01()
int size = strlen(e_lit);
int_type* i_arr = new int_type[size + 1];
int_type* i_ref = new int_type[size + 1];
- wmemset(i_arr, 0xdeadbeef, size + 1);
- wmemset(i_ref, 0xdeadbeef, size + 1);
+ wmemset(i_arr, DEADBEEF, size + 1);
+ wmemset(i_ref, DEADBEEF, size + 1);
int_type* ito_next;
locale loc;
---
/home/jbeulich/src/gcc/trunk/2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/5.cc 2005-12-01
10:49:25.000000000 +0100
+++
2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/5.cc 2005-12-06
17:42:25.000000000 +0100
@@ -23,6 +23,12 @@
#include <locale>
#include <testsuite_hooks.h>
+#if __WCHAR_MAX__ > 0xffff
+# define DEADBEEF 0xdeadbeef
+#else
+# define DEADBEEF 0xdead
+#endif
+
// Need to explicitly set the state(mbstate_t) to zero.
// How to do this is not specified by the ISO C99 standard, so we
// might need to add some operators to make the intuiative case
@@ -57,8 +63,8 @@ void test05()
int size = sizeof(e_lit);
int_type* i_arr = new int_type[size + 1];
int_type* i_ref = new int_type[size + 1];
- wmemset(i_arr, 0xdeadbeef, size + 1);
- wmemset(i_ref, 0xdeadbeef, size + 1);
+ wmemset(i_arr, DEADBEEF, size + 1);
+ wmemset(i_ref, DEADBEEF, size + 1);
int_type* ito_next;
locale loc;
---
/home/jbeulich/src/gcc/trunk/2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/6.cc 2005-12-01
10:49:25.000000000 +0100
+++
2006-01-04/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/6.cc 2005-12-06
17:42:14.000000000 +0100
@@ -23,6 +23,12 @@
#include <locale>
#include <testsuite_hooks.h>
+#if __WCHAR_MAX__ > 0xffff
+# define DEADBEEF 0xdeadbeef
+#else
+# define DEADBEEF 0xdead
+#endif
+
// Need to explicitly set the state(mbstate_t) to zero.
// How to do this is not specified by the ISO C99 standard, so we
// might need to add some operators to make the intuiative case
@@ -57,8 +63,8 @@ void test06()
int size = strlen(e_lit);
int_type* i_arr = new int_type[size + 1];
int_type* i_ref = new int_type[size + 1];
- wmemset(i_arr, 0xdeadbeef, size + 1);
- wmemset(i_ref, 0xdeadbeef, size + 1);
+ wmemset(i_arr, DEADBEEF, size + 1);
+ wmemset(i_ref, DEADBEEF, size + 1);
int_type* ito_next;
locale loc;
---
/home/jbeulich/src/gcc/trunk/2006-01-04/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc 2005-12-01
10:49:22.000000000 +0100
+++
2006-01-04/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc 2005-12-06
17:42:06.000000000 +0100
@@ -21,6 +21,12 @@
#include <ext/stdio_sync_filebuf.h>
#include <testsuite_hooks.h>
+#if __WCHAR_MAX__ > 0xffff
+# define DEADBEEF 0xdeadbeef
+#else
+# define DEADBEEF 0xdead
+#endif
+
void test01()
{
using namespace std;
@@ -50,7 +56,7 @@ void test01()
VERIFY( getwc(fin) == L'X' );
wchar_t buf[5];
- wmemset(buf, 0xdeadbeef, 5);
+ wmemset(buf, DEADBEEF, 5);
VERIFY( wsbuf.sgetn(buf, 5) == 5 );
VERIFY( !wmemcmp(buf, w_lit + 3, 5) );
VERIFY( traits_type::to_char_type(getwc(fin)) == w_lit[8] );
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc-trunk-libstdc++-testsuite-short-wchar_t.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20060106/65cf8c77/attachment.ksh>
More information about the Libstdc++
mailing list