aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@gcc.gnu.org>2000-08-15 07:33:00 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2000-08-15 07:33:00 +0000
commitd04703d6d701b2a22b11d94c6fbfa2c44a522092 (patch)
tree89ac49e996bad10bbe476c96c7b956f2cc858d99 /libstdc++-v3
parent9f34e6e805cd37bb4c095889eafa0949d1274cfa (diff)
downloadgcc-d04703d6d701b2a22b11d94c6fbfa2c44a522092.zip
gcc-d04703d6d701b2a22b11d94c6fbfa2c44a522092.tar.gz
gcc-d04703d6d701b2a22b11d94c6fbfa2c44a522092.tar.bz2
C/C++ io merge/sync.
2000-08-14 Benjamin Kosnik <bkoz@purist.soma.redhat.com> C/C++ io merge/sync. * libio/fileops.c * libio/genops.c * libio/iofclose.c * libio/iofopen.c * libio/iofwide.c * libio/libio.h * libio/libioP.h * libio/stdio.c * libio/wfileops.c * libio/wgenops.c * config/c_io_libio.cc (__basic_file): Add hacky casts to ((struct _IO_FILE_plus *) in ctors. (__basic_file<wchar_t>): Adjust _wide_data->_codecvt to just _codecvt. * libio/Makefile.am: Fix copyright. Remove cleanup.c. * libio/cleanup.c: Remove. * libio/filedoalloc.c (_IO_file_doallocate): Don't call _IO_cleanup_registration_needed, even if not libc. * testsuite/27_io/stringstream.cc (test02): Fix. From-SVN: r35694
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog19
-rw-r--r--libstdc++-v3/config/c_io_libio.cc6
-rwxr-xr-xlibstdc++-v3/configure25
-rw-r--r--libstdc++-v3/libio/ChangeLog8
-rw-r--r--libstdc++-v3/libio/Makefile.am6
-rw-r--r--libstdc++-v3/libio/Makefile.in9
-rw-r--r--libstdc++-v3/libio/filedoalloc.c9
-rw-r--r--libstdc++-v3/libio/fileops.c2
-rw-r--r--libstdc++-v3/libio/genops.c9
-rw-r--r--libstdc++-v3/libio/iofclose.c5
-rw-r--r--libstdc++-v3/libio/iofopen.c5
-rw-r--r--libstdc++-v3/libio/iofwide.c35
-rw-r--r--libstdc++-v3/libio/libio.h6
-rw-r--r--libstdc++-v3/libio/libioP.h14
-rw-r--r--libstdc++-v3/libio/stdio.c7
-rw-r--r--libstdc++-v3/libio/wfileops.c8
-rw-r--r--libstdc++-v3/libio/wgenops.c1
17 files changed, 87 insertions, 87 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 48df831..53e6937 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,24 @@
2000-08-14 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
+ C/C++ io merge/sync.
+ * libio/fileops.c
+ * libio/genops.c
+ * libio/iofclose.c
+ * libio/iofopen.c
+ * libio/iofwide.c
+ * libio/libio.h
+ * libio/libioP.h
+ * libio/stdio.c
+ * libio/wfileops.c
+ * libio/wgenops.c
+ * config/c_io_libio.cc (__basic_file): Add hacky casts to
+ ((struct _IO_FILE_plus *) in ctors.
+ (__basic_file<wchar_t>): Adjust _wide_data->_codecvt to just _codecvt.
+ * libio/Makefile.am: Fix copyright. Remove cleanup.c.
+ * libio/cleanup.c: Remove.
+ * libio/filedoalloc.c (_IO_file_doallocate): Don't call
+ _IO_cleanup_registration_needed, even if not libc.
+
* testsuite/27_io/stringstream.cc (test02): Fix.
2000-08-14 Brent Verner <brent@rcfile.org>
diff --git a/libstdc++-v3/config/c_io_libio.cc b/libstdc++-v3/config/c_io_libio.cc
index 6b35862..6f001b2 100644
--- a/libstdc++-v3/config/c_io_libio.cc
+++ b/libstdc++-v3/config/c_io_libio.cc
@@ -206,7 +206,7 @@ namespace std {
#endif
// Don't set the orientation of the stream when initializing.
_IO_no_init(this, 0, 0, &_M_wfile, 0);
- _IO_JUMPS(this) = &_IO_file_jumps;
+ _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps;
_IO_file_init((_IO_FILE_plus*)this);
}
@@ -268,7 +268,7 @@ namespace std {
#endif
// Don't set the orientation of the stream when initializing.
_IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps);
- _IO_JUMPS(this) = &_IO_wfile_jumps;
+ _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps;
_IO_file_init((_IO_FILE_plus*)this);
// In addition, need to allocate the buffer...
@@ -281,7 +281,7 @@ namespace std {
_IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base);
// Setup codecvt bits...
- _wide_data->_codecvt = __c_libio_codecvt;
+ _codecvt = &__c_libio_codecvt;
// Do the same for narrow bits...
if (_IO_write_base == NULL)
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 90dbacc..d1b4b7f 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -1863,7 +1863,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux*)
+linux-gnu*)
case "$host_cpu" in
alpha* | i*86 | powerpc* | sparc* | ia64* )
lt_cv_deplibs_check_method=pass_all ;;
@@ -18136,15 +18136,12 @@ else
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -18199,7 +18196,7 @@ main()
/*
* First, make a file with some known garbage in it.
*/
- data = (char*)malloc(pagesize);
+ data = malloc(pagesize);
if (!data)
exit(1);
for (i = 0; i < pagesize; ++i)
@@ -18220,7 +18217,7 @@ main()
fd = open("conftestmmap", O_RDWR);
if (fd < 0)
exit(1);
- data2 = (char*)malloc(2 * pagesize);
+ data2 = malloc(2 * pagesize);
if (!data2)
exit(1);
data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -18238,7 +18235,7 @@ main()
*/
for (i = 0; i < pagesize; ++i)
*(data2 + i) = *(data2 + i) + 1;
- data3 = (char*)malloc(pagesize);
+ data3 = malloc(pagesize);
if (!data3)
exit(1);
if (read(fd, data3, pagesize) != pagesize)
@@ -18252,7 +18249,7 @@ main()
}
EOF
-if { (eval echo configure:18256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:18253: \"$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
@@ -18315,19 +18312,19 @@ fi
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:18319: checking for LC_MESSAGES" >&5
+echo "configure:18316: 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 18324 "configure"
+#line 18321 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:18331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18328: \"$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
diff --git a/libstdc++-v3/libio/ChangeLog b/libstdc++-v3/libio/ChangeLog
index 870bb78..4dc4b84 100644
--- a/libstdc++-v3/libio/ChangeLog
+++ b/libstdc++-v3/libio/ChangeLog
@@ -1,3 +1,11 @@
+2000-08-14 Benjamin Kosnik <bkoz@gnu.org>
+
+ * *: Merge with mainline glibc sources.
+ * filedoalloc.c (_IO_file_doallocate): Don't call
+ _IO_cleanup_registration_needed, even if not libc.
+ * iofwide.c (_IO_fwide): Correct placement of defines.
+ * cleanup.c: Remove.
+
2000-08-04 benjamin kosnik <bkoz@haight.constant.com>
* genops.c (_IO_unbuffer_write): Don't call _IO_SETBUF if the
diff --git a/libstdc++-v3/libio/Makefile.am b/libstdc++-v3/libio/Makefile.am
index 0493e93..44e56cc 100644
--- a/libstdc++-v3/libio/Makefile.am
+++ b/libstdc++-v3/libio/Makefile.am
@@ -1,6 +1,6 @@
## Makefile for the libio subdirectory of the GNU C++ Standard library.
##
-## Copyright (C) 1999, 2000 Cygnus Solutions
+## Copyright (C) 1999, 2000 Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
## Process this file with automake to produce Makefile.in.
@@ -64,14 +64,14 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@
-#includes =
libio_headers = \
libio.h libioP.h iolibio.h
if GLIBCPP_NEED_LIBIO
LIBIO_SRCS = \
- filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c
+# filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
else
LIBIO_SRCS =
endif
diff --git a/libstdc++-v3/libio/Makefile.in b/libstdc++-v3/libio/Makefile.in
index 83409fc..85f6e1a 100644
--- a/libstdc++-v3/libio/Makefile.in
+++ b/libstdc++-v3/libio/Makefile.in
@@ -142,11 +142,10 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS)
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@
-#includes =
-
libio_headers = libio.h libioP.h iolibio.h
-@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+# filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = wfiledoalloc.c wfileops.c wgenops.c
@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
@@ -174,7 +173,6 @@ libio_la_LDFLAGS =
@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@c_codecvt.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 \
@@ -193,7 +191,6 @@ libio_la_LDFLAGS =
@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_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@c_codecvt.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@iofwide.lo \
@@ -205,7 +202,6 @@ libio_la_LDFLAGS =
@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@c_codecvt.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofwide.lo \
@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \
@@ -224,7 +220,6 @@ libio_la_LDFLAGS =
@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@c_codecvt.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 \
diff --git a/libstdc++-v3/libio/filedoalloc.c b/libstdc++-v3/libio/filedoalloc.c
index 6abab60..12c1135 100644
--- a/libstdc++-v3/libio/filedoalloc.c
+++ b/libstdc++-v3/libio/filedoalloc.c
@@ -75,15 +75,6 @@ _IO_file_doallocate (fp)
char *p;
struct _G_stat64 st;
-#ifndef _LIBC
- /* If _IO_cleanup_registration_needed is non-zero, we should call the
- function it points to. This is to make sure _IO_cleanup gets called
- on exit. We call it from _IO_file_doallocate, since that is likely
- to get called by any program that does buffered I/O. */
- if (_IO_cleanup_registration_needed)
- (*_IO_cleanup_registration_needed) ();
-#endif
-
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
{
couldbetty = 0;
diff --git a/libstdc++-v3/libio/fileops.c b/libstdc++-v3/libio/fileops.c
index f3baa04..a830b5c 100644
--- a/libstdc++-v3/libio/fileops.c
+++ b/libstdc++-v3/libio/fileops.c
@@ -305,7 +305,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
return NULL;
}
- cc = &fp->_wide_data->_codecvt;
+ cc = fp->_codecvt = &fp->_wide_data->_codecvt;
/* The functions are always the same. */
*cc = __libio_codecvt;
diff --git a/libstdc++-v3/libio/genops.c b/libstdc++-v3/libio/genops.c
index 5d8f520..b1ae5af 100644
--- a/libstdc++-v3/libio/genops.c
+++ b/libstdc++-v3/libio/genops.c
@@ -758,8 +758,9 @@ _IO_flush_all ()
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|| (fp->_vtable_offset == 0
&& fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
- > fp->_wide_data->_IO_write_base)))
+ > fp->_wide_data->_IO_write_base))
#endif
+ )
&& _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF;
return result;
@@ -983,9 +984,11 @@ _IO_default_pbackfail (fp, c)
new_buf = (char *) malloc (new_size);
if (new_buf == NULL)
return EOF;
- memcpy (new_buf + old_size, fp->_IO_read_base, old_size);
+ memcpy (new_buf + (new_size - old_size), fp->_IO_read_base,
+ old_size);
free (fp->_IO_read_base);
- _IO_setg (fp, new_buf, new_buf + old_size, new_buf + new_size);
+ _IO_setg (fp, new_buf, new_buf + (new_size - 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
index 3d5724a..43a3f58 100644
--- a/libstdc++-v3/libio/iofclose.c
+++ b/libstdc++-v3/libio/iofclose.c
@@ -32,6 +32,7 @@
# include <shlib-compat.h>
#else
# define SHLIB_COMPAT(a, b, c) 0
+# define _IO_new_fclose fclose
#endif
int
@@ -63,7 +64,7 @@ _IO_new_fclose (fp)
#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;
+ struct _IO_codecvt *cc = fp->_codecvt;
if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
{
@@ -93,6 +94,4 @@ _IO_new_fclose (fp)
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
index eb54e6d..f34fd1e 100644
--- a/libstdc++-v3/libio/iofopen.c
+++ b/libstdc++-v3/libio/iofopen.c
@@ -29,6 +29,8 @@
#endif
#ifdef _LIBC
# include <shlib-compat.h>
+#else
+# define _IO_new_fopen fopen
#endif
_IO_FILE *
@@ -71,7 +73,4 @@ _IO_new_fopen (filename, mode)
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/iofwide.c b/libstdc++-v3/libio/iofwide.c
index 77b4591..886f36f 100644
--- a/libstdc++-v3/libio/iofwide.c
+++ b/libstdc++-v3/libio/iofwide.c
@@ -38,6 +38,7 @@
# include <iconv/gconv_int.h>
#endif
+
/* Prototypes of libio's codecvt functions. */
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
__mbstate_t *statep,
@@ -76,14 +77,14 @@ struct _IO_codecvt __libio_codecvt =
};
-/* static struct __gconv_trans_data libio_translit =*/
#ifdef _LIBC
-struct __gconv_trans_data libio_translit =
+static struct __gconv_trans_data libio_translit =
{
.__trans_fct = __gconv_transliterate
};
#endif
+
/* Return orientation of stream. If mode is nonzero try to change
the orientation first. */
#undef _IO_fwide
@@ -103,15 +104,12 @@ _IO_fwide (fp, mode)
/* Set the orientation appropriately. */
if (mode > 0)
{
- struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+ struct _IO_codecvt *cc = fp->_codecvt;
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
#ifdef _LIBC
- /* The functions are always the same. */
- *cc = __libio_codecvt;
-
/* Get the character conversion functions based on the currently
selected locale for LC_CTYPE. */
{
@@ -123,6 +121,9 @@ _IO_fwide (fp, mode)
__wcsmbs_clone_conv (&fcts);
+ /* The functions are always the same. */
+ *cc = __libio_codecvt;
+
cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
cc->__cd_in.__cd.__steps = fcts.towc;
@@ -142,18 +143,13 @@ _IO_fwide (fp, mode)
cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
- /* XXX For now no transliteration. */
-#ifdef _LIBC
+ /* And now the transliteration. */
cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
-#else
- cc->__cd_out.__cd.__data[0].__trans = NULL;
-#endif
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
{
/* Determine internal and external character sets.
-
XXX For now we make our life easy: we assume a fixed internal
encoding (as most sane systems have; hi HP/UX!). If somebody
cares about systems which changing internal charsets they
@@ -195,6 +191,7 @@ _IO_fwide (fp, mode)
weak_alias (_IO_fwide, fwide)
#endif
+
static enum __codecvt_result
do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
const wchar_t *from_start, const wchar_t *from_end,
@@ -239,7 +236,6 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
}
#else
# ifdef _GLIBCPP_USE_WCHAR_T
-
size_t res;
const char *from_start_copy = (const char *) from_start;
size_t from_len = from_end - from_start;
@@ -309,7 +305,7 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
size_t to_len = to_end - to_start;
res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
-
+
if (res == 0)
result = __codecvt_ok;
else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
@@ -376,7 +372,7 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
&to_start_copy, &to_len);
-
+
if (res == 0)
result = __codecvt_ok;
else if (to_len == 0)
@@ -455,7 +451,7 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
&to_start, &max);
-
+
result = from_start_copy - (char *) from_start;
# else
/* Decide what to do. */
@@ -476,10 +472,3 @@ do_max_length (struct _IO_codecvt *codecvt)
return MB_CUR_MAX;
#endif
}
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/libio/libio.h b/libstdc++-v3/libio/libio.h
index 7b3b2e1..d26a5e5 100644
--- a/libstdc++-v3/libio/libio.h
+++ b/libstdc++-v3/libio/libio.h
@@ -227,7 +227,6 @@ struct _IO_codecvt
_IO_iconv_t __cd_in;
_IO_iconv_t __cd_out;
};
-#endif
/* Extra data for wide character streams. */
struct _IO_wide_data
@@ -249,8 +248,8 @@ struct _IO_wide_data
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
__mbstate_t _IO_state;
__mbstate_t _IO_last_state;
- struct _IO_codecvt _codecvt;
#endif
+ struct _IO_codecvt _codecvt;
wchar_t _shortbuf[1];
@@ -258,6 +257,7 @@ struct _IO_wide_data
struct _IO_jump_t *_wide_vtable;
#endif
};
+#endif
struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
@@ -496,5 +496,3 @@ extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
#endif
#endif /* _IO_STDIO_H */
-
-
diff --git a/libstdc++-v3/libio/libioP.h b/libstdc++-v3/libio/libioP.h
index b2a4ecf..4bbee9c 100644
--- a/libstdc++-v3/libio/libioP.h
+++ b/libstdc++-v3/libio/libioP.h
@@ -69,13 +69,13 @@ extern "C" {
# define _IO_JUMPS_OFFSET 1
#endif
-#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
+#define _IO_JUMPS(THIS) (THIS)->vtable
#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
#if _IO_JUMPS_OFFSET
# define _IO_JUMPS_FUNC(THIS) \
- (*(struct _IO_jump_t **) ((char *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
+ (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
+ (THIS)->_vtable_offset))
#else
# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
@@ -714,19 +714,19 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
# else
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
NULL, WDP, 0 }
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
0 }
# endif
@@ -741,13 +741,13 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
NULL, WDP, 0 }
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
0 }
# endif
diff --git a/libstdc++-v3/libio/stdio.c b/libstdc++-v3/libio/stdio.c
index 95829d6..3b897ce 100644
--- a/libstdc++-v3/libio/stdio.c
+++ b/libstdc++-v3/libio/stdio.c
@@ -24,13 +24,14 @@
General Public License. */
#include "libioP.h"
+#include "stdio.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_;
+_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
+_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
+_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
#undef _IO_stdin
#undef _IO_stdout
diff --git a/libstdc++-v3/libio/wfileops.c b/libstdc++-v3/libio/wfileops.c
index e30bbe1..f12cb22 100644
--- a/libstdc++-v3/libio/wfileops.c
+++ b/libstdc++-v3/libio/wfileops.c
@@ -76,7 +76,7 @@ _IO_wdo_write (fp, data, to_do)
const wchar_t *data;
_IO_size_t to_do;
{
- struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+ struct _IO_codecvt *cc = fp->_codecvt;
if (to_do > 0)
{
@@ -150,7 +150,7 @@ _IO_wfile_underflow (fp)
if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
return *fp->_wide_data->_IO_read_ptr;
- cd = &fp->_wide_data->_codecvt;
+ cd = fp->_codecvt;
/* Maybe there is something left in the external buffer. */
if (fp->_IO_read_ptr < fp->_IO_read_end)
@@ -379,7 +379,7 @@ _IO_wfile_sync (fp)
{
/* We have to find out how many bytes we have to go back in the
external buffer. */
- struct _IO_codecvt *cv = &fp->_wide_data->_codecvt;
+ struct _IO_codecvt *cv = fp->_codecvt;
_IO_off64_t new_pos;
int clen = (*cv->__codecvt_do_encoding) (cv);
@@ -483,7 +483,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
/* Adjust for read-ahead (bytes is buffer). To do this we must
find out which position in the external buffer corresponds to
the current position in the internal buffer. */
- cv = &fp->_wide_data->_codecvt;
+ cv = fp->_codecvt;
clen = (*cv->__codecvt_do_encoding) (cv);
if (clen > 0)
diff --git a/libstdc++-v3/libio/wgenops.c b/libstdc++-v3/libio/wgenops.c
index 7440e69..fa0aab3 100644
--- a/libstdc++-v3/libio/wgenops.c
+++ b/libstdc++-v3/libio/wgenops.c
@@ -39,6 +39,7 @@
# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
#endif
+
static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
#ifdef _LIBC
internal_function