Fixes for libstdc++/1576
2001-01-09 Benjamin Kosnik <bkoz@redhat.com> <kainz@ilm.com> Fixes for libstdc++/1576 * src/stdstreams.cc: Initialize with NULL filebuf. Delete file, move contents into.... * src/ios.cc: ...Here. Put defines for iostreams objects and initialization routines into one file to simplify DSO interaction. * include/bits/std_iostream.h: Touch. * include/bits/ios_base.h (_S_synched_with_stdio): Make static. * src/Makefile.am (sources): Remove stdstreams.cc. * src/Makefile.in: Regenerate. From-SVN: r38871
This commit is contained in:
parent
761491c8dc
commit
469550eb04
7 changed files with 63 additions and 104 deletions
|
@ -1,11 +1,25 @@
|
||||||
|
2001-01-09 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
<kainz@ilm.com>
|
||||||
|
|
||||||
|
Fixes for libstdc++/1576
|
||||||
|
* src/stdstreams.cc: Initialize with NULL filebuf. Delete
|
||||||
|
file, move contents into....
|
||||||
|
* src/ios.cc: ...Here. Put defines for iostreams objects and
|
||||||
|
initialization routines into one file to simplify DSO interaction.
|
||||||
|
* include/bits/std_iostream.h: Touch.
|
||||||
|
* include/bits/ios_base.h (_S_synched_with_stdio): Make static.
|
||||||
|
* src/Makefile.am (sources): Remove stdstreams.cc.
|
||||||
|
* src/Makefile.in: Regenerate.
|
||||||
|
|
||||||
2001-01-10 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
|
2001-01-10 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
|
||||||
|
|
||||||
* tests_flags.in (check_directory): Fix typo.
|
* tests_flags.in (check_directory): Fix typo.
|
||||||
|
|
||||||
2001-01-09 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
|
2001-01-09 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
|
||||||
|
|
||||||
* include/bits/std_complex.h: Fix a typo.
|
* include/bits/std_complex.h: Fix a typo.
|
||||||
|
|
||||||
2001-01-10 Loren J. Rittle <ljrittle@acm.org>
|
2001-01-09 Loren J. Rittle <ljrittle@acm.org>
|
||||||
|
|
||||||
* config/os/bsd/freebsd/bits/ctype_inline.h (is): (Make right
|
* config/os/bsd/freebsd/bits/ctype_inline.h (is): (Make right
|
||||||
code path:) Remove magic constants and restructure to handle
|
code path:) Remove magic constants and restructure to handle
|
||||||
|
|
|
@ -294,7 +294,7 @@ namespace std {
|
||||||
~Init();
|
~Init();
|
||||||
private:
|
private:
|
||||||
static int _S_ios_base_init;
|
static int _S_ios_base_init;
|
||||||
bool _M_synced_with_stdio;
|
static bool _S_synced_with_stdio;
|
||||||
filebuf* _M_cout;
|
filebuf* _M_cout;
|
||||||
filebuf* _M_cin;
|
filebuf* _M_cin;
|
||||||
filebuf* _M_cerr;
|
filebuf* _M_cerr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Standard iostream objects -*- C++ -*-
|
// Standard iostream objects -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
|
// Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// 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
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
@ -38,8 +38,8 @@
|
||||||
#include <bits/std_ostream.h>
|
#include <bits/std_ostream.h>
|
||||||
#include <bits/std_istream.h>
|
#include <bits/std_istream.h>
|
||||||
|
|
||||||
namespace std {
|
namespace std
|
||||||
|
{
|
||||||
extern istream cin;
|
extern istream cin;
|
||||||
extern ostream cout;
|
extern ostream cout;
|
||||||
extern ostream cerr;
|
extern ostream cerr;
|
||||||
|
@ -55,4 +55,6 @@ namespace std {
|
||||||
static ios_base::Init __ioinit;
|
static ios_base::Init __ioinit;
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
#endif /* _CPP_IOSTREAM */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## Makefile for the src subdirectory of the GNU C++ Standard library.
|
## Makefile for the src subdirectory of the GNU C++ Standard library.
|
||||||
##
|
##
|
||||||
## Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
## Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This file is part of the libstdc++ version 3 distribution.
|
## This file is part of the libstdc++ version 3 distribution.
|
||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
## USA.
|
## USA.
|
||||||
|
|
||||||
## $Id: Makefile.am,v 1.61 2000/12/23 07:13:57 bkoz Exp $
|
## $Id: Makefile.am,v 1.62 2001/01/04 04:21:42 bkoz Exp $
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||||
MAINT_CHARSET = latin1
|
MAINT_CHARSET = latin1
|
||||||
|
@ -176,7 +176,7 @@ sources = \
|
||||||
limitsMEMBERS.cc \
|
limitsMEMBERS.cc \
|
||||||
complex_io.cc \
|
complex_io.cc \
|
||||||
stdexcept.cc bitset.cc \
|
stdexcept.cc bitset.cc \
|
||||||
c++io.cc ios.cc stdstreams.cc strstream.cc \
|
c++io.cc ios.cc strstream.cc \
|
||||||
locale.cc localename.cc codecvt.cc \
|
locale.cc localename.cc codecvt.cc \
|
||||||
locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
|
locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ std_headers = algorithm bitset complex deque fstream functional iomanip ios i
|
||||||
build_headers = bits/std_limits.h bits/c++config.h bits/c++io.h bits/c++threads.h bits/atomicity.h bits/os_defines.h bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h
|
build_headers = bits/std_limits.h bits/c++config.h bits/c++io.h bits/c++threads.h bits/atomicity.h bits/os_defines.h bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h
|
||||||
|
|
||||||
|
|
||||||
sources = limitsMEMBERS.cc complex_io.cc stdexcept.cc bitset.cc c++io.cc ios.cc stdstreams.cc strstream.cc locale.cc localename.cc codecvt.cc locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
|
sources = limitsMEMBERS.cc complex_io.cc stdexcept.cc bitset.cc c++io.cc ios.cc strstream.cc locale.cc localename.cc codecvt.cc locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
|
||||||
|
|
||||||
|
|
||||||
wstring_sources = wstring-inst.cc
|
wstring_sources = wstring-inst.cc
|
||||||
|
@ -258,9 +258,9 @@ libinst_wstring_la_LDFLAGS =
|
||||||
libinst_wstring_la_LIBADD =
|
libinst_wstring_la_LIBADD =
|
||||||
libinst_wstring_la_OBJECTS = wstring-inst.lo
|
libinst_wstring_la_OBJECTS = wstring-inst.lo
|
||||||
libstdc___la_OBJECTS = limitsMEMBERS.lo complex_io.lo stdexcept.lo \
|
libstdc___la_OBJECTS = limitsMEMBERS.lo complex_io.lo stdexcept.lo \
|
||||||
bitset.lo c++io.lo ios.lo stdstreams.lo strstream.lo locale.lo \
|
bitset.lo c++io.lo ios.lo strstream.lo locale.lo localename.lo \
|
||||||
localename.lo codecvt.lo locale-inst.lo stl-inst.lo misc-inst.lo \
|
codecvt.lo locale-inst.lo stl-inst.lo misc-inst.lo valarray-inst.lo \
|
||||||
valarray-inst.lo string-inst.lo
|
string-inst.lo
|
||||||
CXXFLAGS = @CXXFLAGS@
|
CXXFLAGS = @CXXFLAGS@
|
||||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
CXXLD = $(CXX)
|
CXXLD = $(CXX)
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <bits/std_ios.h>
|
#include <bits/std_ios.h>
|
||||||
#include <bits/std_iostream.h>
|
#include <bits/std_ostream.h>
|
||||||
|
#include <bits/std_istream.h>
|
||||||
#include <bits/std_fstream.h>
|
#include <bits/std_fstream.h>
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
@ -104,9 +105,20 @@ namespace std
|
||||||
const ios_base::seekdir ios_base::cur;
|
const ios_base::seekdir ios_base::cur;
|
||||||
const ios_base::seekdir ios_base::end;
|
const ios_base::seekdir ios_base::end;
|
||||||
|
|
||||||
int ios_base::Init::_S_ios_base_init = 0;
|
|
||||||
|
|
||||||
const int ios_base::_S_local_words;
|
const int ios_base::_S_local_words;
|
||||||
|
int ios_base::Init::_S_ios_base_init = 0;
|
||||||
|
bool ios_base::Init::_S_synced_with_stdio = true;
|
||||||
|
|
||||||
|
istream cin(NULL);
|
||||||
|
ostream cout(NULL);
|
||||||
|
ostream cerr(NULL);
|
||||||
|
ostream clog(NULL);
|
||||||
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||||
|
wistream wcin(NULL);
|
||||||
|
wostream wcout(NULL);
|
||||||
|
wostream wcerr(NULL);
|
||||||
|
wostream wclog(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
ios_base::failure::failure(const string& __str)
|
ios_base::failure::failure(const string& __str)
|
||||||
{
|
{
|
||||||
|
@ -126,40 +138,30 @@ namespace std
|
||||||
if (++_S_ios_base_init == 1)
|
if (++_S_ios_base_init == 1)
|
||||||
{
|
{
|
||||||
// NB: std_iostream.h creates the four standard files with
|
// NB: std_iostream.h creates the four standard files with
|
||||||
// default buffers. At this point, we swap out the default
|
// NULL buffers. At this point, we swap out these placeholder
|
||||||
// buffers for the properly-constructed ones, and dispose of
|
// objects for the properly-constructed ones
|
||||||
// the default buffers.
|
|
||||||
streambuf* __old;
|
|
||||||
_M_cout = new filebuf(1, "stdout", ios_base::out);
|
_M_cout = new filebuf(1, "stdout", ios_base::out);
|
||||||
_M_cin = new filebuf(0, "stdin", ios_base::in);
|
_M_cin = new filebuf(0, "stdin", ios_base::in);
|
||||||
_M_cerr = new filebuf(2, "stderr", ios_base::out);
|
_M_cerr = new filebuf(2, "stderr", ios_base::out);
|
||||||
__old = cout.rdbuf(_M_cout);
|
new (&cout) ostream(_M_cout);
|
||||||
__old->~streambuf();
|
new (&cin) istream(_M_cin);
|
||||||
__old = cin.rdbuf(_M_cin);
|
new (&cerr) ostream(_M_cerr);
|
||||||
__old->~streambuf();
|
new (&clog) ostream(_M_cerr);
|
||||||
cin.tie(&cout);
|
cin.tie(&cout);
|
||||||
__old = cerr.rdbuf(_M_cerr);
|
|
||||||
__old->~streambuf();
|
|
||||||
cerr.flags(ios_base::unitbuf);
|
cerr.flags(ios_base::unitbuf);
|
||||||
__old = clog.rdbuf(_M_cerr);
|
|
||||||
__old->~streambuf();
|
|
||||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||||
wstreambuf* __wold;
|
|
||||||
_M_wcout = new wfilebuf(1, "stdout", ios_base::out);
|
_M_wcout = new wfilebuf(1, "stdout", ios_base::out);
|
||||||
_M_wcin = new wfilebuf(0, "stdin", ios_base::in);
|
_M_wcin = new wfilebuf(0, "stdin", ios_base::in);
|
||||||
_M_wcerr = new wfilebuf(2, "stderr", ios_base::out);
|
_M_wcerr = new wfilebuf(2, "stderr", ios_base::out);
|
||||||
__wold = wcout.rdbuf(_M_wcout);
|
new (&wcout) wostream(_M_wcout);
|
||||||
__wold->~wstreambuf();
|
new (&wcin) wistream(_M_wcin);
|
||||||
__wold = wcin.rdbuf(_M_wcin);
|
new (&wcerr) wostream(_M_wcerr);
|
||||||
__wold->~wstreambuf();
|
new (&wclog) wostream(_M_wcerr);
|
||||||
wcin.tie(&wcout);
|
wcin.tie(&cout);
|
||||||
__wold = wcerr.rdbuf(_M_wcerr);
|
|
||||||
__wold->~wstreambuf();
|
|
||||||
wcerr.flags(ios_base::unitbuf);
|
wcerr.flags(ios_base::unitbuf);
|
||||||
__wold = wclog.rdbuf(_M_wcerr);
|
|
||||||
__wold->~wstreambuf();
|
|
||||||
#endif
|
#endif
|
||||||
_M_synced_with_stdio = true;
|
ios_base::Init::_S_synced_with_stdio = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,13 +316,15 @@ namespace std
|
||||||
{
|
{
|
||||||
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
||||||
// 49. Underspecification of ios_base::sync_with_stdio
|
// 49. Underspecification of ios_base::sync_with_stdio
|
||||||
bool __ret = __ioinit._M_synced_with_stdio;
|
bool __ret = ios_base::Init::_S_synced_with_stdio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Turn off sync with C FILE* for cin, cout, cerr, clog iff
|
// Turn off sync with C FILE* for cin, cout, cerr, clog iff
|
||||||
// currently synchronized.
|
// currently synchronized.
|
||||||
if (!__sync && __ret)
|
if (!__sync && __ret)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
// no longer need to do this
|
||||||
// Need to dispose of the buffers created at initialization.
|
// Need to dispose of the buffers created at initialization.
|
||||||
__ioinit._M_cout->~filebuf();
|
__ioinit._M_cout->~filebuf();
|
||||||
__ioinit._M_cin->~filebuf();
|
__ioinit._M_cin->~filebuf();
|
||||||
|
@ -336,23 +340,10 @@ namespace std
|
||||||
cerr.rdbuf(__ioinit._M_cerr);
|
cerr.rdbuf(__ioinit._M_cerr);
|
||||||
cerr.flags(ios_base::unitbuf);
|
cerr.flags(ios_base::unitbuf);
|
||||||
clog.rdbuf(__ioinit._M_cerr);
|
clog.rdbuf(__ioinit._M_cerr);
|
||||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
|
||||||
__ioinit._M_wcout->~wfilebuf();
|
|
||||||
__ioinit._M_wcin->~wfilebuf();
|
|
||||||
__ioinit._M_wcerr->~wfilebuf();
|
|
||||||
__ioinit._M_wcout = new wfilebuf();
|
|
||||||
__ioinit._M_wcin = new wfilebuf();
|
|
||||||
__ioinit._M_wcerr = new wfilebuf();
|
|
||||||
__ioinit._M_wcout->open("wstdout", ios_base::out);
|
|
||||||
__ioinit._M_wcin->open("wstdin", ios_base::in);
|
|
||||||
__ioinit._M_wcerr->open("wstderr", ios_base::out);
|
|
||||||
wcout.rdbuf(__ioinit._M_wcout);
|
|
||||||
wcin.rdbuf(__ioinit._M_wcin);
|
|
||||||
wcerr.rdbuf(__ioinit._M_wcerr);
|
|
||||||
wcerr.flags(ios_base::unitbuf);
|
|
||||||
wclog.rdbuf(__ioinit._M_wcerr);
|
|
||||||
#endif
|
#endif
|
||||||
__ioinit._M_synced_with_stdio = false;
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||||
|
#endif
|
||||||
|
ios_base::Init::_S_synced_with_stdio = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __ret;
|
return __ret;
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
// Copyright (C) 1997-1999 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.
|
|
||||||
|
|
||||||
#include <bits/std_istream.h>
|
|
||||||
#include <bits/std_ostream.h>
|
|
||||||
#include <bits/std_fstream.h>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
|
|
||||||
filebuf __cfileinit;
|
|
||||||
istream cin(&__cfileinit);
|
|
||||||
ostream cout(&__cfileinit);
|
|
||||||
ostream cerr(&__cfileinit);
|
|
||||||
ostream clog(&__cfileinit);
|
|
||||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
|
||||||
wfilebuf __wfileinit;
|
|
||||||
wistream wcin(&__wfileinit);
|
|
||||||
wostream wcout(&__wfileinit);
|
|
||||||
wostream wcerr(&__wfileinit);
|
|
||||||
wostream wclog(&__wfileinit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // std
|
|
Loading…
Add table
Reference in a new issue