]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libio changes from Ulrich to help "old linux" systems.
authorUlrich Drepper <drepper@rtl.cygnus.com>
Sat, 27 Sep 1997 04:07:00 +0000 (04:07 +0000)
committerJeff Law <law@gcc.gnu.org>
Sat, 27 Sep 1997 04:07:00 +0000 (22:07 -0600)
libio changes from Ulrich to help "old linux" systems.  See ChangeLog
for details.

From-SVN: r15741

12 files changed:
libio/ChangeLog
libio/Makefile.in
libio/config.shared
libio/config/linux.mt
libio/config/linuxlibc1.mt
libio/configure.in
libio/dbz/Makefile.in
libio/gen-params
libio/iostream.cc
libio/libio.h
libio/streambuf.h
libio/tests/tFile.cc

index 66ed898385c68251393e7eb70cea63f889a24f58..d3a5eff74e0eef31483db125091eff23d9c5d9c5 100644 (file)
@@ -1,3 +1,43 @@
+Fri Sep 26 20:56:41 1997  Ulrich Drepper  <drepper@rtl.cygnus.com>
+
+       Based on a patch by H.J. Lu  (hjl@gnu.ai.mit.edu).
+
+       * Makefile.in (STDIO_OBJECTS): New. Defined as stdfiles.o.
+       (LIBIO_OBJECTS): Add $(STDIO_OBJECTS).
+       (PICFLAG): New, empty.  moved to here from config.shared.
+
+       * config.shared (DISTCLEAN): Add target-mkfrag.
+       (PICFLAG): Removed.
+
+       * configure.in (*-linux-gnulibc1): Remove warning.
+       (*-linux-gnu): Use linux.mt mtsafe.mt.
+       (alpha-*-linux*): Use mh-elfalphapic.
+
+       * gen-params (_G_ullong): Also check unsigned long long int.
+       (_G_llong): Also check long long int.
+
+       * libio.h (_IO_lock_t): Add support for the Linux libc 5.
+       (_IO_peekc): Defined as _IO_peekc_unlocked if _IO_MTSAFE_IO
+       is not defined.
+
+       * iostream.cc (__cvt_double): Fix a typo in declaration.
+       (info): Use expr != 0 to initialize the bit fields. Don't
+       initialize "extra" for the Linux libc 5.
+
+       * streambuf.h (_G_NEED_STDARG_H): Changed from _IO_NEED_STDARG_H.
+
+       * config/linux.mt (STDIO_OBJECTS): New, empty.
+       (MT_CFLAGS): Removed.
+
+       * config/linuxlibc1.mt: Rewrite.  it's identical to linux.mt but
+       IO_OBJECTS mentions files not in early libc5 versions.
+
+       * config/mtsafe.mt: New.
+
+       * dbz/Makefile.in (check): Support make -j.
+
+       * tests/tFile.cc (tempfile): Fix a typo.
+
 Fri Sep 19 11:52:25 1997  Jim Wilson  <wilson@cygnus.com>
 
        * Makefile.in (LIBIO_OBJECTS): Depend on _G_CONFIG_H.
index 6a3e74d29164a20187c69a6a7ce9bacf62259db7..e460569886907616a229b0358da1dde303fe14dd 100644 (file)
@@ -32,6 +32,8 @@ IO_OBJECTS = filedoalloc.o floatconv.o genops.o fileops.o \
   outfloat.o strops.o iofclose.o iopopen.o ioungetc.o peekc.o iogetc.o \
   ioputc.o iofeof.o ioferror.o
 
+STDIO_OBJECTS = stdfiles.o
+
 # These emulate stdio functionality, but with a different name (_IO_ungetc
 # instead of ungetc), and using _IO_FILE instead of FILE.
 # They are not needed for C++ iostream, nor stdio, though some stdio
@@ -56,13 +58,16 @@ IOSTREAM_OBJECTS = builtinbuf.o filebuf.o fstream.o \
 OSPRIM_OBJECTS = ioprims.o iostrerror.o cleanup.o
 
 LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(OSPRIM_OBJECTS)
