public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A libio patch for egcs 1.0.2
@ 1998-02-16 19:55 H.J. Lu
  1998-02-18  1:53 ` Jeffrey A Law
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1998-02-16 19:55 UTC (permalink / raw)
  To: egcs

Hi,

Here is a libio patch for egcs 1.0.2 to fix the getline bug. We have
to keep _IO_getline since it is an internal function of the
shared glibc. 

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
----
Mon Feb 16 10:36:26 1998  H.J. Lu  (hjl@gnu.org)

	* config/linux.mt (IO_OBJECTS): Add iogetline.o.
	* config/linuxlibc1.mt: Ditto.

	* iogetline.c (_IO_getline_info): Renamed from _IO_getline.
	(_IO_getline): Just call _IO_getline_info.

	* isgetline.cc (istream::getline, istream::get, _sb_readline):
	Call _IO_getline_info instead of _IO_getline and get the EOF
	information.
	* sbgetline.cc (streambuf::sgetline): Ditto.

	* libioP.h (_IO_getline_info): New declaration.

Fri Feb 13 23:14:49 1998  Per Bothner <bothner@cygnus.com>

	* iogetline.c (_IO_getline): Handle the case when there is no
	buffer.

--- /home/work/misc/gnu/import/egcs/libio/config/linux.mt	Thu Nov 27 00:34:23 1997
+++ config/linux.mt	Thu Feb 12 07:53:21 1998
@@ -16,7 +16,7 @@
 LIBIO_INCLUDE=
 
 # We have those in libc.a.
-IO_OBJECTS=
+IO_OBJECTS= iogetline.o
 STDIO_WRAP_OBJECTS=
 OSPRIM_OBJECTS=
 STDIO_OBJECTS=
--- /home/work/misc/gnu/import/egcs/libio/config/linuxlibc1.mt	Wed Oct 22 18:17:58 1997
+++ config/linuxlibc1.mt	Thu Feb 12 07:53:30 1998
@@ -11,7 +11,7 @@
 # We have those in libc.a.
 IO_OBJECTS=iogetc.o ioputc.o iofeof.o ioferror.o \
 	filedoalloc.o fileops.o genops.o iofclose.o \
-	iovsprintf.o iovsscanf.o strops.o
+	iovsprintf.o iovsscanf.o strops.o iogetline.o
 STDIO_WRAP_OBJECTS=
 OSPRIM_OBJECTS=
 STDIO_OBJECTS=
--- /home/work/misc/gnu/import/egcs/libio/iogetline.c	Sat Sep  6 00:43:18 1997
+++ iogetline.c	Mon Feb 16 10:48:18 1998
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -26,6 +26,19 @@
 #include "libioP.h"
 #include <string.h>
 
+#if defined(_LIBC) || !_G_HAVE_IO_GETLINE_INFO
+
+_IO_size_t
+_IO_getline (fp, buf, n, delim, extract_delim)
+     _IO_FILE *fp;
+     char *buf;
+     _IO_size_t n;
+     int delim;
+     int extract_delim;
+{
+  return _IO_getline_info (fp, buf, n, delim, extract_delim, (int *) 0);
+}
+
 /* Algorithm based on that used by Berkeley pre-4.4 fgets implementation.
 
    Read chars into buf (of size n), until delim is seen.
@@ -35,44 +48,65 @@
    If extract_delim > 0, insert delim in output. */
 
 _IO_size_t
-_IO_getline (fp, buf, n, delim, extract_delim)
+_IO_getline_info (fp, buf, n, delim, extract_delim, eof)
      _IO_FILE *fp;
      char *buf;
      _IO_size_t n;
      int delim;
      int extract_delim;
+     int *eof;
 {
   char *ptr = buf;
+  if (eof) *eof = 0;
   do
     {
       _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
-      char *t;
       if (len <= 0)
-	if (__underflow (fp) == EOF)
-	  break;
-	else
-	  len = fp->_IO_read_end - fp->_IO_read_ptr;
-      if ((_IO_size_t) len >= n)
-	len = n;
-      t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len);
-      if (t != NULL)
 	{
-	  _IO_size_t old_len = ptr-buf;
-	  len = t - fp->_IO_read_ptr;
-	  if (extract_delim >= 0)
+	  int c = __uflow (fp);
+	  if (c == EOF)
+	    {
+	      if (eof) *eof = c;
+	      break;
+	    }
+	  if (c == delim)
 	    {
-	      ++t;
 	      if (extract_delim > 0)
-		++len;
+		*ptr++ = c;
+	      else if (extract_delim < 0)
+		_IO_sputbackc (fp, c);
+	      return ptr - buf;
 	    }
-	  memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
-	  fp->_IO_read_ptr = t;
-	  return old_len + len;
+	  *ptr++ = c;
+	  n--;
 	}
-      memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
-      fp->_IO_read_ptr += len;
-      ptr += len;
-      n -= len;
+	else
+	  {
+	    char *t;
+	    if ((_IO_size_t) len >= n)
+	      len = n;
+	    t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len);
+	    if (t != NULL)
+	      {
+		_IO_size_t old_len = ptr-buf;
+		len = t - fp->_IO_read_ptr;
+		if (extract_delim >= 0)
+		  {
+		    ++t;
+		    if (extract_delim > 0)
+		      ++len;
+		  }
+		memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
+		fp->_IO_read_ptr = t;
+		return old_len + len;
+	      }
+	    memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
+	    fp->_IO_read_ptr += len;
+	    ptr += len;
+	    n -= len;
+	  }
     } while (n != 0);
   return ptr - buf;
 }
+
+#endif /* Defined(_LIBC) || !_G_HAVE_IO_GETLINE_INFO */
--- /home/work/misc/gnu/import/egcs/libio/isgetline.cc	Thu Aug 21 15:58:19 1997
+++ isgetline.cc	Mon Feb 16 10:48:27 1998
@@ -38,8 +38,9 @@
   if (ipfx1())
     {
       streambuf *sb = rdbuf();
-      _gcount = _IO_getline(sb, buf, len - 1, delim, -1);
-      ch = sb->sbumpc();
+      _gcount = _IO_getline_info(sb, buf, len - 1, delim, -1, &ch);
+      if (ch != EOF)
+	ch = sb->sbumpc();
       if (ch == EOF)
 	set (_gcount == 0 ? (ios::failbit|ios::eofbit) : ios::eofbit);
       else if (ch != (unsigned char) delim)
@@ -67,8 +68,9 @@
   if (ipfx1())
     {
       streambuf *sbuf = rdbuf();
-      long count = _IO_getline(sbuf, buf, len - 1, delim, -1);
-      if (count == 0 && sbuf->sgetc() == EOF)
+      int ch;
+      long count = _IO_getline_info(sbuf, buf, len - 1, delim, -1, &ch);
+      if (_gcount == 0 && ch == EOF)
 	set(ios::failbit|ios::eofbit);
       else
 	_gcount = count;
@@ -92,8 +94,10 @@
     char *ptr;
     int ch;
     
-    _IO_size_t count = _IO_getline(sb, buf, CHUNK_SIZE, terminator, -1);
-    ch = sb->sbumpc();
+    _IO_size_t count = _IO_getline_info(sb, buf, CHUNK_SIZE, terminator,
+				       -1, &ch);
+    if (ch != EOF)
+      ch = sb->sbumpc();
     long old_total = total;
     total += count;
     if (ch != EOF && ch != terminator) {
--- /home/work/misc/gnu/import/egcs/libio/sbgetline.cc	Thu Aug 21 15:58:21 1997
+++ sbgetline.cc	Mon Feb 16 10:48:38 1998
@@ -27,5 +27,5 @@
 
 long streambuf::sgetline(char* buf, _IO_size_t n, char delim, int extract_delim)
 {
-  return _IO_getline(this, buf, n, delim, extract_delim);
+  return _IO_getline_info(this, buf, n, delim, extract_delim, (int *) 0);
 }
--- /home/work/misc/gnu/import/egcs/libio/libioP.h	Wed Nov 26 15:14:35 1997
+++ libioP.h	Mon Feb 16 10:48:50 1998
@@ -377,6 +417,8 @@
 
 
 extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
+extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
+					 int, int, int *));
 extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
 extern double _IO_strtod __P ((const char *, char **));
 extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-16 19:55 A libio patch for egcs 1.0.2 H.J. Lu
@ 1998-02-18  1:53 ` Jeffrey A Law
  0 siblings, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-18  1:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

  In message < m0y4e8L-00058fC@ocean.lucon.org >you write:
  > Hi,
  > 
  > Here is a libio patch for egcs 1.0.2 to fix the getline bug. We have
  > to keep _IO_getline since it is an internal function of the
  > shared glibc. 
  > 
  > Mon Feb 16 10:36:26 1998  H.J. Lu  (hjl@gnu.org)
  > 
  > 	* config/linux.mt (IO_OBJECTS): Add iogetline.o.
  > 	* config/linuxlibc1.mt: Ditto.
  > 
  > 	* iogetline.c (_IO_getline_info): Renamed from _IO_getline.
  > 	(_IO_getline): Just call _IO_getline_info.
  > 
  > 	* isgetline.cc (istream::getline, istream::get, _sb_readline):
  > 	Call _IO_getline_info instead of _IO_getline and get the EOF
  > 	information.
  > 	* sbgetline.cc (streambuf::sgetline): Ditto.
  > 
  > 	* libioP.h (_IO_getline_info): New declaration.
  > 
  > Fri Feb 13 23:14:49 1998  Per Bothner <bothner@cygnus.com>
  > 
  > 	* iogetline.c (_IO_getline): Handle the case when there is no
  > 	buffer.
