diff options
author | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-07-19 00:57:38 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-07-19 00:57:38 +0000 |
commit | dd75251ff0818c1c5da72afee94b13dce3bc96a4 (patch) | |
tree | 88659f9c42769497a189b5b02e65a9dc47038c11 | |
parent | a0add19302ec821e698ad9b36601a78a5ec2d4da (diff) | |
download | gcc-dd75251ff0818c1c5da72afee94b13dce3bc96a4.zip gcc-dd75251ff0818c1c5da72afee94b13dce3bc96a4.tar.gz gcc-dd75251ff0818c1c5da72afee94b13dce3bc96a4.tar.bz2 |
acinclude.m4: Tweaks.
2000-07-18 Benjamin Kosnik <bkoz@soma.redhat.com>
* acinclude.m4: Tweaks.
* config/c_io_libio.cc: Tweaks.
* bits/sstream.tcc (stringbuf::pbackfail): Simplify.
* libio/_G_config.h: Don't define _G_HAVE_ST_BLKSIZE.
* libio/[iofwide.c, wfiledoalloc.c, wfiteopos.c, wgenops.c]: New files.
* libio/iofclose.c iofopen.c, stdio.c: New files.
* libio/Makefile.am: Add files, add flags, etc.
* src/Makefile.am (sources): Add filebuf.cc.
* acinclude.m4 (GLIBCPP_CHECK_WCHAR_T_SUPPORT):
(GLIBCPP_ENABLE_CSTDIO): Versioning testing, etc etc.
From-SVN: r35127
-rw-r--r-- | libstdc++-v3/ChangeLog | 13 | ||||
-rw-r--r-- | libstdc++-v3/Makefile.in | 1 | ||||
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 112 | ||||
-rw-r--r-- | libstdc++-v3/aclocal.m4 | 112 | ||||
-rw-r--r-- | libstdc++-v3/bits/sstream.tcc | 33 | ||||
-rw-r--r-- | libstdc++-v3/bits/std_fstream.h | 5 | ||||
-rw-r--r-- | libstdc++-v3/config/c_io_libio.cc | 66 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 234 | ||||
-rw-r--r-- | libstdc++-v3/libio/ChangeLog | 4 | ||||
-rw-r--r-- | libstdc++-v3/libio/Makefile.am | 33 | ||||
-rw-r--r-- | libstdc++-v3/libio/Makefile.in | 113 | ||||
-rw-r--r-- | libstdc++-v3/libio/_G_config.h | 6 | ||||
-rw-r--r-- | libstdc++-v3/libio/genops.c | 6 | ||||
-rw-r--r-- | libstdc++-v3/libio/iofclose.c | 98 | ||||
-rw-r--r-- | libstdc++-v3/libio/iofopen.c | 77 | ||||
-rw-r--r-- | libstdc++-v3/libio/libio.h | 3 | ||||
-rw-r--r-- | libstdc++-v3/libio/stdfiles.c | 19 | ||||
-rw-r--r-- | libstdc++-v3/libio/stdio.c | 42 | ||||
-rw-r--r-- | libstdc++-v3/math/Makefile.in | 1 | ||||
-rw-r--r-- | libstdc++-v3/src/Makefile.am | 5 | ||||
-rw-r--r-- | libstdc++-v3/src/Makefile.in | 10 | ||||
-rw-r--r-- | libstdc++-v3/src/ios.cc | 2 |
22 files changed, 681 insertions, 314 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f342f47..83299da 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2000-07-18 Benjamin Kosnik <bkoz@soma.redhat.com> + + * acinclude.m4: Tweaks. + * config/c_io_libio.cc: Tweaks. + * bits/sstream.tcc (stringbuf::pbackfail): Simplify. + * libio/_G_config.h: Don't define _G_HAVE_ST_BLKSIZE. + * libio/[iofwide.c, wfiledoalloc.c, wfiteopos.c, wgenops.c]: New files. + * libio/iofclose.c iofopen.c, stdio.c: New files. + * libio/Makefile.am: Add files, add flags, etc. + * src/Makefile.am (sources): Add filebuf.cc. + * acinclude.m4 (GLIBCPP_CHECK_WCHAR_T_SUPPORT): + (GLIBCPP_ENABLE_CSTDIO): Versioning testing, etc etc. + 2000-07-17 Phil Edwards <pme@sourceware.cygnus.com> * acinclude.m4: Import CHECK_GNU_MAKE from autoconf macro archive. diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index 1f3e40d..c85f7cc 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -103,6 +103,7 @@ WFMT_FLAGS = @WFMT_FLAGS@ cpu_include_dir = @cpu_include_dir@ ctype_include_dir = @ctype_include_dir@ glibcpp_basedir = @glibcpp_basedir@ +ifGNUmake = @ifGNUmake@ libinst_wstring_la = @libinst_wstring_la@ AUTOMAKE_OPTIONS = 1.3 cygnus diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 8252268..7f76119 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -930,6 +930,10 @@ AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ dnl At the moment, only enable wchar_t specializations if all the dnl above support is present. + dnl 2000-07-07-bkoz-hack-xxx +# ac_isoC9X_wchar_t=no + dnl 2000-07-07-bkoz-hack-xxx + AC_MSG_CHECKING([for enabled wchar_t specializations]) if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then libinst_wstring_la="libinst-wstring.la" @@ -1165,54 +1169,72 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ dnl Check if a valid thread package case x${enable_cstdio_flag} in - xlibio | x | xno | xnone | xyes) - # default - CSTDIO_H=config/c_io_libio.h - CSTDIO_CC=config/c_io_libio.cc - AC_MSG_RESULT(libio) - - # see if we are on a system with libio native (ie, linux) - AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) - - # bkoz XXX hack hack need version checks, this is temporary - has_libio=no - - if test $has_libio = "yes"; then - BUILD_LIBIO_INCLUDE= - need_libio=no - else - BUILD_LIBIO_INCLUDE='-I../libio' - need_libio=yes - fi - AC_SUBST(BUILD_LIBIO_INCLUDE) - - # see if the _G_config.h header needs to be built. - # NB: This replaces the _G_CONFIG_H machinery in libio-v2 - AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no) - AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no) - # bkoz XXX hack need to add support for non-glibc systems here - has_gconf=no - - # bkoz XXX need to add checks for this - need_wlibio=yes - ;; - xwince) - CSTDIO_H=config/c_io_wince.h - CSTDIO_CC=config/c_io_wince.cc - AC_MSG_RESULT(wince) - - need_libio=no - BUILD_LIBIO_INCLUDE= - AC_SUBST(BUILD_LIBIO_INCLUDE) - ;; - *) - echo "$enable_cstdio is an unknown io package" 1>&2 - exit 1 - ;; + xlibio | x | xno | xnone | xyes) + # default + CSTDIO_H=config/c_io_libio.h + CSTDIO_CC=config/c_io_libio.cc + AC_MSG_RESULT(libio) + + # see if we are on a system with libio native (ie, linux) + AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) + + # Need to check and see what version of glibc is being used. If + # it's not glibc-2.2 or higher, then we'll need to go ahead and + # compile most of libio for linux systems. + if test x$has_libio = x"yes"; then + case "$target" in + *-*-linux*) + AC_MSG_CHECKING([for glibc version >= 2.2]) + AC_EGREP_CPP([ok], [ + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + ok + #endif + ], glibc_satisfactory=yes, glibc_satisfactory=no) + AC_MSG_RESULT($glibc_satisfactory) + ;; + esac + + if test x$glibc_satisfactory = x"yes"; then + BUILD_LIBIO_INCLUDE= + need_libio=no + need_xtra_libio=no + need_wlibio=no + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=yes + # bkoz XXX need to add checks to enable this + need_wlibio=yes + fi + + # Using libio, but <libio.h> doesn't exist on the target system. . . + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=no + # bkoz XXX need to add checks to enable this + need_wlibio=no + fi + ;; + + xwince) + CSTDIO_H=config/c_io_wince.h + CSTDIO_CC=config/c_io_wince.cc + AC_MSG_RESULT(wince) + + need_libio=no + BUILD_LIBIO_INCLUDE= + AC_SUBST(BUILD_LIBIO_INCLUDE) + ;; + *) + echo "$enable_cstdio is an unknown io package" 1>&2 + exit 1 + ;; esac AC_LINK_FILES($CSTDIO_H, bits/c++io.h) AC_LINK_FILES($CSTDIO_CC, src/c++io.cc) AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) + AM_CONDITIONAL(GLIBCPP_NEED_XTRA_LIBIO, test "$need_xtra_libio" = yes) AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) ]) @@ -1492,7 +1514,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also dnl exists, then the other make wraps the GNU make. dnl dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> -dnl @version $Id: check_gnu_make.m4,v 1.1 2000/06/15 10:49:36 simons Exp $ +dnl @version $Id: acinclude.m4,v 1.42 2000/07/17 18:17:33 pme Exp $ dnl dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4 index e51a0a5..8fa8468 100644 --- a/libstdc++-v3/aclocal.m4 +++ b/libstdc++-v3/aclocal.m4 @@ -942,6 +942,10 @@ AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ dnl At the moment, only enable wchar_t specializations if all the dnl above support is present. + dnl 2000-07-07-bkoz-hack-xxx +# ac_isoC9X_wchar_t=no + dnl 2000-07-07-bkoz-hack-xxx + AC_MSG_CHECKING([for enabled wchar_t specializations]) if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then libinst_wstring_la="libinst-wstring.la" @@ -1177,54 +1181,72 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ dnl Check if a valid thread package case x${enable_cstdio_flag} in - xlibio | x | xno | xnone | xyes) - # default - CSTDIO_H=config/c_io_libio.h - CSTDIO_CC=config/c_io_libio.cc - AC_MSG_RESULT(libio) - - # see if we are on a system with libio native (ie, linux) - AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) - - # bkoz XXX hack hack need version checks, this is temporary - has_libio=no - - if test $has_libio = "yes"; then - BUILD_LIBIO_INCLUDE= - need_libio=no - else - BUILD_LIBIO_INCLUDE='-I../libio' - need_libio=yes - fi - AC_SUBST(BUILD_LIBIO_INCLUDE) - - # see if the _G_config.h header needs to be built. - # NB: This replaces the _G_CONFIG_H machinery in libio-v2 - AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no) - AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no) - # bkoz XXX hack need to add support for non-glibc systems here - has_gconf=no - - # bkoz XXX need to add checks for this - need_wlibio=yes - ;; - xwince) - CSTDIO_H=config/c_io_wince.h - CSTDIO_CC=config/c_io_wince.cc - AC_MSG_RESULT(wince) - - need_libio=no - BUILD_LIBIO_INCLUDE= - AC_SUBST(BUILD_LIBIO_INCLUDE) - ;; - *) - echo "$enable_cstdio is an unknown io package" 1>&2 - exit 1 - ;; + xlibio | x | xno | xnone | xyes) + # default + CSTDIO_H=config/c_io_libio.h + CSTDIO_CC=config/c_io_libio.cc + AC_MSG_RESULT(libio) + + # see if we are on a system with libio native (ie, linux) + AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) + + # Need to check and see what version of glibc is being used. If + # it's not glibc-2.2 or higher, then we'll need to go ahead and + # compile most of libio for linux systems. + if test x$has_libio = x"yes"; then + case "$target" in + *-*-linux*) + AC_MSG_CHECKING([for glibc version >= 2.2]) + AC_EGREP_CPP([ok], [ + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + ok + #endif + ], glibc_satisfactory=yes, glibc_satisfactory=no) + AC_MSG_RESULT($glibc_satisfactory) + ;; + esac + + if test x$glibc_satisfactory = x"yes"; then + BUILD_LIBIO_INCLUDE= + need_libio=no + need_xtra_libio=no + need_wlibio=no + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=yes + # bkoz XXX need to add checks to enable this + need_wlibio=yes + fi + + # Using libio, but <libio.h> doesn't exist on the target system. . . + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=no + # bkoz XXX need to add checks to enable this + need_wlibio=no + fi + ;; + + xwince) + CSTDIO_H=config/c_io_wince.h + CSTDIO_CC=config/c_io_wince.cc + AC_MSG_RESULT(wince) + + need_libio=no + BUILD_LIBIO_INCLUDE= + AC_SUBST(BUILD_LIBIO_INCLUDE) + ;; + *) + echo "$enable_cstdio is an unknown io package" 1>&2 + exit 1 + ;; esac AC_LINK_FILES($CSTDIO_H, bits/c++io.h) AC_LINK_FILES($CSTDIO_CC, src/c++io.cc) AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) + AM_CONDITIONAL(GLIBCPP_NEED_XTRA_LIBIO, test "$need_xtra_libio" = yes) AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) ]) @@ -1504,7 +1526,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also dnl exists, then the other make wraps the GNU make. dnl dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> -dnl @version $Id: check_gnu_make.m4,v 1.1 2000/06/15 10:49:36 simons Exp $ +dnl @version $Id: acinclude.m4,v 1.42 2000/07/17 18:17:33 pme Exp $ dnl dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the diff --git a/libstdc++-v3/bits/sstream.tcc b/libstdc++-v3/bits/sstream.tcc index 4e8a640..949c263 100644 --- a/libstdc++-v3/bits/sstream.tcc +++ b/libstdc++-v3/bits/sstream.tcc @@ -49,22 +49,25 @@ namespace std { // Try to put back __c into input sequence in one of three ways. // Order these tests done in is unspecified by the standard. - if (!__testeof && __testpos - && traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) + if (__testpos) { - --_M_in_cur; - __retval = __c; - } - else if (!__testeof && __testpos) - { - --_M_in_cur; - *_M_in_cur = traits_type::to_char_type(__c); - __retval = __c; - } - else if (__testeof && __testpos) - { - --_M_in_cur; - __retval = traits_type::not_eof(__c); + if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) + && !__testeof) + { + --_M_in_cur; + __retval = __c; + } + else if (!__testeof) + { + --_M_in_cur; + *_M_in_cur = traits_type::to_char_type(__c); + __retval = __c; + } + else if (__testeof) + { + --_M_in_cur; + __retval = traits_type::not_eof(__c); + } } return __retval; } diff --git a/libstdc++-v3/bits/std_fstream.h b/libstdc++-v3/bits/std_fstream.h index 3efb70e..997d377 100644 --- a/libstdc++-v3/bits/std_fstream.h +++ b/libstdc++-v3/bits/std_fstream.h @@ -48,10 +48,11 @@ namespace std { public: // Types: typedef _CharT char_type; + typedef _Traits traits_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; + // Non-standard Types: typedef basic_streambuf<_CharT, _Traits> __streambuf_type; @@ -69,7 +70,7 @@ namespace std { __state_type _M_state_cur;// Current state type for codecvt. __state_type _M_state_beg; const __codecvt_type* _M_fcvt; // Cached value from use_facet. - __mutext_type _M_lock; + __c_lock _M_lock; bool _M_last_overflowed; // XXX Needed? public: diff --git a/libstdc++-v3/config/c_io_libio.cc b/libstdc++-v3/config/c_io_libio.cc index f9a33bb..6867aa6 100644 --- a/libstdc++-v3/config/c_io_libio.cc +++ b/libstdc++-v3/config/c_io_libio.cc @@ -39,10 +39,12 @@ namespace std { __basic_file::__basic_file(__c_lock* __lock) { +#ifdef _IO_MTSAFE_IO _lock = __lock; - _IO_init(this, 0); - _IO_file_init((_IO_FILE_plus*) this); - _IO_file_attach(this, -1); +#endif + _IO_no_init(this, 0 /* ??? */, -1, 0, 0); + _IO_JUMPS(this) = &_IO_file_jumps; + _IO_file_init((_IO_FILE_plus*)this); } int @@ -50,15 +52,7 @@ namespace std { { return _fileno; } __basic_file::~__basic_file() - { - if (this->is_open()) - { - _IO_do_flush(this); - if (!(_flags & _IO_DELETE_DONT_CLOSE)) - _IO_SYSCLOSE((_IO_FILE*)this); - } - _IO_default_finish(this, 0); - } + { _IO_file_finish(this, 0); } void __basic_file::_M_open_mode(ios_base::openmode __mode, int& __p_mode, @@ -116,13 +110,19 @@ namespace std { int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; _M_open_mode(__mode, __p_mode, __rw_mode); - if (__fd >= 0) + // _IO_file_attach + // sets _IO_DELETE_DONT_CLOSE + // clears _IO_NO_READS + _IO_NO_WRITES + if (_IO_file_attach(this, __fd) != NULL) { - _fileno = __fd; + // Set flags appropriately for openmode... int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; - _flags = (_flags & ~__mask) | (__rw_mode & __mask); - _IO_link_in((_IO_FILE_plus*) this); - __retval = this; + _IO_mask_flags(this, __rw_mode, __mask); + } + else + { + _IO_un_link((_IO_FILE_plus*) this); + // XXX Extended error checking?? Note that v2 does not even have this. } return __retval; } @@ -138,22 +138,11 @@ namespace std { _M_open_mode(__mode, __p_mode, __rw_mode); if (!_IO_file_is_open(this)) { -#if _G_HAVE_IO_FILE_OPEN + //#if _G_HAVE_IO_FILE_OPEN __c_file_type* __f; __f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0); - _flags &= ~_IO_DELETE_DONT_CLOSE; + // _flags &= ~_IO_DELETE_DONT_CLOSE; __retval = __f ? this: NULL; -#else - int __fd = ::open(__name, __p_mode, __prot); - if (__fd >= 0) - { - _fileno = __fd; - int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; - _flags = (_flags & ~__mask) | (__rw_mode & __mask); - _IO_link_in(this); - __retval = this; - } -#endif } return __retval; } @@ -167,15 +156,18 @@ namespace std { // NB: Unused. int - __basic_file::overflow(int __c) { return _IO_file_overflow(this, __c); } + __basic_file::overflow(int __c) + { return _IO_file_overflow(this, __c); } // NB: Unused. int - __basic_file::underflow() { return _IO_file_underflow(this); } + __basic_file::underflow() + { return _IO_file_underflow(this); } // NB: Unused. int - __basic_file::uflow() { return _IO_default_uflow(this); } + __basic_file::uflow() + { return _IO_default_uflow(this); } // NB: Unused. int @@ -188,7 +180,7 @@ namespace std { streamsize __basic_file::xsgetn(char* __s, streamsize __n) - { return _IO_default_xsgetn(this, __s, __n); } + { return _IO_file_xsgetn(this, __s, __n); } streamoff __basic_file::seekoff(streamoff __off, ios_base::seekdir __way, @@ -230,11 +222,13 @@ namespace std { // NB: Unused. int - __basic_file::sys_close() { return _IO_file_close(this); } + __basic_file::sys_close() + { return _IO_file_close(this); } // NB: Unused. int - __basic_file::sys_stat(void* __v) { return _IO_file_stat(this, __v); } + __basic_file::sys_stat(void* __v) + { return _IO_file_stat(this, __v); } // NB: Unused. int diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index cfefe9c..8337eec 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -2206,14 +2206,14 @@ fi enable_cstdio_flag=$enable_cstdio case x${enable_cstdio_flag} in - xlibio | x | xno | xnone | xyes) - # default - CSTDIO_H=config/c_io_libio.h - CSTDIO_CC=config/c_io_libio.cc - echo "$ac_t""libio" 1>&6 - - # see if we are on a system with libio native (ie, linux) - ac_safe=`echo "libio.h" | sed 'y%./+-%__p_%'` + xlibio | x | xno | xnone | xyes) + # default + CSTDIO_H=config/c_io_libio.h + CSTDIO_CC=config/c_io_libio.cc + echo "$ac_t""libio" 1>&6 + + # see if we are on a system with libio native (ie, linux) + ac_safe=`echo "libio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libio.h""... $ac_c" 1>&6 echo "configure:2219: checking for libio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then @@ -2248,82 +2248,73 @@ has_libio=no fi - # bkoz XXX hack hack need version checks, this is temporary - has_libio=no - - if test $has_libio = "yes"; then - BUILD_LIBIO_INCLUDE= - need_libio=no - else - BUILD_LIBIO_INCLUDE='-I../libio' - need_libio=yes - fi - - - # see if the _G_config.h header needs to be built. - # NB: This replaces the _G_CONFIG_H machinery in libio-v2 - ac_safe=`echo "_G_config.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for _G_config.h""... $ac_c" 1>&6 -echo "configure:2268: checking for _G_config.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2273 "configure" + # Need to check and see what version of glibc is being used. If + # it's not glibc-2.2 or higher, then we'll need to go ahead and + # compile most of libio for linux systems. + if test x$has_libio = x"yes"; then + case "$target" in + *-*-linux*) + echo $ac_n "checking for glibc version >= 2.2""... $ac_c" 1>&6 +echo "configure:2259: checking for glibc version >= 2.2" >&5 + cat > conftest.$ac_ext <<EOF +#line 2261 "configure" #include "confdefs.h" -#include <_G_config.h> + + #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + ok + #endif + EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2278: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "ok" >/dev/null 2>&1; then rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + glibc_satisfactory=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + glibc_satisfactory=no fi rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - has_gconf_h=yes -else - echo "$ac_t""no" 1>&6 -has_gconf_h=no -fi - + echo "$ac_t""$glibc_satisfactory" 1>&6 + ;; + esac -if test "$has_gconf_h" = no; then - GLIBCPP_NEED_LIBIO_CONFIG_H_TRUE= - GLIBCPP_NEED_LIBIO_CONFIG_H_FALSE='#' -else - GLIBCPP_NEED_LIBIO_CONFIG_H_TRUE='#' - GLIBCPP_NEED_LIBIO_CONFIG_H_FALSE= -fi - # bkoz XXX hack need to add support for non-glibc systems here - has_gconf=no + if test x$glibc_satisfactory = x"yes"; then + BUILD_LIBIO_INCLUDE= + need_libio=no + need_xtra_libio=no + need_wlibio=no + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=yes + # bkoz XXX need to add checks to enable this + need_wlibio=yes + fi - # bkoz XXX need to add checks for this - need_wlibio=yes - ;; - xwince) - CSTDIO_H=config/c_io_wince.h - CSTDIO_CC=config/c_io_wince.cc - echo "$ac_t""wince" 1>&6 + # Using libio, but <libio.h> doesn't exist on the target system. . . + else + BUILD_LIBIO_INCLUDE='-I../libio' + need_libio=yes + need_xtra_libio=no + # bkoz XXX need to add checks to enable this + need_wlibio=no + fi + ;; - need_libio=no - BUILD_LIBIO_INCLUDE= - - ;; - *) - echo "$enable_cstdio is an unknown io package" 1>&2 - exit 1 - ;; + xwince) + CSTDIO_H=config/c_io_wince.h + CSTDIO_CC=config/c_io_wince.cc + echo "$ac_t""wince" 1>&6 + + need_libio=no + BUILD_LIBIO_INCLUDE= + + ;; + *) + echo "$enable_cstdio is an unknown io package" 1>&2 + exit 1 + ;; esac @@ -2338,6 +2329,15 @@ else fi +if test "$need_xtra_libio" = yes; then + GLIBCPP_NEED_XTRA_LIBIO_TRUE= + GLIBCPP_NEED_XTRA_LIBIO_FALSE='#' +else + GLIBCPP_NEED_XTRA_LIBIO_TRUE='#' + GLIBCPP_NEED_XTRA_LIBIO_FALSE= +fi + + if test "$need_wlibio" = yes; then GLIBCPP_NEED_WLIBIO_TRUE= GLIBCPP_NEED_WLIBIO_FALSE='#' @@ -16131,8 +16131,10 @@ echo "configure:16127: checking for XPG2 wchar_t support" >&5 fi echo "$ac_t""$ac_XPG2_wchar_t" 1>&6 - echo $ac_n "checking for enabled wchar_t specializations""... $ac_c" 1>&6 -echo "configure:16136: checking for enabled wchar_t specializations" >&5 + # ac_isoC9X_wchar_t=no + + echo $ac_n "checking for enabled wchar_t specializations""... $ac_c" 1>&6 +echo "configure:16138: checking for enabled wchar_t specializations" >&5 if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then libinst_wstring_la="libinst-wstring.la" cat >> confdefs.h <<\EOF @@ -16157,17 +16159,17 @@ EOF ac_safe=`echo "ctype.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ctype.h""... $ac_c" 1>&6 -echo "configure:16161: checking for ctype.h" >&5 +echo "configure:16163: checking for ctype.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 16166 "configure" +#line 16168 "configure" #include "confdefs.h" #include <ctype.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:16171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:16173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -16188,9 +16190,9 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ctype_default=yes echo $ac_n "checking <ctype> for gnu-linux ""... $ac_c" 1>&6 -echo "configure:16192: checking <ctype> for gnu-linux " >&5 +echo "configure:16194: checking <ctype> for gnu-linux " >&5 cat > conftest.$ac_ext <<EOF -#line 16194 "configure" +#line 16196 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16201,7 +16203,7 @@ int + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];} ; return 0; } EOF -if { (eval echo configure:16205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16207: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_linux=yes @@ -16220,9 +16222,9 @@ rm -f conftest* if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for freebsd 4.0 ""... $ac_c" 1>&6 -echo "configure:16224: checking <ctype> for freebsd 4.0 " >&5 +echo "configure:16226: checking <ctype> for freebsd 4.0 " >&5 cat > conftest.$ac_ext <<EOF -#line 16226 "configure" +#line 16228 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16232,7 +16234,7 @@ int + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;} ; return 0; } EOF -if { (eval echo configure:16236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_bsd=yes @@ -16252,9 +16254,9 @@ rm -f conftest* if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for freebsd 3.4 ""... $ac_c" 1>&6 -echo "configure:16256: checking <ctype> for freebsd 3.4 " >&5 +echo "configure:16258: checking <ctype> for freebsd 3.4 " >&5 cat > conftest.$ac_ext <<EOF -#line 16258 "configure" +#line 16260 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16264,7 +16266,7 @@ int + _D + _P + _X + _G + __istype (a, 0);} ; return 0; } EOF -if { (eval echo configure:16268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_freebsd34=yes @@ -16284,9 +16286,9 @@ rm -f conftest* if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for solaris 2.6,7,8 ""... $ac_c" 1>&6 -echo "configure:16288: checking <ctype> for solaris 2.6,7,8 " >&5 +echo "configure:16290: checking <ctype> for solaris 2.6,7,8 " >&5 cat > conftest.$ac_ext <<EOF -#line 16290 "configure" +#line 16292 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16297,7 +16299,7 @@ int + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];} ; return 0; } EOF -if { (eval echo configure:16301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_solaris=yes @@ -16312,7 +16314,7 @@ rm -f conftest* if test $ctype_solaris = "yes"; then echo $ac_n "checking for version""... $ac_c" 1>&6 -echo "configure:16316: checking for version" >&5 +echo "configure:16318: checking for version" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CXXCPP $CPPFLAGS' @@ -16321,14 +16323,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 16325 "configure" +#line 16327 "configure" #include "confdefs.h" #include <ctype.h> int main() { typedef long* __to_type; __to_type const& _M_toupper = __trans_upper; ; return 0; } EOF -if { (eval echo configure:16332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_solaris26=yes @@ -16360,9 +16362,9 @@ cross_compiling=$ac_cv_prog_cc_cross if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for solaris 2.5.1 ""... $ac_c" 1>&6 -echo "configure:16364: checking <ctype> for solaris 2.5.1 " >&5 +echo "configure:16366: checking <ctype> for solaris 2.5.1 " >&5 cat > conftest.$ac_ext <<EOF -#line 16366 "configure" +#line 16368 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16372,7 +16374,7 @@ int + __ctype[a];} ; return 0; } EOF -if { (eval echo configure:16376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_solaris25=yes @@ -16392,9 +16394,9 @@ rm -f conftest* if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for aix ""... $ac_c" 1>&6 -echo "configure:16396: checking <ctype> for aix " >&5 +echo "configure:16398: checking <ctype> for aix " >&5 cat > conftest.$ac_ext <<EOF -#line 16398 "configure" +#line 16400 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16405,7 +16407,7 @@ int + _VALC('a') + _IS('c', 0);} ; return 0; } EOF -if { (eval echo configure:16409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_aix=yes @@ -16425,9 +16427,9 @@ rm -f conftest* if test $ctype_default = "yes"; then echo $ac_n "checking <ctype> for newlib ""... $ac_c" 1>&6 -echo "configure:16429: checking <ctype> for newlib " >&5 +echo "configure:16431: checking <ctype> for newlib " >&5 cat > conftest.$ac_ext <<EOF -#line 16431 "configure" +#line 16433 "configure" #include "confdefs.h" #include <ctype.h> int main() { @@ -16437,7 +16439,7 @@ int + _ctype_[a];} ; return 0; } EOF -if { (eval echo configure:16441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:16443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* \ ctype_newlib=yes @@ -16471,17 +16473,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:16475: checking for $ac_hdr" >&5 +echo "configure:16477: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 16480 "configure" +#line 16482 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:16485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:16487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -16510,12 +16512,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:16514: checking for $ac_func" >&5 +echo "configure:16516: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 16519 "configure" +#line 16521 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -16538,7 +16540,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:16542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -16563,7 +16565,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:16567: checking for working mmap" >&5 +echo "configure:16569: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -16571,7 +16573,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 16575 "configure" +#line 16577 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -16711,7 +16713,7 @@ main() } EOF -if { (eval echo configure:16715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:16717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -16774,19 +16776,19 @@ fi if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:16778: checking for LC_MESSAGES" >&5 +echo "configure:16780: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'ac_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 16783 "configure" +#line 16785 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:16790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:16792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_val_LC_MESSAGES=yes else @@ -17002,10 +17004,10 @@ s%@cpu_include_dir@%$cpu_include_dir%g s%@CPU_FLAGS@%$CPU_FLAGS%g s%@DEBUG_FLAGS@%$DEBUG_FLAGS%g s%@BUILD_LIBIO_INCLUDE@%$BUILD_LIBIO_INCLUDE%g -s%@GLIBCPP_NEED_LIBIO_CONFIG_H_TRUE@%$GLIBCPP_NEED_LIBIO_CONFIG_H_TRUE%g -s%@GLIBCPP_NEED_LIBIO_CONFIG_H_FALSE@%$GLIBCPP_NEED_LIBIO_CONFIG_H_FALSE%g s%@GLIBCPP_NEED_LIBIO_TRUE@%$GLIBCPP_NEED_LIBIO_TRUE%g s%@GLIBCPP_NEED_LIBIO_FALSE@%$GLIBCPP_NEED_LIBIO_FALSE%g +s%@GLIBCPP_NEED_XTRA_LIBIO_TRUE@%$GLIBCPP_NEED_XTRA_LIBIO_TRUE%g +s%@GLIBCPP_NEED_XTRA_LIBIO_FALSE@%$GLIBCPP_NEED_XTRA_LIBIO_FALSE%g s%@GLIBCPP_NEED_WLIBIO_TRUE@%$GLIBCPP_NEED_WLIBIO_TRUE%g s%@GLIBCPP_NEED_WLIBIO_FALSE@%$GLIBCPP_NEED_WLIBIO_FALSE%g s%@CSHADOWFLAGS@%$CSHADOWFLAGS%g diff --git a/libstdc++-v3/libio/ChangeLog b/libstdc++-v3/libio/ChangeLog index 8095408..5e59e82 100644 --- a/libstdc++-v3/libio/ChangeLog +++ b/libstdc++-v3/libio/ChangeLog @@ -1,3 +1,7 @@ +2000-07-12 benjamin kosnik <bkoz@haight.constant.com> + + * _G_config.h: Smoke less crack, don't define _G_HAVE_ST_BLKSIZE. + 2000-04-25 Benjamin Kosnik <bkoz@haight.constant.com> * libio.h: Change decls for seekoff/seekpos. diff --git a/libstdc++-v3/libio/Makefile.am b/libstdc++-v3/libio/Makefile.am index 289afc2..dd1c768 100644 --- a/libstdc++-v3/libio/Makefile.am +++ b/libstdc++-v3/libio/Makefile.am @@ -35,13 +35,31 @@ CONFIG_INCLUDES = \ -I$(top_srcdir)/@ctype_include_dir@ INCLUDES = \ - -D_GNU_SOURCE -nostdinc++ -I$(top_srcdir) \ + -nostdinc++ -I$(top_srcdir) \ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(TOPLEVEL_INCLUDES) noinst_LTLIBRARIES = libio.la -LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +# These bits are all figured out from configure. Look in acinclude.m4 +# or configure.in to see how they are set. +# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. +AC_CFLAGS = \ + $(WERROR) @CPU_FLAGS@ @DEBUG_FLAGS@ + +# Need to manually set this option because AC_CXXFLAGS has to be at +# the end of the compile line so that -O2 can be overridden as the +# occasion call for it. (ie, --enable-debug) +AM_CFLAGS = \ + -D_GNU_SOURCE $(AC_CFLAGS) + +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) \ + $(AM_CFLAGS) + +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) \$(CPPFLAGS) $(CFLAGS) $(AM_CFLAGS) + +LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@ #includes = @@ -62,10 +80,17 @@ else LIBIO_WSRCS = endif +if GLIBCPP_NEED_XTRA_LIBIO +LIBIO_XTRASRCS = \ + iofclose.c iofopen.c stdio.c +else +LIBIO_XTRASRCS = +endif + EXTRA_DIST = iostreamP.h -libio_la_LIBADD = $(LIBIO_SRCS) $(LIBIO_WSRCS) +libio_la_LIBADD = $(LIBIO_SRCS) $(LIBIO_WSRCS) $(LIBIO_XTRASRCS) libio_la_DEPENDENCIES = $(libio_la_LIBADD) -libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS) +libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS) $(LIBIO_XTRASRCS) diff --git a/libstdc++-v3/libio/Makefile.in b/libstdc++-v3/libio/Makefile.in index 4858d3d..9f56f6b 100644 --- a/libstdc++-v3/libio/Makefile.in +++ b/libstdc++-v3/libio/Makefile.in @@ -102,6 +102,7 @@ WFMT_FLAGS = @WFMT_FLAGS@ cpu_include_dir = @cpu_include_dir@ ctype_include_dir = @ctype_include_dir@ glibcpp_basedir = @glibcpp_basedir@ +ifGNUmake = @ifGNUmake@ libinst_wstring_la = @libinst_wstring_la@ AUTOMAKE_OPTIONS = 1.3 cygnus @@ -119,14 +120,36 @@ CONFIG_INCLUDES = \ INCLUDES = \ - -D_GNU_SOURCE -nostdinc++ -I$(top_srcdir) \ + -nostdinc++ -I$(top_srcdir) \ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(TOPLEVEL_INCLUDES) noinst_LTLIBRARIES = libio.la -LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +# These bits are all figured out from configure. Look in acinclude.m4 +# or configure.in to see how they are set. +# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. +AC_CFLAGS = \ + $(WERROR) @CPU_FLAGS@ @DEBUG_FLAGS@ + + +# Need to manually set this option because AC_CXXFLAGS has to be at +# the end of the compile line so that -O2 can be overridden as the +# occasion call for it. (ie, --enable-debug) +AM_CFLAGS = \ + -D_GNU_SOURCE $(AC_CFLAGS) + + +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) \ + $(AM_CFLAGS) + + +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) \$(CPPFLAGS) $(CFLAGS) $(AM_CFLAGS) + + +LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@ #includes = @@ -139,12 +162,15 @@ libio_headers = \ @GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\ @GLIBCPP_NEED_WLIBIO_TRUE@ iofwide.c wfiledoalloc.c wfileops.c wgenops.c @GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS = +@GLIBCPP_NEED_XTRA_LIBIO_TRUE@LIBIO_XTRASRCS = @GLIBCPP_NEED_XTRA_LIBIO_TRUE@\ +@GLIBCPP_NEED_XTRA_LIBIO_TRUE@ iofclose.c iofopen.c stdio.c +@GLIBCPP_NEED_XTRA_LIBIO_FALSE@LIBIO_XTRASRCS = EXTRA_DIST = iostreamP.h -libio_la_LIBADD = $(LIBIO_SRCS) $(LIBIO_WSRCS) +libio_la_LIBADD = $(LIBIO_SRCS) $(LIBIO_WSRCS) $(LIBIO_XTRASRCS) libio_la_DEPENDENCIES = $(libio_la_LIBADD) -libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS) +libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS) $(LIBIO_XTRASRCS) mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = @@ -156,30 +182,63 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libio_la_LDFLAGS = -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo fileops.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@cleanup.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofwide.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfiledoalloc.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfileops.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wgenops.lo -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@iofwide.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfiledoalloc.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfileops.lo \ -@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wgenops.lo -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \ -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \ -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo \ -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo \ -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \ -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@cleanup.lo -@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@filedoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@genops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@fileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdfiles.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@cleanup.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofwide.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfiledoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wgenops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofopen.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdio.lo +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@libio_la_OBJECTS = +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@iofwide.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfiledoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wgenops.lo +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@filedoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@genops.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@fileops.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@stdfiles.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@cleanup.lo +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofopen.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdio.lo +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@filedoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@genops.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@fileops.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdfiles.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@cleanup.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofopen.lo \ +@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdio.lo +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofwide.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfiledoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wgenops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofopen.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdio.lo +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@libio_la_OBJECTS = \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@filedoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@genops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@fileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@stdfiles.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@cleanup.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@iofwide.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfiledoalloc.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfileops.lo \ +@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wgenops.lo CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) DIST_COMMON = ChangeLog Makefile.am Makefile.in diff --git a/libstdc++-v3/libio/_G_config.h b/libstdc++-v3/libio/_G_config.h index a35d9f4..19ab4fc 100644 --- a/libstdc++-v3/libio/_G_config.h +++ b/libstdc++-v3/libio/_G_config.h @@ -6,6 +6,7 @@ #ifndef _LIBC # include <bits/c++config.h> +# define _IO_MTSAFE_IO #endif /* Define types for libio in terms of the standard internal type names. */ @@ -107,7 +108,7 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); //#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) /* This is defined by <bits/stat.h> if `st_blksize' exists. */ -#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) +/*#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)*/ #define _G_BUFSIZ 8192 @@ -119,7 +120,8 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); #define _G_VTABLE_LABEL_PREFIX_ID __vt_ #define _G_INTERNAL_CCS "UCS4" - +#define _G_HAVE_WEAK_SYMBOL 1 +#define _G_STDIO_USES_LIBIO 1 #if defined __cplusplus || defined __STDC__ # define _G_ARGS(ARGLIST) ARGLIST diff --git a/libstdc++-v3/libio/genops.c b/libstdc++-v3/libio/genops.c index 0fb89f7..c27f314 100644 --- a/libstdc++-v3/libio/genops.c +++ b/libstdc++-v3/libio/genops.c @@ -976,11 +976,9 @@ _IO_default_pbackfail (fp, c) new_buf = (char *) malloc (new_size); if (new_buf == NULL) return EOF; - memcpy (new_buf + (new_size - old_size), fp->_IO_read_base, - old_size); + memcpy (new_buf + old_size, fp->_IO_read_base, old_size); free (fp->_IO_read_base); - _IO_setg (fp, new_buf, new_buf + (new_size - old_size), - new_buf + new_size); + _IO_setg (fp, new_buf, new_buf + old_size, new_buf + new_size); fp->_IO_backup_base = fp->_IO_read_ptr; } diff --git a/libstdc++-v3/libio/iofclose.c b/libstdc++-v3/libio/iofclose.c new file mode 100644 index 0000000..3d5724a --- /dev/null +++ b/libstdc++-v3/libio/iofclose.c @@ -0,0 +1,98 @@ +/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU IO 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, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not 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 "libioP.h" +#ifdef __STDC__ +#include <stdlib.h> +#endif +#if _LIBC +# include "../iconv/gconv_int.h" +# include <shlib-compat.h> +#else +# define SHLIB_COMPAT(a, b, c) 0 +#endif + +int +_IO_new_fclose (fp) + _IO_FILE *fp; +{ + int status; + + CHECK_FILE(fp, EOF); + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + /* We desperately try to help programs which are using streams in a + strange way and mix old and new functions. Detect old streams + here. */ + if (fp->_vtable_offset != 0) + return _IO_old_fclose (fp); +#endif + + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_flockfile (fp); + if (fp->_IO_file_flags & _IO_IS_FILEBUF) + status = _IO_file_close_it (fp); + else + status = fp->_flags & _IO_ERR_SEEN ? -1 : 0; + _IO_FINISH (fp); + _IO_funlockfile (fp); + if (fp->_mode > 0) + { +#if _LIBC + /* This stream has a wide orientation. This means we have to free + the conversion functions. */ + struct _IO_codecvt *cc = &fp->_wide_data->_codecvt; + + if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL) + { + --cc->__cd_in.__cd.__steps->__counter; + __gconv_close_transform (cc->__cd_in.__cd.__steps, 1); + } + if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL) + { + --cc->__cd_out.__cd.__steps->__counter; + __gconv_close_transform (cc->__cd_out.__cd.__steps, 1); + } +#endif + } + _IO_cleanup_region_end (0); + if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); + if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr) + { + fp->_IO_file_flags = 0; + free(fp); + } + + return status; +} + +#ifdef _LIBC +versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1); +strong_alias (_IO_new_fclose, __new_fclose) +versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1); +#else +int fclose (_IO_FILE *) __attribute__ ((alias("_IO_new_fclose"))); +#endif diff --git a/libstdc++-v3/libio/iofopen.c b/libstdc++-v3/libio/iofopen.c new file mode 100644 index 0000000..eb54e6d --- /dev/null +++ b/libstdc++-v3/libio/iofopen.c @@ -0,0 +1,77 @@ +/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU IO 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, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not 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 "libioP.h" +#ifdef __STDC__ +#include <stdlib.h> +#endif +#ifdef _LIBC +# include <shlib-compat.h> +#endif + +_IO_FILE * +_IO_new_fopen (filename, mode) + const char *filename; + const char *mode; +{ + struct locked_FILE + { + struct _IO_FILE_plus fp; +#ifdef _IO_MTSAFE_IO + _IO_lock_t lock; +#endif + struct _IO_wide_data wd; + } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE)); + + if (new_f == NULL) + return NULL; +#ifdef _IO_MTSAFE_IO + new_f->fp.file._lock = &new_f->lock; +#endif +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T + _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps); +#else + _IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL); +#endif + _IO_JUMPS (&new_f->fp) = &_IO_file_jumps; + _IO_file_init (&new_f->fp); +#if !_IO_UNIFIED_JUMPTABLES + new_f->fp.vtable = NULL; +#endif + if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 1) != NULL) + return (_IO_FILE *) &new_f->fp; + _IO_un_link (&new_f->fp); + free (new_f); + return NULL; +} + +#ifdef _LIBC +strong_alias (_IO_new_fopen, __new_fopen) +versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1); +versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1); +#else +int fopen (const char *,const char *) + __attribute__ ((alias("_IO_new_fopen"))); +#endif diff --git a/libstdc++-v3/libio/libio.h b/libstdc++-v3/libio/libio.h index 409da88..e9fb03e 100644 --- a/libstdc++-v3/libio/libio.h +++ b/libstdc++-v3/libio/libio.h @@ -310,6 +310,9 @@ struct _IO_FILE_complete /* Wide character stream stuff. */ struct _IO_codecvt *_codecvt; struct _IO_wide_data *_wide_data; +# else + void *__pad1; + void *__pad2; # endif int _mode; /* Make sure we don't get into trouble again. */ diff --git a/libstdc++-v3/libio/stdfiles.c b/libstdc++-v3/libio/stdfiles.c index 6441bfb..b81fef8 100644 --- a/libstdc++-v3/libio/stdfiles.c +++ b/libstdc++-v3/libio/stdfiles.c @@ -31,12 +31,9 @@ hand, we don't need a C++ compiler to build this file.) */ #include "libioP.h" -#ifndef _LIBC -# include <bits/c++config.h> -#endif -#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -# ifdef _IO_MTSAFE_IO +#ifdef _IO_MTSAFE_IO +# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \ static struct _IO_wide_data _IO_wide_data_##FD \ @@ -46,18 +43,18 @@ &_IO_file_jumps}; # else # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ - static struct _IO_wide_data _IO_wide_data_##FD \ - = { ._wide_vtable = &_IO_wfile_jumps }; \ + static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \ struct _IO_FILE_plus NAME \ - = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \ + = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \ &_IO_file_jumps}; # endif #else -# ifdef _IO_MTSAFE_IO +# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ - static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \ + static struct _IO_wide_data _IO_wide_data_##FD \ + = { ._wide_vtable = &_IO_wfile_jumps }; \ struct _IO_FILE_plus NAME \ - = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \ + = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \ &_IO_file_jumps}; # else # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ diff --git a/libstdc++-v3/libio/stdio.c b/libstdc++-v3/libio/stdio.c new file mode 100644 index 0000000..95829d6 --- /dev/null +++ b/libstdc++-v3/libio/stdio.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU IO 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, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not 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 "libioP.h" + +#undef stdin +#undef stdout +#undef stderr +_IO_FILE *stdin = (_IO_FILE *) &_IO_2_1_stdin_; +_IO_FILE *stdout = (_IO_FILE *) &_IO_2_1_stdout_; +_IO_FILE *stderr = (_IO_FILE *) &_IO_2_1_stderr_; + +#undef _IO_stdin +#undef _IO_stdout +#undef _IO_stderr +#ifdef _LIBC +strong_alias (stdin, _IO_stdin); +strong_alias (stdout, _IO_stdout); +strong_alias (stderr, _IO_stderr); +#endif diff --git a/libstdc++-v3/math/Makefile.in b/libstdc++-v3/math/Makefile.in index 06e482f..4345d82 100644 --- a/libstdc++-v3/math/Makefile.in +++ b/libstdc++-v3/math/Makefile.in @@ -103,6 +103,7 @@ WFMT_FLAGS = @WFMT_FLAGS@ cpu_include_dir = @cpu_include_dir@ ctype_include_dir = @ctype_include_dir@ glibcpp_basedir = @glibcpp_basedir@ +ifGNUmake = @ifGNUmake@ libinst_wstring_la = @libinst_wstring_la@ AUTOMAKE_OPTIONS = 1.3 cygnus diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 7b344a4..9b5fcd6 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -189,10 +189,11 @@ cpu_headers = \ sources = \ - limitsMEMBERS.cc c++io.cc \ + limitsMEMBERS.cc \ cmath.cc \ complex.cc complexf.cc complexl.cc complex_io.cc \ - stdexcept.cc ios.cc stdstreams.cc strstream.cc \ + stdexcept.cc \ + c++io.cc ios.cc stdstreams.cc strstream.cc \ locale.cc localename.cc \ locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index b7bf82b..06bfccd 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -101,6 +101,7 @@ WFMT_FLAGS = @WFMT_FLAGS@ cpu_include_dir = @cpu_include_dir@ ctype_include_dir = @ctype_include_dir@ glibcpp_basedir = @glibcpp_basedir@ +ifGNUmake = @ifGNUmake@ libinst_wstring_la = @libinst_wstring_la@ AUTOMAKE_OPTIONS = 1.3 gnits @@ -266,10 +267,11 @@ cpu_headers = \ sources = \ - limitsMEMBERS.cc c++io.cc \ + limitsMEMBERS.cc \ cmath.cc \ complex.cc complexf.cc complexl.cc complex_io.cc \ - stdexcept.cc ios.cc stdstreams.cc strstream.cc \ + stdexcept.cc \ + c++io.cc ios.cc stdstreams.cc strstream.cc \ locale.cc localename.cc \ locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc @@ -318,8 +320,8 @@ libinst_string_la_OBJECTS = libinst-string.la.lo libinst_wstring_la_LDFLAGS = libinst_wstring_la_LIBADD = libinst_wstring_la_OBJECTS = wstring-inst.lo -libstdc___la_OBJECTS = limitsMEMBERS.lo c++io.lo cmath.lo complex.lo \ -complexf.lo complexl.lo complex_io.lo stdexcept.lo ios.lo stdstreams.lo \ +libstdc___la_OBJECTS = limitsMEMBERS.lo cmath.lo complex.lo complexf.lo \ +complexl.lo complex_io.lo stdexcept.lo c++io.lo ios.lo stdstreams.lo \ strstream.lo locale.lo localename.lo locale-inst.lo stl-inst.lo \ misc-inst.lo valarray-inst.lo string-inst.lo CXXFLAGS = @CXXFLAGS@ diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc index f2ebb98..6598842 100644 --- a/libstdc++-v3/src/ios.cc +++ b/libstdc++-v3/src/ios.cc @@ -272,7 +272,7 @@ namespace std { #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS // 49. Underspecification of ios_base::sync_with_stdio bool __retval = __ioinit._M_cin->_M_file->get_fileno() == 0; - + // Turn off sync with C FILE* for cin, cout, cerr, clog. if (!__sync && __retval) { |