OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_filebuf/] [imbue/] [wchar_t/] [14975-2.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// { dg-require-namedlocale "" }
2
// { dg-require-fork "" }
3
// { dg-require-mkfifo "" }
4
 
5
// 2004-04-16  Petur Runolfsson  <peturr02@ru.is>
6
 
7
// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
8
//
9
// This file is part of the GNU ISO C++ Library.  This library is free
10
// software; you can redistribute it and/or modify it under the
11
// terms of the GNU General Public License as published by the
12
// Free Software Foundation; either version 2, or (at your option)
13
// any later version.
14
 
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
 
20
// You should have received a copy of the GNU General Public License along
21
// with this library; see the file COPYING.  If not, write to the Free
22
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23
// USA.
24
 
25
#include <fstream>
26
#include <locale>
27
#include <unistd.h>
28
#include <signal.h>
29
#include <fcntl.h>
30
#include <sys/types.h>
31
#include <sys/stat.h>
32
#include <testsuite_hooks.h>
33
 
34
// libstdc++/14975
35
void test01()
36
{
37
  using namespace std;
38
  using namespace __gnu_test;
39
  bool test __attribute__((unused)) = true;
40
 
41
  locale loc_us = locale("en_US");
42
 
43
  const char* name = "tmp_14975-2";
44
 
45
  signal(SIGPIPE, SIG_IGN);
46
 
47
  unlink(name);
48
  mkfifo(name, S_IRWXU);
49
  semaphore s1;
50
 
51
  int child = fork();
52
  VERIFY( child != -1 );
53
 
54
  if (child == 0)
55
    {
56
      {
57
        filebuf fbin;
58
        fbin.open(name, ios_base::in);
59
      }
60
      s1.signal ();
61
      exit(0);
62
    }
63
 
64
  wfilebuf fb;
65
  fb.pubimbue(loc_us);
66
  wfilebuf* ret = fb.open(name, ios_base::out);
67
  VERIFY( ret != NULL );
68
  VERIFY( fb.is_open() );
69
 
70
  s1.wait ();
71
 
72
  try
73
    {
74
      fb.sputc(L'a');
75
      fb.sputc(L'b');
76
      fb.pubimbue(locale::classic());
77
      fb.sputc(L'c');
78
      fb.close();
79
    }
80
  catch (std::exception&)
81
    {
82
    }
83
}
84
 
85
int main()
86
{
87
  test01();
88
  return 0;
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.