I have installed this on both the release branch and in the mainline
sources.

Thanks,
jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-18 17:15 H.J. Lu
  1998-02-22 14:25 ` Jeffrey A Law
@ 1998-02-24 20:44 ` Jeffrey A Law
  1 sibling, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-24 20:44 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

  In message < m0y5Fva-00058KC@ocean.lucon.org >you write:
  > Hi,
  > 
  > This patch from egcs for egcs 1.0.2 will enable libio to support
  > "make check" when libstdc++ is configured for gcc 2.8.1.
  > 
  > Thanks.
  > 
  > 
  > -- 
  > H.J. Lu (hjl@gnu.org)
  > --
  > Tue Jan 27 10:35:22 1998  H.J. Lu  (hjl@gnu.org)
  > 
  > 	* configure.in (topsrcdir): New.
  > 	(CHECK_SUBDIRS, configdirs): Check ${topsrcdir}/gcc instead.
  > 	(config-ml.in): Use ${topsrcdir}/config-ml.in.
  > 
  > 	* tests/configure.in (topsrcdir): New.
  > 	(CHECK): Check ${topsrcdir}/gcc instead.
  > 
  > Tue Jan 13 21:30:33 1998  H.J. Lu  (hjl@gnu.org)
  > 
  > 	* configure.in (CHECK_SUBDIRS): Set to testsuite only if
  > 	${srcdir}/../gcc exists.
  > 	(configdirs): Include testsuite only if ${srcdir}/../gcc exists.
  > 
  > 	* tests/Makefile.in (check): Depend on $(CHECK).
  > 
  > 	* tests/configure.in (CHECK): Set to "check-iostream
  > 	check-stdio" if ${srcdir}/../../gcc doesn't exists.
