diff options
author | Ulrich Drepper <drepper@rtl.cygnus.com> | 1997-09-27 04:07:00 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1997-09-26 22:07:00 -0600 |
commit | d604f4c6a30f44bb0f75b7acbc29c01bbdd6253e (patch) | |
tree | c804a39f2f0e78941efa5280aa004f05f08478c1 | |
parent | a7cc7f29f45db5f76aac040f4e3ef62109fd1341 (diff) | |
download | gcc-d604f4c6a30f44bb0f75b7acbc29c01bbdd6253e.zip gcc-d604f4c6a30f44bb0f75b7acbc29c01bbdd6253e.tar.gz gcc-d604f4c6a30f44bb0f75b7acbc29c01bbdd6253e.tar.bz2 |
libio changes from Ulrich to help "old linux" systems.
libio changes from Ulrich to help "old linux" systems. See ChangeLog
for details.
From-SVN: r15741
-rw-r--r-- | libio/ChangeLog | 40 | ||||
-rw-r--r-- | libio/Makefile.in | 7 | ||||
-rw-r--r-- | libio/config.shared | 3 | ||||
-rw-r--r-- | libio/config/linux.mt | 4 | ||||
-rw-r--r-- | libio/config/linuxlibc1.mt | 34 | ||||
-rw-r--r-- | libio/configure.in | 8 | ||||
-rw-r--r-- | libio/dbz/Makefile.in | 3 | ||||
-rwxr-xr-x | libio/gen-params | 2 | ||||
-rw-r--r-- | libio/iostream.cc | 32 | ||||
-rw-r--r-- | libio/libio.h | 31 | ||||
-rw-r--r-- | libio/streambuf.h | 2 | ||||
-rw-r--r-- | libio/tests/tFile.cc | 2 |
12 files changed, 115 insertions, 53 deletions
diff --git a/libio/ChangeLog b/libio/ChangeLog index 66ed898..d3a5eff 100644 --- a/libio/ChangeLog +++ b/libio/ChangeLog @@ -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. diff --git a/libio/Makefile.in b/libio/Makefile.in index 6a3e74d..e460569 100644 --- a/libio/Makefile.in +++ b/libio/Makefile.in @@ -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. ## diff --git a/libio/config.shared b/libio/config.shared index 009381a..0be4361 100644 --- a/libio/config.shared +++ b/libio/config.shared @@ -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*}" diff --git a/libio/config/linux.mt b/libio/config/linux.mt index 4bb92b7..ad1dc51 100644 --- a/libio/config/linux.mt +++ b/libio/config/linux.mt @@ -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 diff --git a/libio/config/linuxlibc1.mt b/libio/config/linuxlibc1.mt index ffda172..1f22b4a 100644 --- a/libio/config/linuxlibc1.mt +++ b/libio/config/linuxlibc1.mt @@ -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 diff --git a/libio/configure.in b/libio/configure.in index 06c6fda..ac94747 100644 --- a/libio/configure.in +++ b/libio/configure.in @@ -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 diff --git a/libio/dbz/Makefile.in b/libio/dbz/Makefile.in index 3f7833b..6d6dc28 100644 --- a/libio/dbz/Makefile.in +++ b/libio/dbz/Makefile.in @@ -37,7 +37,8 @@ install: install-info: info: -check: r rclean +check: r + $(MAKE) rclean bininstall: dbz cp dbz $(NEWSBIN) diff --git a/libio/gen-params b/libio/gen-params index 9fb7272..ef417e7 100755 --- a/libio/gen-params +++ b/libio/gen-params @@ -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;} diff --git a/libio/iostream.cc b/libio/iostream.cc index 9c815aa..383d465 100644 --- a/libio/iostream.cc +++ b/libio/iostream.cc @@ -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); diff --git a/libio/libio.h b/libio/libio.h index 2eec1c2..d5e20f5 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -75,12 +75,6 @@ # 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)); diff --git a/libio/streambuf.h b/libio/streambuf.h index a492f63..dfee098 100644 --- a/libio/streambuf.h +++ b/libio/streambuf.h @@ -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 diff --git a/libio/tests/tFile.cc b/libio/tests/tFile.cc index df82104..f5b8a6f 100644 --- a/libio/tests/tFile.cc +++ b/libio/tests/tFile.cc @@ -225,7 +225,7 @@ void t4() tf.remove(); #else tf.close(); - unlink("tempfile"); + unlink(tempfile); #endif assert(!tf.is_open()); } |