* lib/target-supports.exp (check_effective_target_unwrapped): New.
[official-gcc.git] / libstdc++-v3 / testsuite / 27_io / ios_base / sync_with_stdio / 1.cc
blobd4aaa5b3ea280238c2155135f29f658d5a5434e3
1 // 1999-05-21 bkoz
2 // 2000-05-21 Benjamin Kosnik <bkoz@redhat.com>
3 // 2001-01-17 Loren J. Rittle <ljrittle@acm.org>
5 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 // Free Software Foundation
7 //
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 2, or (at your option)
12 // any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING. If not, write to the Free
21 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // USA.
24 // 27.4.2.4 ios_base static members
25 // @require@ %-*.tst
26 // @diff@ %-*.tst %-*.txt
28 // This test fails on platforms using a wrapper, because this test
29 // redirects stdout to a file and so the exit status printed by the
30 // wrapper is not visibile to DejaGNU. DejaGNU then assumes that the
31 // test exited with a non-zero exit status.
32 // { dg-do run { xfail { ! unwrapped } } }
34 #include <cstdio>
35 #include <sstream>
36 #include <iostream>
37 #include <testsuite_hooks.h>
39 // N.B. Once we have called sync_with_stdio(false), we can never go back.
41 void
42 test01()
44 std::ios_base::sync_with_stdio();
45 std::freopen("ios_base_members_static-1.txt", "w", stderr);
47 for (int i = 0; i < 2; i++)
49 std::fprintf(stderr, "1");
50 std::cerr << "2";
51 std::putc('3', stderr);
52 std::cerr << '4';
53 std::fputs("5", stderr);
54 std::cerr << 6;
55 std::putc('7', stderr);
56 std::cerr << 8 << '9';
57 std::fprintf(stderr, "0\n");
61 int main(void)
63 test01();
64 return 0;