-LIBIO_OBJECTS = $(IO_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS) stdfiles.o
+LIBIO_OBJECTS = $(IO_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS) \
+               $(STDIO_OBJECTS)
 
 LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS)
 LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS)
 
 USER_INCLUDES = *.h
 
+PICFLAG =
+
 #### package, host, target, and site dependent Makefile fragments come in here.
 ##
 
index 009381a4c081877e89b49533c91c72bd07e410eb..0be43612fa661d29e5faba7a9616352c54b5dfe9 100644 (file)
@@ -140,7 +140,6 @@ echo 'CFLAGS = -g'
 echo 'CXXFLAGS = -g -O'
 echo 'LIBCFLAGS = $(CFLAGS)'
 echo 'LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates'
-echo 'PICFLAG ='
 if [ "${LIBDIR}" = "yes" ]; then
   echo 'PICDIR = stamp-picdir'
 else
@@ -395,7 +394,7 @@ echo '# clean rules'
 
 MOSTLYCLEAN="${MOSTLYCLEAN-*.o pic stamp-picdir core ${EXTRA_MOSTLYCLEAN}} `if test -n "${TOUCH_ON_COMPILE}"; then echo stamp; else true; fi`"
 CLEAN="${CLEAN-${TARGETPROG} ${TARGETLIB}}"
-DISTCLEAN="${DISTCLEAN-config.status Makefile *~ Make.pack multilib.out ${EXTRA_DISTCLEAN-}}"
+DISTCLEAN="${DISTCLEAN-config.status Makefile *~ Make.pack target-mkfrag multilib.out ${EXTRA_DISTCLEAN-}}"
 REALCLEAN="${REALCLEAN-depend *.info*}"
 
 
index 4bb92b76b2e90c168a5e89c49c500b53573dc37f..ad1dc51f316fd9a0d6a9593f9196a8ec9680825d 100644 (file)
@@ -19,12 +19,10 @@ LIBIO_INCLUDE=
 IO_OBJECTS=
 STDIO_WRAP_OBJECTS=
 OSPRIM_OBJECTS=
+STDIO_OBJECTS=
 
 # We have the rest in /usr/include.
 USER_INCLUDES=PlotFile.h SFile.h builtinbuf.h editbuf.h fstream.h \
        indstream.h iomanip.h iostream.h istream.h ostream.h \
        parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \
        streambuf.h strfile.h strstream.h
-
-# tell we want the mt-safe version
-MT_CFLAGS = -D_IO_MTSAFE_IO
index ffda17208399045c9df853d84d85bd338abf542f..1f22b4a0dc844e502c7ee93a6fb4b02227784865 100644 (file)
@@ -1,26 +1,28 @@
-# Since the Linux C library has libio, we have to be very careful.
+# Use the libio which comes with the local libc.
 
-# By default, we build libio and use it.  If someone wants to not
-# build it, let them go to extra work.  The reason is that the user
-# may want a newer, bug fixed libio, also on a linux 1.0.8 system
-# things just won't build with the bottom section uncommented.
+# That is where we keep the g++ header files.
+gxx_includedir =$(prefix)/include/g++
 
 # Comment this out to avoid including the stdio functions in libiostream.a:
-LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS)
-LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS) stmp-stdio
-LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS) `cat stdio.list`
+LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS)
+# LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS) stdio.list
+LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS) `cat stdio.list`
 
 # Comment the above and uncomment the below to use the code in the Linux libc:
 # We have _G_config.h in /usr/include.
-# _G_CONFIG_H=
+_G_CONFIG_H=
+
+# We must not see the libio.h file from this library.
+LIBIO_INCLUDE=
 
 # We have those in libc.a.
-# IO_OBJECTS=
-# STDIO_WRAP_OBJECTS=
-# OSPRIM_OBJECTS=
+IO_OBJECTS=iogetc.o ioputc.o iofeof.o ioferror.o
+STDIO_WRAP_OBJECTS=
+OSPRIM_OBJECTS=
+STDIO_OBJECTS=
 
 # We have the rest in /usr/include.
