* testsuite/23_containers/bitset_members.cc: Add test variable.
* testsuite/23_containers/map_insert.cc: Same.
* testsuite/22_locale/ctype/cons/char/1.cc: Same.
* testsuite/22_locale/codecvt/max_length/wchar_t/1.cc: Same.
* testsuite/22_locale/codecvt/max_length/wchar_t/2.cc: Same.
* testsuite/22_locale/codecvt/max_length/wchar_t/3.cc: Same.
* testsuite/22_locale/codecvt/max_length/wchar_t/4.cc: Same.
* testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc: Same.
* testsuite/22_locale/codecvt/always_noconv/wchar_t/2.cc: Same.
* testsuite/22_locale/codecvt/always_noconv/wchar_t/3.cc: Same.
* testsuite/22_locale/codecvt/always_noconv/wchar_t/4.cc: Same.
* testsuite/27_io/istream_exception.cc: Same.
* testsuite/27_io/filebuf_virtuals.cc: Same.
* testsuite/27_io/stringbuf_virtuals.cc: Same.
* testsuite/27_io/ostream_inserter_arith.cc: Same.
* testsuite/26_numerics/valarray_operators.cc: Same.
* testsuite/26_numerics/slice.cc: Same.
* testsuite/26_numerics/slice_array_assignment.cc: Same.
* testsuite/24_iterators/istream_iterator.cc: Same.
* mkcheck.in (TESTS_FILE): Use dejagnu-generated file if possible.
2003-03-14 Petur Runolfsson <peturr02@ru.is>
PR libstdc++/9581
PR libstdc++/9870
* config/locale/generic/ctype_members.cc,
* config/locale/gnu/ctype_members.cc
(ctype<wchar_t>::do_widen(char)): Cast argument to
unsigned char before passing to btowc.
(ctype<wchar_t>::do_widen(const char*, const char*, wchar_t*)):
Convert characters with btowc instead of mbsrtowcs.
(ctype<wchar_t>::do_narrow(const wchar_t*, const wchar_t*,
char, char*):
Convert characters with wctob instead of wcsrtombs.
* testsuite/22_locale/ctype/narrow/wchar_t/3.cc: New test.
* testsuite/22_locale/ctype/widen/wchar_t/2.cc: New test.
* testsuite/22_locale/ctype/widen/wchar_t/3.cc: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64391
138bc75d-0d04-0410-961f-
82ee72b054a4
2003-03-14 Benjamin Kosnik <bkoz@redhat.com>
+ * testsuite/23_containers/bitset_members.cc: Add test variable.
+ * testsuite/23_containers/map_insert.cc: Same.
+ * testsuite/22_locale/ctype/cons/char/1.cc: Same.
+ * testsuite/22_locale/codecvt/max_length/wchar_t/1.cc: Same.
+ * testsuite/22_locale/codecvt/max_length/wchar_t/2.cc: Same.
+ * testsuite/22_locale/codecvt/max_length/wchar_t/3.cc: Same.
+ * testsuite/22_locale/codecvt/max_length/wchar_t/4.cc: Same.
+ * testsuite/22_locale/codecvt/always_noconv/wchar_t/1.cc: Same.
+ * testsuite/22_locale/codecvt/always_noconv/wchar_t/2.cc: Same.
+ * testsuite/22_locale/codecvt/always_noconv/wchar_t/3.cc: Same.
+ * testsuite/22_locale/codecvt/always_noconv/wchar_t/4.cc: Same.
+ * testsuite/27_io/istream_exception.cc: Same.
+ * testsuite/27_io/filebuf_virtuals.cc: Same.
+ * testsuite/27_io/stringbuf_virtuals.cc: Same.
+ * testsuite/27_io/ostream_inserter_arith.cc: Same.
+ * testsuite/26_numerics/valarray_operators.cc: Same.
+ * testsuite/26_numerics/slice.cc: Same.
+ * testsuite/26_numerics/slice_array_assignment.cc: Same.
+ * testsuite/24_iterators/istream_iterator.cc: Same.
+ * mkcheck.in (TESTS_FILE): Use dejagnu-generated file if possible.
+
+2003-03-14 Petur Runolfsson <peturr02@ru.is>
+
+ PR libstdc++/9581
+ PR libstdc++/9870
+ * config/locale/generic/ctype_members.cc,
+ * config/locale/gnu/ctype_members.cc
+ (ctype<wchar_t>::do_widen(char)): Cast argument to
+ unsigned char before passing to btowc.
+ (ctype<wchar_t>::do_widen(const char*, const char*, wchar_t*)):
+ Convert characters with btowc instead of mbsrtowcs.
+ (ctype<wchar_t>::do_narrow(const wchar_t*, const wchar_t*,
+ char, char*):
+ Convert characters with wctob instead of wcsrtombs.
+ * testsuite/22_locale/ctype/narrow/wchar_t/3.cc: New test.
+ * testsuite/22_locale/ctype/widen/wchar_t/2.cc: New test.
+ * testsuite/22_locale/ctype/widen/wchar_t/3.cc: New test.
+
+2003-03-14 Benjamin Kosnik <bkoz@redhat.com>
+
* include/stdc++.h: New.
* libsupc++/exception_defines.h (__EXCEPTION_DEFINES_H): Add guard.
* include/Makefile.am (stamp-std-precompile): Generate stdc++.h.gch
wchar_t
ctype<wchar_t>::
do_widen(char __c) const
- { return btowc(__c); }
+ { return btowc(static_cast<unsigned char>(__c)); }
const char*
ctype<wchar_t>::
do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
{
- mbstate_t __state;
- memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
- mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
+ while (__lo < __hi)
+ {
+ *__dest = btowc(static_cast<unsigned char>(*__lo));
+ ++__lo;
+ ++__dest;
+ }
return __hi;
}
do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
char* __dest) const
{
- size_t __offset = 0;
- while (true)
+ while (__lo < __hi)
{
- const wchar_t* __start = __lo + __offset;
- size_t __len = __hi - __start;
-
- mbstate_t __state;
- memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
- size_t __con = wcsrtombs(__dest + __offset, &__start, __len, &__state);
- if (__con != __len && __start != 0)
- {
- __offset = __start - __lo;
- __dest[__offset++] = __dfault;
- }
- else
- break;
+ int __c = wctob(*__lo);
+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+ ++__lo;
+ ++__dest;
}
return __hi;
}
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __uselocale(_M_c_locale_ctype);
#endif
- wchar_t __ret = btowc(__c);
+ wchar_t __ret = btowc(static_cast<unsigned char>(__c));
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
#endif
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __uselocale(_M_c_locale_ctype);
#endif
- mbstate_t __state;
- memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
- mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
+ while (__lo < __hi)
+ {
+ *__dest = btowc(static_cast<unsigned char>(*__lo));
+ ++__lo;
+ ++__dest;
+ }
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
#endif
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __uselocale(_M_c_locale_ctype);
#endif
- size_t __offset = 0;
- while (true)
+ while (__lo < __hi)
{
- const wchar_t* __start = __lo + __offset;
- size_t __len = __hi - __start;
-
- mbstate_t __state;
- memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
- size_t __con = wcsrtombs(__dest + __offset, &__start, __len, &__state);
- if (__con != __len && __start != 0)
- {
- __offset = __start - __lo;
- __dest[__offset++] = __dfault;
- }
- else
- break;
+ int __c = wctob(*__lo);
+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+ ++__lo;
+ ++__dest;
}
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);
# Make a list of the files we're going to run, or use an old one if it exists.
if [ ! -f "$TESTS_FILE" ]; then
+ if [ -f "$TEST_DIR/testsuite_files" ]; then
+ cp $TEST_DIR/testsuite_files $TESTS_FILE
+ else
echo "making file $TESTS_FILE"
for LONG_NAME in $SRC_DIR/testsuite/*/*.cc
do
SHORT_NAME="`basename $DIR_NAME`/`basename $LONG_NAME`"
echo "$SHORT_NAME" >> $TESTS_FILE
done
+ fi
fi
# Nasty solution to replace GNU date(1)'s %s time_t output function.
void test01()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc;
void test02()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.ISO-8859-1");
void test03()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.ISO-8859-15");
void test04()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.UTF-8");
void test01()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc_c = locale::classic();
void test02()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.ISO-8859-1");
void test03()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.ISO-8859-15");
void test04()
{
using namespace std;
+ bool test = true;
typedef codecvt<wchar_t, char, mbstate_t> w_codecvt;
locale loc ("en_US.UTF-8");
void test01()
{
using namespace std;
-
+ bool test = true;
+
comma_ctype obj;
const ctype_base::mask* tmp = obj.get_classic_table();
--- /dev/null
+// 2003-03-12 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<wchar_t> members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/9581
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ locale loc ("se_NO.UTF-8");
+ const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc);
+
+ const wchar_t* wstrlit = L"\x80";
+
+ char buf[2];
+ wct.narrow(wstrlit, wstrlit + 2, ' ', buf);
+ VERIFY( buf[0] == wct.narrow(wstrlit[0], ' ') );
+ VERIFY( buf[1] == wct.narrow(wstrlit[1], ' ') );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 2003-03-12 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<wchar_t> members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/9870
+void test02()
+{
+ using namespace std;
+ bool test = true;
+
+ locale loc ("en_US.ISO-8859-1");
+ const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc);
+
+ char c = 0xff;
+ wchar_t wc = wct.widen(c);
+
+ VERIFY( wc == static_cast<wchar_t>(0xff) );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 2003-03-12 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<wchar_t> members
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/9581
+void test03()
+{
+ using namespace std;
+ bool test = true;
+
+ locale loc ("se_NO.UTF-8");
+ const ctype<wchar_t>& wct = use_facet<ctype<wchar_t> >(loc);
+
+ const char* strlit = "\xc2\x80";
+
+ wchar_t wbuf[3];
+ wct.widen(strlit, strlit + 3, wbuf);
+ VERIFY( wbuf[0] == wct.widen(strlit[0]) );
+ VERIFY( wbuf[1] == wct.widen(strlit[1]) );
+ VERIFY( wbuf[2] == wct.widen(strlit[2]) );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
// 2001-06-03 pme
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
void test03()
{
+ bool test = true;
std::bitset<5> b;
std::stringstream ss ("101");
// 2001-08-23 pme & Sylvain.Pion@sophia.inria.fr
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01375.html
void test01()
{
+ bool test = true;
typedef std::map<int, int> Map;
Map M;
Map::iterator hint;
// 2002-03-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// libstdc++/6886
void test02()
{
+ bool test = true;
typedef std::vector<bool> bvec;
int i, num = 0;
bvec v;
// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
void test02()
{
using namespace std;
+ bool test = true;
string st("R.Rorty");
// 20020717 gdr
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
int main()
{
+ bool test = true;
std::srand(20020717); using std::rand;
VERIFY(construction(rand(), rand(), rand()));
// 20010613 gdr
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
int main()
{
+ bool test = true;
using std::valarray;
using std::slice;
valarray<int> v(1, 10), w(2, 10);
void test01() // check unary operators
{
+ bool test = true;
std::valarray<int> u(1);
u[0]=1;
void test02() // check binary operators
{
+ bool test = true;
std::valarray<int> u(1), v(1);
u[0]=1;
v[0]=3;
public:
static bool eq(char c1, char c2)
{
+ bool test = true;
VERIFY( c1 != 'X' );
VERIFY( c2 != 'X' );
return std::char_traits<char>::eq(c1, c2);
void test01()
{
using namespace std;
+ bool test = true;
buf b;
std::istream strm (&b);
// 1999-11-15 Kevin Ediger <kediger@licor.com>
// test the floating point inserters (facet num_put)
-// Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
int
test05()
{
+ bool test = true;
double pi = 3.14159265358979323846;
ostringstream ostr;
ostr.precision(20);
int
test06()
{
+ bool test = true;
int prec = numeric_limits<double>::digits10 + 2;
double oval = numeric_limits<double>::min();
void test02(std::stringbuf& in, bool pass)
{
+ bool test = true;
using namespace std;
typedef streambuf::pos_type pos_type;
typedef streambuf::off_type off_type;