Like the libstdc++ version, I'm convinced we need this change, but
I went ahead and installed it on the release branch.
jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-23  9:19       ` H.J. Lu
@ 1998-02-24 11:46         ` Manfred Hollstein
  0 siblings, 0 replies; 9+ messages in thread
From: Manfred Hollstein @ 1998-02-24 11:46 UTC (permalink / raw)
  To: hjl; +Cc: law, egcs

On Mon, 23 February 1998, 09:18:47, hjl@lucon.org wrote:

 > > 
 > > 
 > >   In message < m0y71QD-00058gC@ocean.lucon.org >you write:
 > >   > The patch is in egcs and is tested. I don't think it should hurt
 > >   > anything.
 > > That's not the question.  Lots of patches which can't hurt something
 > > are not necessary and thus do not belong in the release.
 > > 
 > > Is the patch necessary?  If so, please explain why.
 > > 
 > 
 > It is helpful to people who maintains libstdc++ 2.8.x which I believe
 > is based on egcs 1.0.2.

I believe we need not hold up egcs-1.0.2; the patches (configure.in stuff
_and_ the glibc 2.1 compatibility issues) are in the supposed libstdc++-2.8.1
to be released together with gcc-2.8.1:

On Tue, 24 February 1998, 15:20:20, manfred@s-direktnet.de wrote:

 >  > libstdc++-2.8.1-980224   adds compatibility  fixes  for  glibc 2.1. If
 >  > you're not using glibc 2.1 or do not intend to do so, there is no need
 >  > for you to download and test this snapshot.
 >  > 
 >  > Diffs and the original are available from < ftp://jim.ultra.nyu.edu/pub/kenner >:
 >  > 
 >  > # Whole file CRCs generated by Brik v2.0.  Use "brik -C" to verify them.
 >  > 
 >  > # CRC-32        filename
 >  > # ------        --------
 >  > 
 >  > 1287490940b     libstdc++-2.8.0-2.8.1-980224.diff.gz
 >  > 1497722357b     libstdc++-2.8.1-980222-2.8.1-980224.diff.gz
 >  > 2147576829b     libstdc++-2.8.1-980224.tar.gz
 >  > 
 >  > Manfred
 > 
 > Nice if it would  have worked ;-)  Richard,  I'm no longer  allowed to
 > write into that directory - which one should I use now?