-USER_INCLUDES=PlotFile.h SFile.h builtinbuf.h editbuf.h fstream.h \
-#      indstream.h iomanip.h iostream.h istream.h ostream.h \
-#      parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \
-#      streambuf.h strfile.h strstream.h
+USER_INCLUDES=PlotFile.h SFile.h builtinbuf.h editbuf.h fstream.h \
+       indstream.h iomanip.h iostream.h istream.h ostream.h \
+       parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \
+       streambuf.h strfile.h strstream.h
index 06c6fdabea5adb8e071047b93dfebd15d0587044..ac94747f563dfc49dcc5a60498c0468a2b6bfae5 100644 (file)
@@ -17,12 +17,8 @@ frags=
 case "${target}" in
   *-hpux*)       frags=hpux.mt ;;
   *-linux-gnulibc1)
-       echo "WARNING:  The I/O implementation in FSF libg++ 2.8.x is not"
-       echo "  compatible with Linux libc through 5.2.x."
-       echo "  See libg++/README for more information."
-       echo "  YOU ARE ON YOUR OWN!"
                 frags=linuxlibc1.mt ;;
-  *-linux-gnu)   frags=linux.mt ;;
+  *-linux-gnu)   frags="linux.mt mtsafe.mt" ;;
   *-sco3.2v[45]*)   frags=sco4.mt ;;
   *-isc*)        frags=isc.mt ;;
   *-netware*)    frags=netware.mt ;;
@@ -40,6 +36,8 @@ if [ "${shared}" = "yes" ]; then
   case "${target}" in
     hppa*-*)    frags="${frags} ../../config/mh-papic" ;;
     i[3456]86-*) frags="${frags} ../../config/mh-x86pic" ;;
+    alpha-*-linux*)
+                frags="${frags} ../../config/mh-elfalphapic" ;;
     *)          frags="${frags} ../../config/mh-${target_cpu}pic" ;;
   esac
 fi
index 3f7833be8407305646d7b9c9c2618a3276d09270..6d6dc2874855fcb361ed4617beb80a7aa2f531bc 100644 (file)
@@ -37,7 +37,8 @@ install:
 install-info:
 info:
 
-check: r rclean
+check: r
+       $(MAKE) rclean
 
 bininstall:    dbz
        cp dbz $(NEWSBIN)
index 9fb7272dd83029d8f4fb2ca8740670946c1d7dfb..ef417e73544faf16a511eb2bee5e96d4976bb503 100755 (executable)
@@ -288,6 +288,8 @@ for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_
        for iteration in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
            # Search dummy.out for a typedef for X*$t.
            sed_script="
+               s/unsigned long long int/_G_ullong/g
+               s/long long int/_G_llong/g
                s/unsigned long long/_G_ullong/g
                s/long long/_G_llong/g
                /.*typedef  *\\(.*[^ ]\\)  *X*$t *;.*/{s||\1|;p;q;}
index 9c815aa85e2b21b6c3db61aaa8a0a7314d5a15f4..383d46560910bda3e0afd018ac87f630eb5031db 100644 (file)
@@ -44,7 +44,7 @@ extern "C" int __printf_fp (_IO_FILE *, const struct printf_info *,
 #include "floatio.h"
 # ifndef _IO_USE_DTOA
 int __cvt_double(double number, register int prec, int flags, int *signp,
-                 int fmtch, char *startp, char *endp)
+                 int fmtch, char *startp, char *endp);
 # endif
 #endif
 
@@ -623,14 +623,17 @@ ostream& ostream::operator<<(double n)
                                      is_long_double: 0,
                                      is_short: 0,
                                      is_long: 0,
-                                     alt: flags() & ios::showpoint,
+                                     alt: (flags() & ios::showpoint) != 0,
                                      space: 0,
-                                     left: ios::left,
-                                     showsign: flags() & ios::showpos,
+                                     left: (flags() & ios::left) != 0,
+                                     showsign: (flags() & ios::showpos) != 0,
                                      group: 0,
-                                     pad: fill(),
-                                     extra: 0};
-         const void *ptr = &n;
+                                     pad: fill()
+#if defined __GLIBC__ && __GLIBC__ >= 2
+                                     , extra: 0
+#endif
+         };
+         const void *ptr = (const void *) &n;
          if (__printf_fp (rdbuf(), &info, &ptr) < 0)
            set(ios::badbit|ios::failbit);
        }
