libio bugs
Andreas Schwab
schwab@issan.informatik.uni-dortmund.de
Wed Jan 21 09:54:00 GMT 1998
This patch fixes some bugs in libio.
Btw, why does _IO_wchar_t in streambuf.h default to short and not
_G_wchar_t? And why does ios::fill(_IO_wchar_t) cast its argument to
char? Unfortunately, changing that now breaks binary compatibility on
Linux.
1998-01-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* iostream.cc (istream::operator>>(long double&))
[!_G_HAVE_LONG_DOUBLE_IO]: Scan value into separate variable, in
case long double is bigger than double.
(ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix order of
initializers of struct printf_info to match declaration order,
to work around g++ bug.
(ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]: Likewise.
* gen-params: Add missing quotes. Avoid useless use of command
substitution.
*** egcs-980115/libio/gen-params.~1~ Thu Nov 27 00:54:21 1997
--- egcs-980115/libio/gen-params Tue Dec 23 20:48:12 1997
*************** fi
*** 277,283 ****
tr ' ' ' ' <TMP >dummy.out
for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do
! IMPORTED=`eval 'echo $'"$TYPE"`
if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED'"
else
--- 277,283 ----
tr ' ' ' ' <TMP >dummy.out
for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do
! eval IMPORTED=\$$TYPE
if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED'"
else
*************** done
*** 318,326 ****
# Look for some standard macros.
for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do
! IMPORTED=`eval 'echo $'"$NAME"`
if [ -n "${IMPORTED}" ] ; then
! eval "$NAME='$IMPORTED /* specified */"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \
--- 318,326 ----
# Look for some standard macros.
for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do
! eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then
! eval "$NAME='$IMPORTED /* specified */'"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \
*************** done
*** 334,342 ****
# These macros must be numerical constants; strip any trailing 'L's.
for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do
! IMPORTED=`eval 'echo $'"$NAME"`
if [ -n "${IMPORTED}" ] ; then
! eval "$NAME='$IMPORTED /* specified */"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
--- 334,342 ----
# These macros must be numerical constants; strip any trailing 'L's.
for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do
! eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then
! eval "$NAME='$IMPORTED /* specified */'"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
*** egcs-980115/libio/iostream.cc.~1~ Fri Oct 3 19:14:02 1997
--- egcs-980115/libio/iostream.cc Fri Jan 16 20:32:18 1998
*************** READ_INT(bool)
*** 333,343 ****
istream& istream::operator>>(long double& x)
{
if (ipfx0())
#if _G_HAVE_LONG_DOUBLE_IO
scan("%Lg", &x);
#else
! scan("%lg", &x);
#endif
return *this;
}
--- 333,347 ----
istream& istream::operator>>(long double& x)
{
if (ipfx0())
+ {
#if _G_HAVE_LONG_DOUBLE_IO
scan("%Lg", &x);
#else
! double y;
! scan("%lg", &y);
! x = y;
#endif
+ }
return *this;
}
*************** ostream& ostream::operator<<(double n)
*** 628,637 ****
left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0,
group: 0,
- pad: fill()
#if defined __GLIBC__ && __GLIBC__ >= 2
! , extra: 0
#endif
};
const void *ptr = (const void *) &n;
if (__printf_fp (rdbuf(), &info, &ptr) < 0)
--- 632,641 ----
left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0,
group: 0,
#if defined __GLIBC__ && __GLIBC__ >= 2
! extra: 0,
#endif
+ pad: fill()
};
const void *ptr = (const void *) &n;
if (__printf_fp (rdbuf(), &info, &ptr) < 0)
*************** ostream& ostream::operator<<(long double
*** 731,740 ****
left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0,
group: 0,
- pad: fill()
#if defined __GLIBC__ && __GLIBC__ >= 2
! , extra: 0
#endif
};
const void *ptr = (const void *) &n;
--- 735,744 ----
left: (flags() & ios::left) != 0,
showsign: (flags() & ios::showpos) != 0,
group: 0,
#if defined __GLIBC__ && __GLIBC__ >= 2
! extra: 0,
#endif
+ pad: fill()
};
const void *ptr = (const void *) &n;
More information about the Gcc
mailing list