This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Re: libio compilation problem


> The following errors occur compiling libio/genops.c under vax-ultrix:
> 
> /usr/local/src/gnu/gcc-2.96/objdir/gcc/xgcc -B/usr/local/src/gnu/gcc-2.96/objdir
> /gcc/ -B/usr/local/vax-dec-ultrix4.3/bin/ -c -O3 -I. -I../../../libio  ../../../
> libio/genops.c
> ../../../libio/genops.c:472: conflicting types for `_IO_default_seekpos'
> ../../../libio/libioP.h:349: previous declaration of `_IO_default_seekpos'
> ../../../libio/genops.c:556: conflicting types for `_IO_default_seekoff'
> ../../../libio/libioP.h:348: previous declaration of `_IO_default_seekoff'
> ../../../libio/genops.c:887: conflicting types for `_IO_default_seek'
> ../../../libio/libioP.h:358: previous declaration of `_IO_default_seek'

The enclosed patch changes the implementation to match the interface
specification defined in libioP.h.  It compiles under vax-dec-ultrix4.3
and I have done a complete make check under i686 linux.

In the 64 bit version of _IO_file_fopen, there is an extra parameter `tbd'
which is not used in the implementation.  I don't have any documentation
as to what it's for.  Possibly, somebody should check that libio works
ok with 64 bits and figure out if tbd is needed or just a mistake.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-09-29  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* fileops.c (_IO_file_fopen): Change implementation to match
	prototype in libioP.h.
	(_IO_file_seekoff): Likewise.
	(_IO_file_seek): Likewise.
	genops.c (_IO_default_seekpos): Likewise.
	(_IO_default_seekoff): Likewise.
	(_IO_default_seek): Likewise.
	ioseekoff.c (_IO_seekoff): Likewise.
	ioseekpos.c (_IO_seekpos): Likewise.
	strops.c (_IO_str_seekoff): Likewise.
	libioP.h: Always check that _G_IO_IO_FILE_VERSION is defined before
	testing version.

--- fileops.c.orig	Mon Apr 12 14:27:49 1999
+++ fileops.c	Fri Sep 29 11:07:29 2000
@@ -155,11 +155,20 @@
   _IO_default_finish (fp, 0);
 }
 
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_FILE *
+_IO_file_fopen (fp, filename, mode, tbd)
+     _IO_FILE *fp;
+     const char *filename;
+     const char *mode;
+     int tbd;
+#else
 _IO_FILE *
 _IO_file_fopen (fp, filename, mode)
      _IO_FILE *fp;
      const char *filename;
      const char *mode;
+#endif
 {
   int oflags = 0, omode;
   int read_write, fdesc;
@@ -419,14 +428,27 @@
   return retval;
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
+_IO_file_seekoff (fp, offset, dir, mode)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+     int mode;
+#else
+_IO_off_t
 _IO_file_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
+#endif
 {
-  _IO_pos_t result;
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+  _IO_off64_t result;
+#else
+  _IO_off_t result;
+#endif
   _IO_off_t delta, new_offset;
   long count;
   /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
@@ -587,11 +609,19 @@
   return read (fp->_fileno, buf, size);
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
+_IO_file_seek (fp, offset, dir)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+#else
+_IO_off_t
 _IO_file_seek (fp, offset, dir)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
+#endif
 {
   return lseek (fp->_fileno, offset, dir);
 }
--- genops.c.orig	Thu Mar  4 19:19:08 1999
+++ genops.c	Thu Sep 28 22:24:25 2000
@@ -467,13 +467,21 @@
     return fp;
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
 _IO_default_seekpos (fp, pos, mode)
      _IO_FILE *fp;
-     _IO_pos_t pos;
+     _IO_off64_t pos;
      int mode;
+#else
+_IO_off_t
+_IO_default_seekpos (fp, pos, mode)
+     _IO_FILE *fp;
+     _IO_off_t pos;
+     int mode;
+#endif
 {
-  return _IO_SEEKOFF (fp, _IO_pos_as_off (pos), 0, mode);
+  return _IO_SEEKOFF (fp, pos, 0, mode);
 }
 
 int
@@ -551,12 +559,21 @@
   _IO_un_link (fp);
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
+_IO_default_seekoff (fp, offset, dir, mode)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+     int mode;
+#else
+_IO_off_t
 _IO_default_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
+#endif
 {
     return _IO_pos_BAD;
 }
@@ -882,11 +899,19 @@
   return (unsigned char) *fp->_IO_read_ptr;
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
+_IO_default_seek (fp, offset, dir)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+#else
+_IO_off_t
 _IO_default_seek (fp, offset, dir)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
+#endif
 {
   return _IO_pos_BAD;
 }
--- ioseekoff.c.orig	Tue Sep 16 12:00:21 1997
+++ ioseekoff.c	Thu Sep 28 22:30:27 2000
@@ -25,14 +25,27 @@
 
 #include <libioP.h>
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
+_IO_seekoff (fp, offset, dir, mode)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+     int mode;
+#else
+_IO_off_t
 _IO_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
+#endif
 {
-  _IO_pos_t retval;
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+  _IO_off64_t retval;
+#else
+  _IO_off_t retval;
+#endif
 
   /* If we have a backup buffer, get rid of it, since the __seekoff
      callback may not know to do the right thing about it.
--- ioseekpos.c.orig	Tue Sep 16 12:00:23 1997
+++ ioseekpos.c	Thu Sep 28 22:33:42 2000
@@ -25,13 +25,25 @@
 
 #include <libioP.h>
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
 _IO_seekpos (fp, pos, mode)
      _IO_FILE *fp;
-     _IO_pos_t pos;
+     _IO_off64_t pos;
      int mode;
+#else
+_IO_off_t
+_IO_seekpos (fp, pos, mode)
+     _IO_FILE *fp;
+     _IO_off_t pos;
+     int mode;
+#endif
 {
-  _IO_pos_t retval;
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+  _IO_off64_t retval;
+#else
+  _IO_off_t retval;
+#endif
 
   /* If we have a backup buffer, get rid of it, since the __seekoff
      callback may not know to do the right thing about it.
--- strops.c.orig	Fri May 22 16:40:02 1998
+++ strops.c	Thu Sep 28 22:56:35 2000
@@ -205,15 +205,28 @@
 	  - fp->_IO_read_base);
 }
 
-_IO_pos_t
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+_IO_off64_t
 _IO_str_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off_t offset;
      int dir;
      int mode;
+#else
+_IO_off_t
+_IO_str_seekoff (fp, offset, dir, mode)
+     _IO_FILE *fp;
+     _IO_off_t offset;
+     int dir;
+     int mode;
+#endif
 {
   _IO_ssize_t cur_size = _IO_str_count (fp);
-  _IO_pos_t new_pos = EOF;
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+  _IO_off64_t new_pos = EOF;
+#else
+  _IO_off_t new_pos = EOF;
+#endif
 
   /* Move the get pointer, if requested. */
   if (mode & _IOS_INPUT)
--- libioP.h.orig	Fri Jun 30 11:25:33 2000
+++ libioP.h	Fri Sep 29 10:55:40 2000
@@ -233,7 +233,7 @@
 typedef int (*_IO_stat_t) __PMT ((_IO_FILE *, void *));
 #define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
 
-#if _G_IO_IO_FILE_VERSION == 0x20001
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
 /* The 'showmany' hook can be used to get an image how much input is
    available.  In many cases the answer will be 0 which means unknown
    but some cases one can provide real information.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]