@@ -723,15 +726,18 @@ ostream& ostream::operator<<(long double n)
                                  is_long_double: 1,
                                  is_short: 0,
                                  is_long: 0,
-                                 alt: flags() & ios::showpoint,
+                                 alt: (flags() & ios::showpoint) != 0,
                                  space: 0,
-                                 left: ios::left,
-                                 showsign: flags() & ios::showpos,
+                                 left: (flags() & ios::left) != 0,
+                                 showsign: (flags() & ios::showpos) != 0,
                                  group: 0,
-                                 pad: fill(),
-                                 extra: 0};
+                                 pad: fill()
+#if defined __GLIBC__ && __GLIBC__ >= 2
+                                 , extra: 0
+#endif
+      };
 
-      const void *ptr = &n;
+      const void *ptr = (const void *) &n;
 
       if (__printf_fp (rdbuf(), &info, &ptr) < 0)
        set (ios::badbit|ios::failbit);
index 2eec1c27a52af1ffe266f160c2b259a504fe8028..d5e20f53bbe4e1d61a23f12347bd51c40da2d981 100644 (file)
 # define _IO_USE_DTOA 1
 #endif
 
-#if 0
-# ifdef _IO_NEED_STDARG_H
-#  include <stdarg.h>
-# endif
-#endif
-
 #ifndef EOF
 # define EOF (-1)
 #endif
@@ -155,9 +149,24 @@ struct _IO_jump_t;  struct _IO_FILE;
 
 /* Handle lock.  */
 #ifdef _IO_MTSAFE_IO
-# include <bits/stdio-lock.h>
+# if defined __GLIBC__ && __GLIBC__ >= 2
+#  include <bits/stdio-lock.h>
+#  define _IO_LOCK_T _IO_lock_t *
+# else
+/*# include <comthread.h>*/
+# endif
 #else
+/* XXX This will go away as soon as comthread is finished.  */
+# ifdef __linux__
+struct _IO_lock_t {
+  void *ptr;
+  short int field1;
+  short int field2;
+};
+#  define _IO_LOCK_T struct _IO_lock_t
+# else
 typedef void _IO_lock_t;
+# endif
 #endif
 
 
@@ -217,7 +226,7 @@ struct _IO_FILE {
 
   /*  char* _save_gptr;  char* _save_egptr; */
 
-  _IO_lock_t *_lock;
+  _IO_LOCK_T _lock;
 };
 
 #ifndef __cplusplus
@@ -289,7 +298,10 @@ extern void _IO_flockfile __P ((_IO_FILE *));
 extern void _IO_funlockfile __P ((_IO_FILE *));
 extern int _IO_ftrylockfile __P ((_IO_FILE *));
 
-#ifndef _IO_MTSAFE_IO
+#ifdef _IO_MTSAFE_IO
+# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
+#else
+# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
 # define _IO_flockfile(_fp) /**/
 # define _IO_funlockfile(_fp) /**/
 # define _IO_ftrylockfile(_fp) /**/
@@ -297,7 +309,6 @@ extern int _IO_ftrylockfile __P ((_IO_FILE *));
 # define _IO_cleanup_region_end(_Doit) /**/
 #endif /* !_IO_MTSAFE_IO */
 
-#define _IO_peekc(_fp) _IO_peekc_locked (_fp)
 
 extern int _IO_vfscanf __P ((_IO_FILE *, const char *, _IO_va_list, int *));
 extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list));
index a492f636d874ec5f4913aca942e2f5a54f86b14a..dfee0984a643417b83b911d3dea25fd250174b9d 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #include <libio.h>
 }
 //#include <_G_config.h>
-#ifdef _IO_NEED_STDARG_H
+#ifdef _G_NEED_STDARG_H
 #include <stdarg.h>
 #endif
 #ifndef _IO_va_list
index df82104fafe9f61cb6bddff5c695afdff6718164..f5b8a6f7760cf216b00be94c30c4874371cbd6a4 100644 (file)
@@ -225,7 +225,7 @@ void t4()
   tf.remove();
 #else
   tf.close();
-  unlink("tempfile");
+  unlink(tempfile);
 #endif
   assert(!tf.is_open());
 }