Manfred

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-23  9:14     ` Jeffrey A Law
@ 1998-02-23  9:19       ` H.J. Lu
  1998-02-24 11:46         ` Manfred Hollstein
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1998-02-23  9:19 UTC (permalink / raw)
  To: law; +Cc: egcs

> 
> 
>   In message < m0y71QD-00058gC@ocean.lucon.org >you write:
>   > The patch is in egcs and is tested. I don't think it should hurt
>   > anything.
> That's not the question.  Lots of patches which can't hurt something
> are not necessary and thus do not belong in the release.
> 
> Is the patch necessary?  If so, please explain why.
> 

It is helpful to people who maintains libstdc++ 2.8.x which I believe
is based on egcs 1.0.2.

-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-22 14:25 ` Jeffrey A Law
@ 1998-02-23  9:19   ` H.J. Lu
  1998-02-23  9:14     ` Jeffrey A Law
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1998-02-23  9:19 UTC (permalink / raw)
  To: law; +Cc: egcs

> 
>   In message < m0y5Fva-00058KC@ocean.lucon.org >you write:
>   > Hi,
>   > 
>   > This patch from egcs for egcs 1.0.2 will enable libio to support
>   > "make check" when libstdc++ is configured for gcc 2.8.1.
> Is this really necessary for the release?
> 
> ie, if this just fixes make check to work with gcc-2.8.1 or an
> externally built gcc then I *really* doubt it's needed for
> egcs-1.0.2.

The patch is in egcs and is tested. I don't think it should hurt
anything.

-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-23  9:19   ` H.J. Lu
@ 1998-02-23  9:14     ` Jeffrey A Law
  1998-02-23  9:19       ` H.J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-23  9:14 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

  In message < m0y71QD-00058gC@ocean.lucon.org >you write:
  > The patch is in egcs and is tested. I don't think it should hurt
  > anything.
That's not the question.  Lots of patches which can't hurt something
are not necessary and thus do not belong in the release.

Is the patch necessary?  If so, please explain why.

jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A libio patch for egcs 1.0.2
  1998-02-18 17:15 H.J. Lu
@ 1998-02-22 14:25 ` Jeffrey A Law
  1998-02-23  9:19   ` H.J. Lu
  1998-02-24 20:44 ` Jeffrey A Law
  1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 1998-02-22 14:25 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

  In message < m0y5Fva-00058KC@ocean.lucon.org >you write:
  > Hi,
  > 
  > This patch from egcs for egcs 1.0.2 will enable libio to support
  > "make check" when libstdc++ is configured for gcc 2.8.1.
Is this really necessary for the release?

ie, if this just fixes make check to work with gcc-2.8.1 or an
externally built gcc then I *really* doubt it's needed for
egcs-1.0.2.



jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* A libio patch for egcs 1.0.2
@ 1998-02-18 17:15 H.J. Lu
  1998-02-22 14:25 ` Jeffrey A Law
  1998-02-24 20:44 ` Jeffrey A Law
  0 siblings, 2 replies; 9+ messages in thread
From: H.J. Lu @ 1998-02-18 17:15 UTC (permalink / raw)
  To: egcs

Hi,

This patch from egcs for egcs 1.0.2 will enable libio to support
"make check" when libstdc++ is configured for gcc 2.8.1.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
--
Tue Jan 27 10:35:22 1998  H.J. Lu  (hjl@gnu.org)

	* configure.in (topsrcdir): New.
	(CHECK_SUBDIRS, configdirs): Check ${topsrcdir}/gcc instead.
	(config-ml.in): Use ${topsrcdir}/config-ml.in.

	* tests/configure.in (topsrcdir): New.
	(CHECK): Check ${topsrcdir}/gcc instead.

