summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/objects/char
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/27_io/objects/char
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/objects/char')
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/1.cc97
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/10.cc75
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc56
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc88
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3045.cc77
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3647.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/3_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/41037.cc35
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/4_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5.cc84
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5268.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc34
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/7.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/8.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc99
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/dr455.cc36
39 files changed, 1551 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/1.cc b/libstdc++-v3/testsuite/27_io/objects/char/1.cc
new file mode 100644
index 000000000..ea57f0892
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/1.cc
@@ -0,0 +1,97 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// Make sure all the standard streams are defined.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ char array1[20];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i = 15;
+ ctraits_type::copy(array1, "testing istream", i);
+ array1[i] = '\0';
+ std::cout << "testing cout" << std::endl;
+ std::cerr << "testing cerr" << std::endl;
+ VERIFY( std::cerr.flags() & std::ios_base::unitbuf );
+ std::clog << "testing clog" << std::endl;
+ // std::cin >> array1; // requires somebody to type something in.
+ VERIFY( std::cin.tie() == &std::cout );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/10.cc b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
new file mode 100644
index 000000000..eebebc20e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
@@ -0,0 +1,75 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009, 2010 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+// { dg-require-binary-io "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void test10()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "filebuf_virtuals-1.txt";
+
+ FILE* ret = freopen(name, "r", stdin);
+ VERIFY( ret );
+
+ streampos p1 = cin.tellg();
+ VERIFY( p1 != streampos(-1) );
+ VERIFY( streamoff(p1) == 0 );
+
+ cin.seekg(0, ios::end);
+ VERIFY( cin.good() );
+
+ streampos p2 = cin.tellg();
+ VERIFY( p2 != streampos(-1) );
+ VERIFY( p2 != p1 );
+ VERIFY( streamoff(p2) == ftell(stdin) );
+
+ cin.seekg(p1);
+ VERIFY( cin.good() );
+
+ streamoff n = p2 - p1;
+ VERIFY( n > 0 );
+
+ for (int i = 0; i < n; ++i)
+ {
+ streampos p3 = cin.tellg();
+ VERIFY( streamoff(p3) == i );
+ VERIFY( ftell(stdin) == i );
+ cin.get();
+ VERIFY( cin.good() );
+ }
+
+ streampos p4 = cin.tellg();
+ VERIFY( streamoff(p4) == n );
+ VERIFY( ftell(stdin) == n );
+ cin.get();
+ VERIFY( cin.eof() );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc
new file mode 100644
index 000000000..e4982c5e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc
@@ -0,0 +1,46 @@
+// Derived from libstdc++/12048 by LJR <ljrittle@acm.org> with
+// reminder from Petur Runolfsson <peturr02@ru.is>.
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ char c1;
+ char c2;
+ std::cin.get(c1);
+ std::cin.unget();
+ std::cin.get(c2);
+ VERIFY( std::cin.good() );
+ VERIFY( c1 == c2 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc
new file mode 100644
index 000000000..f18e5d393
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2003, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ char c1;
+ int c2;
+ std::cin.get(c1);
+ std::cin.unget();
+ VERIFY( std::cin.good() );
+ c2 = std::fgetc(stdin);
+ VERIFY( c2 == std::char_traits<char>::to_int_type(c1) );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc
new file mode 100644
index 000000000..3b83ef176
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ char buf[2];
+ VERIFY( std::cin.rdbuf()->sgetn(buf, 2) == 2 );
+ int c1 = std::cin.rdbuf()->sungetc();
+ int c2 = std::cin.rdbuf()->sbumpc();
+ VERIFY( c1 == std::char_traits<char>::to_int_type(buf[1]) );
+ VERIFY( c2 == c1 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc
new file mode 100644
index 000000000..0f8600dbb
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2003, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ char buf[2];
+ VERIFY( std::cin.rdbuf()->sgetn(buf, 2) == 2 );
+ int c1 = std::cin.rdbuf()->sungetc();
+ int c2 = std::fgetc(stdin);
+ VERIFY( c1 == std::char_traits<char>::to_int_type(buf[1]) );
+ VERIFY( c2 == c1 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc b/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc
new file mode 100644
index 000000000..dd544b737
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc
@@ -0,0 +1,56 @@
+// Derived from libstdc++/12048 by LJR <ljrittle@acm.org> with
+// reminder from Petur Runolfsson <peturr02@ru.is>.
+
+// Copyright (C) 2003, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// DR 49 states that cin.rdbuf()->sbumpc() and fgetc(stdin) should be
+// equivalent and interchangable. Currently however, cin.rdbuf()->sungetc()
+// only returns characters that were read with cin.rdbuf()->sbumpc()
+
+// { dg-require-fileio "" }
+
+// { dg-do run { xfail *-*-* } }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ char c1;
+ int c2;
+ char c3;
+ std::cin.get(c1);
+ c2 = std::fgetc(stdin);
+ std::cin.unget();
+ if (std::cin.good())
+ {
+ std::cin.get(c3);
+ VERIFY( std::cin.good() );
+ VERIFY( c3 == std::char_traits<char>::to_char_type(c2) );
+ }
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2.cc b/libstdc++-v3/testsuite/27_io/objects/char/2.cc
new file mode 100644
index 000000000..286ba4fd9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2.cc
@@ -0,0 +1,46 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// assign stderr to stdout in shell command line,
+// pipe stdout to cat process and/or redirect stdout to file.
+// a.out >& output
+// "hello fine world\n" should be written to stdout, and output, in
+// proper order. This is a version of the scott snyder test taken
+// from: http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00108.html
+void test04()
+{
+ using namespace std;
+
+ cout << "hello ";
+ cout.flush();
+ cerr << "fine ";
+ cerr.flush();
+ cout << "world" << endl;
+ cout.flush();
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc
new file mode 100644
index 000000000..cc9516a95
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.cc
@@ -0,0 +1,88 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// libstdc++/2523
+void test02()
+{
+ using namespace std;
+ int i;
+ cin >> i;
+ cout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in
new file mode 100644
index 000000000..ec308096e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-1_xin.in
@@ -0,0 +1 @@
+5588885
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc
new file mode 100644
index 000000000..302f158ea
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.cc
@@ -0,0 +1,38 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/2523
+void test03()
+{
+ using namespace std;
+ ios_base::sync_with_stdio(false);
+
+ int i;
+ cin >> i;
+ cout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in
new file mode 100644
index 000000000..aaee5e562
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/2523-2_xin.in
@@ -0,0 +1 @@
+33332
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3045.cc b/libstdc++-v3/testsuite/27_io/objects/char/3045.cc
new file mode 100644
index 000000000..9720e9634
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3045.cc
@@ -0,0 +1,77 @@
+// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+class gnu_filebuf: public std::filebuf
+{
+ int i;
+public:
+ gnu_filebuf(int j = 1): i(j) { }
+ ~gnu_filebuf() { --i; }
+ int get_i() { return i;}
+};
+
+const int initial = 4;
+gnu_filebuf buf(initial);
+
+// libstdc++/3045, in a vague way.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ int k1;
+
+ // 1 normal
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::cout.rdbuf(&buf);
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+
+ // 2 syncd off
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::cout.rdbuf(&buf);
+ std::ios_base::sync_with_stdio(false); // make sure doesn't clobber buf
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+
+ // 3 callling init
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::cout.rdbuf(&buf);
+ std::ios_base::Init make_sure_initialized;
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3647.cc b/libstdc++-v3/testsuite/27_io/objects/char/3647.cc
new file mode 100644
index 000000000..506fb3130
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3647.cc
@@ -0,0 +1,37 @@
+// 2002-01-08 bkoz
+
+// Copyright (C) 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// 27.6.1.5 - Template class basic_iostream
+// NB: This file is for testing iostream with NO OTHER INCLUDES.
+
+#include <iostream>
+
+// libstdc++/3647
+void test07()
+{
+ // Should not block.
+ std::cout << std::cin.rdbuf()->in_avail() << std::endl;
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc
new file mode 100644
index 000000000..b09f58b8c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.cc
@@ -0,0 +1,41 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// run test under truss(1) or strace(1). Look at
+// size and pattern of write system calls.
+// Should be 2 or 3 write(1,[...]) calls when run interactively
+// depending upon buffering mode enforced.
+void test05()
+{
+ std::cout << "hello" << ' ' << "world" << std::endl;
+ std::cout << "Enter your name: ";
+ std::string s;
+ std::cin >> s;
+ std::cout << "hello " << s << std::endl;
+}
+
+int
+main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in
new file mode 100644
index 000000000..a26c12687
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/3_xin.in
@@ -0,0 +1 @@
+JOHN HUME and DAVID TRIMBLE
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/41037.cc b/libstdc++-v3/testsuite/27_io/objects/char/41037.cc
new file mode 100644
index 000000000..a38221cab
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/41037.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/41037
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( std::cerr.flags() & std::ios_base::dec );
+ VERIFY( std::cerr.flags() & std::ios_base::skipws );
+ VERIFY( std::cerr.flags() & std::ios_base::unitbuf );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc
new file mode 100644
index 000000000..dbeb9e049
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.cc
@@ -0,0 +1,38 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// http://gcc.gnu.org/ml/libstdc++/2002-08/msg00060.html
+// Should only have to hit enter once.
+void
+test10()
+{
+ using namespace std;
+ cout << "Press ENTER once\n";
+ cin.ignore(1);
+ cout << "_M_gcount: "<< cin.gcount() << endl;
+}
+
+int
+main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/4_xin.in
@@ -0,0 +1 @@
+
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5.cc b/libstdc++-v3/testsuite/27_io/objects/char/5.cc
new file mode 100644
index 000000000..c5bf54654
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5.cc
@@ -0,0 +1,84 @@
+// 2003-04-26 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2009 Free Software Foundation
+//
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+// Check that standard streams can be used from constructors and
+// destructors of static objects, provided that an instance of
+// ios_base::Init has been constructed.
+
+void init_standard_streams();
+int use_standard_streams();
+
+struct Strange
+{
+ int i;
+
+ Strange()
+ {
+ init_standard_streams();
+ i = use_standard_streams();
+ }
+
+ ~Strange()
+ {
+ use_standard_streams();
+ init_standard_streams();
+ }
+};
+
+static Strange static_ob;
+
+#include <testsuite_hooks.h>
+#include <iostream>
+
+void init_standard_streams()
+{
+ std::ios_base::Init init;
+}
+
+int use_standard_streams()
+{
+ std::cout << "Hello, world!" << std::endl;
+ std::cerr << "World, hello!" << std::endl;
+
+ int ret = std::ios_base::xalloc();
+ std::cin.iword(ret) = ret + 1;
+ std::cout.iword(ret) = ret + 2;
+ std::cerr.iword(ret) = ret + 3;
+ std::clog.iword(ret) = ret + 4;
+ return ret;
+}
+
+void test05()
+{
+ bool test __attribute__((unused)) = true;
+ int i = static_ob.i;
+
+ VERIFY( std::cin.iword(i) == i + 1 );
+ VERIFY( std::cout.iword(i) == i + 2 );
+ VERIFY( std::cerr.iword(i) == i + 3 );
+ VERIFY( std::clog.iword(i) == i + 4 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5268.cc b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
new file mode 100644
index 000000000..b7c0ac1df
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5268.cc
@@ -0,0 +1,37 @@
+// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <sstream>
+#include <iostream>
+
+// libstdc++/5268
+void test04()
+{
+ std::stringbuf b1;
+ std::cout.rdbuf( &b1 );
+ std::cout << "hello\n";
+ std::cout.rdbuf(0);
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc
new file mode 100644
index 000000000..791959e7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.cc
@@ -0,0 +1,47 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/5280
+// Interactive test: input "1234^D^D" for i should terminate for EOF.
+void test06()
+{
+ using namespace std;
+ int i;
+ cin >> i;
+ if (!cin.good())
+ {
+ cerr << endl;
+ cerr << "i == " << i << endl;
+ cerr << "cin.rdstate() == " << cin.rdstate() << endl;
+ cerr << "cin.bad() == " << cin.bad() << endl;
+ cerr << "cin.fail() == " << cin.fail() << endl;
+ cerr << "cin.eof() == " << cin.eof() << endl;
+ }
+ else
+ cerr << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in
new file mode 100644
index 000000000..274c0052d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/5280_xin.in
@@ -0,0 +1 @@
+1234 \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6.cc b/libstdc++-v3/testsuite/27_io/objects/char/6.cc
new file mode 100644
index 000000000..8cf2e8d22
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6.cc
@@ -0,0 +1,59 @@
+// 2003-04-26 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 Free Software Foundation
+//
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+// ios_base::Init::~Init() calls cout.flush(), which may call
+// cout.setstate(badbit), which may throw an exception. Check that
+// the exception doesn't escape from the destructor.
+
+#include <iostream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+class Badbuf : public std::streambuf
+{
+protected:
+ virtual int sync()
+ { return -1; }
+};
+
+void test06()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ // No-op in current code.
+ std::ios_base::Init init;
+ std::cout.rdbuf(new Badbuf);
+ std::cout.exceptions(std::ios_base::badbit);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc
new file mode 100644
index 000000000..10cf7177c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.cc
@@ -0,0 +1,38 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6548
+void test07()
+{
+ bool test __attribute__((unused)) = true;
+ std::cout << "Enter 'test':";
+ std::string s;
+ std::getline(std::cin, s, '\n');
+ VERIFY( s == "test" );
+}
+
+int
+main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in
new file mode 100644
index 000000000..9daeafb98
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6548_xin.in
@@ -0,0 +1 @@
+test
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc
new file mode 100644
index 000000000..a69bdf5b3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.cc
@@ -0,0 +1,37 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/6648
+// Interactive tests: each one (run alone) must terminate upon a single '\n'.
+void test08()
+{
+ bool test __attribute__((unused)) = true;
+ char buff[2048];
+ std::cout << "Enter name: ";
+ std::cin.getline(buff, 2048);
+}
+
+int
+main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in
new file mode 100644
index 000000000..9dd5f1f2e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-1_xin.in
@@ -0,0 +1 @@
+Kofi A. Annan
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc
new file mode 100644
index 000000000..a6b6e71f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.cc
@@ -0,0 +1,34 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+void test09()
+{
+ bool test __attribute__((unused)) = true;
+ std::cout << "Enter favorite beach: ";
+ std::cin.ignore(2048, '\n');
+}
+
+int
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in
new file mode 100644
index 000000000..0b2c7cf28
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/6648-2_xin.in
@@ -0,0 +1 @@
+Oak St. Beach, Chicago
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7.cc b/libstdc++-v3/testsuite/27_io/objects/char/7.cc
new file mode 100644
index 000000000..fcb6e21e9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7.cc
@@ -0,0 +1,86 @@
+// { dg-require-fork "" }
+// { dg-require-mkfifo "" }
+
+// 2003-04-26 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+#include <fstream>
+#include <iostream>
+#include <cstdlib>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// No asserts, avoid leaking the semaphore if a VERIFY fails.
+#undef _GLIBCXX_ASSERT
+
+#include <testsuite_hooks.h>
+
+// Check that cout.flush() is called when last ios_base::Init is destroyed.
+bool test07()
+{
+ using namespace std;
+ using namespace __gnu_test;
+ bool test __attribute__((unused)) = true;
+
+ const char* name = "tmp_fifo4";
+
+ signal(SIGPIPE, SIG_IGN);
+
+ unlink(name);
+ mkfifo(name, S_IRWXU);
+ semaphore s1;
+
+ int child = fork();
+ VERIFY( child != -1 );
+
+ if (child == 0)
+ {
+ filebuf fbout;
+ fbout.open(name, ios_base::in|ios_base::out);
+ VERIFY( fbout.is_open() );
+ s1.wait();
+ cout.rdbuf(&fbout);
+ fbout.sputc('a');
+ // NB: fbout is *not* destroyed here!
+ exit(0);
+ }
+
+ filebuf fbin;
+ fbin.open(name, ios_base::in);
+ s1.signal();
+ filebuf::int_type c = fbin.sbumpc();
+ VERIFY( c != filebuf::traits_type::eof() );
+ VERIFY( c == filebuf::traits_type::to_int_type('a') );
+
+ fbin.close();
+
+ return test;
+}
+
+int
+main()
+{
+ return !test07();
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc
new file mode 100644
index 000000000..b2577f9bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.cc
@@ -0,0 +1,41 @@
+// 2000-08-02 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/7744
+void test11()
+{
+ bool test __attribute__((unused)) = true;
+ std::ios::sync_with_stdio(false);
+
+ std::cout << "Type in the characters 'abc' and press <ENTER>: ";
+ std::cin.peek();
+
+ // The number of unread characters should be 4 (a, b, c, \\n)
+ VERIFY( 4 == std::cin.rdbuf()->in_avail() );
+}
+
+int
+main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in
new file mode 100644
index 000000000..8baef1b4a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7744_xin.in
@@ -0,0 +1 @@
+abc
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/8.cc b/libstdc++-v3/testsuite/27_io/objects/char/8.cc
new file mode 100644
index 000000000..8c22690f7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/8.cc
@@ -0,0 +1,50 @@
+// 2003-04-28 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2003, 2009 Free Software Foundation
+//
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+ // 27.3 - Standard iostream objects p 2
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 27.3 - Standard iostream objects p 2
+ // The objects are not destroyed during program execution.
+ void* p1 = &std::cout;
+ void* p2 = &std::cin;
+ void* p3 = &std::cerr;
+ void* p4 = &std::clog;
+ std::ios_base::sync_with_stdio(false);
+ void* p1s = &std::cout;
+ void* p2s = &std::cin;
+ void* p3s = &std::cerr;
+ void* p4s = &std::clog;
+ VERIFY( p1 == p1s );
+ VERIFY( p2 == p2s );
+ VERIFY( p3 == p3s );
+ VERIFY( p4 == p4s );
+}
+
+int main(void)
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9.cc b/libstdc++-v3/testsuite/27_io/objects/char/9.cc
new file mode 100644
index 000000000..e4905bb46
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9.cc
@@ -0,0 +1,48 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void test09()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_09";
+
+ FILE* fout = fopen(name, "w");
+ fputs("abc\n", fout);
+ fclose(fout);
+
+ VERIFY( freopen(name, "r", stdin) );
+
+ // basic_streambuf::showmanyc returns 0.
+ VERIFY( 0 == std::cin.rdbuf()->in_avail() );
+}
+
+int
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
new file mode 100644
index 000000000..8ca77c76e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
@@ -0,0 +1,99 @@
+// { dg-require-fork "" }
+// { dg-require-mkfifo "" }
+
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// No asserts, avoid leaking the semaphores if a VERIFY fails.
+#undef _GLIBCXX_ASSERT
+
+#include <testsuite_hooks.h>
+#include <cstdio>
+#include <cstdlib>
+#include <iostream>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// Check that cin.rdbuf()->sputbackc() puts characters back to stdin.
+// If cin.rdbuf() is a filebuf, this succeeds when stdin is a regular
+// file, but fails otherwise, hence the named fifo.
+bool test01()
+{
+ using namespace std;
+ using namespace __gnu_test;
+
+ bool test __attribute__((unused)) = true;
+
+ const char* name = "tmp_fifo5";
+
+ signal(SIGPIPE, SIG_IGN);
+
+ unlink(name);
+ mkfifo(name, S_IRWXU);
+ semaphore s1, s2;
+
+ int child = fork();
+ VERIFY( child != -1 );
+
+ if (child == 0)
+ {
+ FILE* file = fopen(name, "r+");
+ VERIFY( file != 0 );
+ fputs("Whatever\n", file);
+ fflush(file);
+ s1.signal();
+ s2.wait();
+ fclose(file);
+ s1.signal();
+ exit(0);
+ }
+
+ VERIFY( freopen(name, "r", stdin) );
+ s1.wait();
+
+ int c1 = fgetc(stdin);
+ VERIFY( c1 != EOF );
+ int c2 = cin.rdbuf()->sputbackc('a');
+ VERIFY( c2 != EOF );
+ VERIFY( c2 == 'a' );
+
+ int c3 = fgetc(stdin);
+ VERIFY( c3 != EOF );
+ VERIFY( c3 == c2 );
+ int c4 = ungetc('b', stdin);
+ VERIFY( c4 != EOF );
+ VERIFY( c4 == 'b' );
+
+ int c5 = cin.rdbuf()->sgetc();
+ VERIFY( c5 != EOF );
+ VERIFY( c5 == c4 );
+ s2.signal();
+ s1.wait();
+
+ return test;
+}
+
+int main()
+{
+ return !test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.cc
new file mode 100644
index 000000000..f91f9508e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.cc
@@ -0,0 +1,46 @@
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_hooks.h>
+#include <cstdio>
+#include <iostream>
+
+void test02()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+
+ int c1 = fgetc(stdin);
+ int c2 = cin.rdbuf()->sputbackc(c1);
+ VERIFY( c2 == c1 );
+
+ int c3 = fgetc(stdin);
+ VERIFY( c3 == c1 );
+ ungetc(c3, stdin);
+
+ int c4 = cin.rdbuf()->sgetc();
+ VERIFY( c4 == c3 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.in
new file mode 100644
index 000000000..ad9013028
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-2_xin.in
@@ -0,0 +1 @@
+For what you dream of
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/dr455.cc b/libstdc++-v3/testsuite/27_io/objects/char/dr455.cc
new file mode 100644
index 000000000..ac464eca7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/char/dr455.cc
@@ -0,0 +1,36 @@
+// 2006-03-08 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// DR 455. cerr::tie() and wcerr::tie() are overspecified.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( std::cerr.tie() == &std::cout );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}