Tue Jan 13 21:30:33 1998  H.J. Lu  (hjl@gnu.org)

	* configure.in (CHECK_SUBDIRS): Set to testsuite only if
	${srcdir}/../gcc exists.
	(configdirs): Include testsuite only if ${srcdir}/../gcc exists.

	* tests/Makefile.in (check): Depend on $(CHECK).

	* tests/configure.in (CHECK): Set to "check-iostream
	check-stdio" if ${srcdir}/../../gcc doesn't exists.

--- /home/work/misc/gnu/import/egcs/libio/configure.in	Fri Dec 19 00:32:03 1997
+++ configure.in	Sun Feb 15 08:03:15 1998
@@ -2,7 +2,21 @@
 # necessary for a configure script to process the program in
 # this directory.  For more information, look at ../configure.
 
-configdirs="tests dbz stdio testsuite"
+if [ "${srcdir}" = "." ] ; then
+  if [ "${with_target_subdir}" != "." ] ; then
+    topsrcdir=${with_multisrctop}../..
+  else
+    topsrcdir=${with_multisrctop}..
+  fi
+else
+  topsrcdir=${srcdir}/..
+fi
+
+if [ -d ${topsrcdir}/gcc ] ; then
+  configdirs="tests dbz stdio testsuite"
+else
+  configdirs="tests dbz stdio"
+fi
 srctrigger=libioP.h
 srcname="input/output library"
 package_makefile_frag=Make.pack
@@ -116,12 +130,4 @@
     mv -f Makefile.tem Makefile
 fi
 
-if [ "${srcdir}" = "." ] ; then
-  if [ "${with_target_subdir}" != "." ] ; then
-    . ${with_multisrctop}../../config-ml.in
-  else
-    . ${with_multisrctop}../config-ml.in
-  fi
-else
-  . ${srcdir}/../config-ml.in
-fi
+. ${topsrcdir}/config-ml.in
--- /home/work/misc/gnu/import/egcs/libio/tests/configure.in	Thu Aug 21 15:58:27 1997
+++ tests/configure.in	Sun Feb 15 08:03:52 1998
@@ -18,4 +18,18 @@
 MOSTLYCLEAN='*.o core $(JUNK_TO_CLEAN)'
 (. ${srcdir}/../config.shared) >${package_makefile_frag}
 
+if [ "${srcdir}" = "." ] ; then
+  if [ "${with_target_subdir}" != "." ] ; then
+    topsrcdir=${with_multisrctop}../../..
+  else
+    topsrcdir=${with_multisrctop}../..
+  fi
+else
+  topsrcdir=${srcdir}/../..
+fi
+
+if [ ! -d ${topsrcdir}/gcc ] ; then
+  echo "CHECK = check-iostream check-iostdio" >>${package_makefile_frag}
+fi
+
 # post-target:
--- /home/work/misc/gnu/import/egcs/libio/tests/Makefile.in	Thu Aug 21 15:58:27 1997
+++ tests/Makefile.in	Sun Feb 15 08:00:45 1998
@@ -1,4 +1,4 @@
-# Copyright (C) 1993 Free Software Foundation
+# Copyright (C) 1993, 1998 Free Software Foundation
 # 
 # This file is part of the GNU IO Library.  This library is free
 # software; you can redistribute it and/or modify it under the
@@ -41,9 +41,7 @@
 DEPEND_SOURCES = $(srcdir)/*.C
 
 .PHONY: check check-old check-iostream check-stdio
-check:
-
-check-old: check-iostream check-iostdio
+check: $(CHECK)
 
 
 # These are tests written in C++, that test the iostream facility.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-02-24 20:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-16 19:55 A libio patch for egcs 1.0.2 H.J. Lu
1998-02-18  1:53 ` Jeffrey A Law
1998-02-18 17:15 H.J. Lu
1998-02-22 14:25 ` Jeffrey A Law
1998-02-23  9:19   ` H.J. Lu
1998-02-23  9:14     ` Jeffrey A Law
1998-02-23  9:19       ` H.J. Lu
1998-02-24 11:46         ` Manfred Hollstein
1998-02-24 20:44 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).