Commit 99b51359 by Benjamin Kosnik

[multiple changes]


2000-07-23  Brent Verner <brent@rcfile.org>

        * bits/istream.tcc: istream::getline(char_type*, streamsize,
	char_type) make compliant
        * testsuite/27_io/istream_unformatted.cc: test for compliant behavior

2000-07-23  Benjamin Kosnik  <bkoz@haight.constant.com>

	* acinclude.m4 (enable_cshadow_headers): Fix problems with blddir
	and srcdir used to define CSHADOW_INCLUDES..

	* configure.in: For consistency, change .sanity_warned to
	stamp-sanity-warned.

	* acinclude.m4: Tweak formatting.
	* Makefile.am (check): Call mkcheck with full pathname for build
	directory...
	(check-install): And here.
	* Makefile.in: Regenerate.

From-SVN: r35227
parent 55d3f917
2000-07-23 Brent Verner <brent@rcfile.org>
* bits/istream.tcc: istream::getline(char_type*, streamsize,
char_type) make compliant
* testsuite/27_io/istream_unformatted.cc: test for compliant behavior
2000-07-23 Benjamin Kosnik <bkoz@haight.constant.com>
* acinclude.m4 (enable_cshadow_headers): Fix problems with blddir
and srcdir used to define CSHADOW_INCLUDES..
* configure.in: For consistency, change .sanity_warned to
stamp-sanity-warned.
* acinclude.m4: Tweak formatting.
* Makefile.am (check): Call mkcheck with full pathname for build
directory...
(check-install): And here.
* Makefile.in: Regenerate.
2000-07-22 Gabriel Dos Reis <gdr@codesourcery.com> 2000-07-22 Gabriel Dos Reis <gdr@codesourcery.com>
Line up with libstdc++-v2 version of valarray. Line up with libstdc++-v2 version of valarray.
......
...@@ -31,13 +31,16 @@ gxx_include_dir=$(includedir)/g++ ...@@ -31,13 +31,16 @@ gxx_include_dir=$(includedir)/g++
SUBDIRS = math libio src SUBDIRS = math libio src
# Use $(blddir) instead of $(top_builddir) for arguments to "mkcheck"
# because then the paths will be full pathnames, not relative
# pathnames. (-Wl,--rpath seems to like this better.)
check: $(top_builddir)/mkcheck check: $(top_builddir)/mkcheck
chmod +x $(top_builddir)/mkcheck chmod +x $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir) $(top_builddir)/mkcheck 0 `pwd` $(top_srcdir)
check-install: $(top_builddir)/mkcheck check-install: $(top_builddir)/mkcheck
chmod +x $(top_builddir)/mkcheck chmod +x $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix) $(top_builddir)/mkcheck 1 `pwd` $(top_srcdir) $(prefix)
#all-local: stamp-rebuild #all-local: stamp-rebuild
......
...@@ -65,12 +65,10 @@ target_alias = @target_alias@ ...@@ -65,12 +65,10 @@ target_alias = @target_alias@
target_triplet = @target@ target_triplet = @target@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
CC = @CC@ CC = @CC@
CPP = @CPP@ CPP = @CPP@
CPU_FLAGS = @CPU_FLAGS@ CPU_FLAGS = @CPU_FLAGS@
CSHADOWFLAGS = @CSHADOWFLAGS@ CSHADOWFLAGS = @CSHADOWFLAGS@
CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
CXX = @CXX@ CXX = @CXX@
CXXCPP = @CXXCPP@ CXXCPP = @CXXCPP@
DEBUG_FLAGS = @DEBUG_FLAGS@ DEBUG_FLAGS = @DEBUG_FLAGS@
...@@ -465,13 +463,16 @@ distclean-generic clean-generic maintainer-clean-generic clean \ ...@@ -465,13 +463,16 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean mostlyclean distclean maintainer-clean
# Use $(blddir) instead of $(top_builddir) for arguments to "mkcheck"
# because then the paths will be full pathnames, not relative
# pathnames. (-Wl,--rpath seems to like this better.)
check: $(top_builddir)/mkcheck check: $(top_builddir)/mkcheck
chmod +x $(top_builddir)/mkcheck chmod +x $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir) $(top_builddir)/mkcheck 0 `pwd` $(top_srcdir)
check-install: $(top_builddir)/mkcheck check-install: $(top_builddir)/mkcheck
chmod +x $(top_builddir)/mkcheck chmod +x $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix) $(top_builddir)/mkcheck 1 `pwd` $(top_srcdir) $(prefix)
# Multilib Makefile bits. # Multilib Makefile bits.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \ .PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
......
...@@ -1196,12 +1196,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1196,12 +1196,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
esac esac
if test x$glibc_satisfactory = x"yes"; then if test x$glibc_satisfactory = x"yes"; then
BUILD_LIBIO_INCLUDE=
need_libio=no need_libio=no
need_xtra_libio=no need_xtra_libio=no
need_wlibio=no need_wlibio=no
else else
BUILD_LIBIO_INCLUDE='-I../libio'
need_libio=yes need_libio=yes
need_xtra_libio=yes need_xtra_libio=yes
# bkoz XXX need to add checks to enable this # bkoz XXX need to add checks to enable this
...@@ -1210,7 +1208,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1210,7 +1208,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
# Using libio, but <libio.h> doesn't exist on the target system. . . # Using libio, but <libio.h> doesn't exist on the target system. . .
else else
BUILD_LIBIO_INCLUDE='-I../libio'
need_libio=yes need_libio=yes
need_xtra_libio=no need_xtra_libio=no
# bkoz XXX need to add checks to enable this # bkoz XXX need to add checks to enable this
...@@ -1224,8 +1221,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1224,8 +1221,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
AC_MSG_RESULT(wince) AC_MSG_RESULT(wince)
need_libio=no need_libio=no
BUILD_LIBIO_INCLUDE=
AC_SUBST(BUILD_LIBIO_INCLUDE)
;; ;;
*) *)
echo "$enable_cstdio is an unknown io package" 1>&2 echo "$enable_cstdio is an unknown io package" 1>&2
...@@ -1406,19 +1401,17 @@ changequote([, ])dnl ...@@ -1406,19 +1401,17 @@ changequote([, ])dnl
enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
AC_MSG_RESULT($enable_cshadow_headers) AC_MSG_RESULT($enable_cshadow_headers)
dnl Option parsed, now set things appropriately dnl Option parsed, now set things appropriately
dnl CSHADOWFLAGS is currently unused, but may be useful in the future.
case "$enable_cshadow_headers" in case "$enable_cshadow_headers" in
yes) yes)
CSHADOWFLAGS="-D_GNU_SOURCE" CSHADOWFLAGS=""
CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
;; ;;
no) no)
CSHADOWFLAGS="" CSHADOWFLAGS=""
CSHADOW_INCLUDES=""
;; ;;
esac esac
AC_SUBST(CSHADOWFLAGS) AC_SUBST(CSHADOWFLAGS)
AC_SUBST(CSHADOW_INCLUDES)
AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes) AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
]) ])
...@@ -1480,7 +1473,7 @@ AC_SUBST(LIBSTRINGOBJS)dnl ...@@ -1480,7 +1473,7 @@ AC_SUBST(LIBSTRINGOBJS)dnl
dnl This macro searches for a GNU version of make. If a match is found, the dnl This macro searches for a GNU version of make. If a match is found, the
dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
dnl set to "#". This is useful for including a special features in a Makefile, dnl set to "#". This is useful for including a special features in a Makefile,
dnl which cannot be handled by other versions of make. The variable dnl which cannot be handled by other versions of make. The variable
dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
dnl the empty string otherwise. dnl the empty string otherwise.
...@@ -1515,7 +1508,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also ...@@ -1515,7 +1508,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also
dnl exists, then the other make wraps the GNU make. dnl exists, then the other make wraps the GNU make.
dnl dnl
dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
dnl @version $Id: acinclude.m4,v 1.44 2000/07/21 01:02:31 bkoz Exp $ dnl @version $Id: acinclude.m4,v 1.45 2000/07/21 20:59:23 gdr Exp $
dnl dnl
dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
......
...@@ -1208,12 +1208,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1208,12 +1208,10 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
esac esac
if test x$glibc_satisfactory = x"yes"; then if test x$glibc_satisfactory = x"yes"; then
BUILD_LIBIO_INCLUDE=
need_libio=no need_libio=no
need_xtra_libio=no need_xtra_libio=no
need_wlibio=no need_wlibio=no
else else
BUILD_LIBIO_INCLUDE='-I../libio'
need_libio=yes need_libio=yes
need_xtra_libio=yes need_xtra_libio=yes
# bkoz XXX need to add checks to enable this # bkoz XXX need to add checks to enable this
...@@ -1222,7 +1220,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1222,7 +1220,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
# Using libio, but <libio.h> doesn't exist on the target system. . . # Using libio, but <libio.h> doesn't exist on the target system. . .
else else
BUILD_LIBIO_INCLUDE='-I../libio'
need_libio=yes need_libio=yes
need_xtra_libio=no need_xtra_libio=no
# bkoz XXX need to add checks to enable this # bkoz XXX need to add checks to enable this
...@@ -1236,8 +1233,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ ...@@ -1236,8 +1233,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
AC_MSG_RESULT(wince) AC_MSG_RESULT(wince)
need_libio=no need_libio=no
BUILD_LIBIO_INCLUDE=
AC_SUBST(BUILD_LIBIO_INCLUDE)
;; ;;
*) *)
echo "$enable_cstdio is an unknown io package" 1>&2 echo "$enable_cstdio is an unknown io package" 1>&2
...@@ -1418,19 +1413,17 @@ changequote([, ])dnl ...@@ -1418,19 +1413,17 @@ changequote([, ])dnl
enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
AC_MSG_RESULT($enable_cshadow_headers) AC_MSG_RESULT($enable_cshadow_headers)
dnl Option parsed, now set things appropriately dnl Option parsed, now set things appropriately
dnl CSHADOWFLAGS is currently unused, but may be useful in the future.
case "$enable_cshadow_headers" in case "$enable_cshadow_headers" in
yes) yes)
CSHADOWFLAGS="-D_GNU_SOURCE" CSHADOWFLAGS=""
CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
;; ;;
no) no)
CSHADOWFLAGS="" CSHADOWFLAGS=""
CSHADOW_INCLUDES=""
;; ;;
esac esac
AC_SUBST(CSHADOWFLAGS) AC_SUBST(CSHADOWFLAGS)
AC_SUBST(CSHADOW_INCLUDES)
AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes) AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
]) ])
...@@ -1492,7 +1485,7 @@ AC_SUBST(LIBSTRINGOBJS)dnl ...@@ -1492,7 +1485,7 @@ AC_SUBST(LIBSTRINGOBJS)dnl
dnl This macro searches for a GNU version of make. If a match is found, the dnl This macro searches for a GNU version of make. If a match is found, the
dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
dnl set to "#". This is useful for including a special features in a Makefile, dnl set to "#". This is useful for including a special features in a Makefile,
dnl which cannot be handled by other versions of make. The variable dnl which cannot be handled by other versions of make. The variable
dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
dnl the empty string otherwise. dnl the empty string otherwise.
...@@ -1527,7 +1520,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also ...@@ -1527,7 +1520,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also
dnl exists, then the other make wraps the GNU make. dnl exists, then the other make wraps the GNU make.
dnl dnl
dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
dnl @version $Id: aclocal.m4,v 1.45 2000/07/21 01:02:31 bkoz Exp $ dnl @version $Id: acinclude.m4,v 1.45 2000/07/21 20:59:23 gdr Exp $
dnl dnl
dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
......
...@@ -590,9 +590,7 @@ namespace std { ...@@ -590,9 +590,7 @@ namespace std {
bool __testput = true; bool __testput = true;
streamsize __n = __this_sb->in_avail(); streamsize __n = __this_sb->in_avail();
while (_M_gcount <= __n while (_M_gcount <= __n && !__testeof && !__testdelim
&& !__testeof
&& !__testdelim
&& (__testput = __sb.sputc(traits_type::to_char_type(__c)) && (__testput = __sb.sputc(traits_type::to_char_type(__c))
!= __eof)) != __eof))
{ {
...@@ -625,50 +623,30 @@ namespace std { ...@@ -625,50 +623,30 @@ namespace std {
sentry __cerb(*this, true); sentry __cerb(*this, true);
if (__cerb) if (__cerb)
{ {
try { try {
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf(); __streambuf_type* __sb = this->rdbuf();
bool __testdelim = false; int_type __c = __sb->sbumpc();
bool __testeof = false; const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
// This is completely idiotic, but attempts to recreate bool __testdelim = __c == __idelim;
// the smoke-filled air of the committee meeting where bool __testeof = __c == __eof;
// getline was defined. It's unspecified for __n == 1,
// what happens to the extracted char if it is not a while (++_M_gcount < __n && !__testeof && !__testdelim)
// delimiter or EOF. Assume it's not extracted, for the
// time being. . .
if (__n == 1)
{ {
int_type __c = __sb->sgetc(); *__s++ = traits_type::to_char_type(__c);
__testdelim = __c == __idelim; __c = __sb->sbumpc();
__testeof = __c == __eof; __testeof = __c == __eof;
if (__testdelim) __testdelim = __c == __idelim;
{
++_M_gcount;
__sb->sbumpc();
}
}
else
{
while (_M_gcount < __n - 1 && !__testdelim && !__testeof)
{
int_type __c = __sb->sbumpc();
__testdelim = __c == __idelim;
__testeof = __c == __eof;
if (__testdelim)
++_M_gcount;
else if (!__testeof)
{
*__s++ = traits_type::to_char_type(__c);
++_M_gcount;
}
}
} }
if (__testeof) if (__testeof)
this->setstate(ios_base::eofbit); this->setstate(ios_base::eofbit);
else if (!__testdelim && _M_gcount == __n - 1) else if (!__testdelim)
this->setstate(ios_base::failbit); {
--_M_gcount;
__sb->sputbackc(traits_type::to_char_type(__c));
this->setstate(ios_base::failbit);
}
} }
catch(exception& __fail){ catch(exception& __fail){
// 27.6.1.3 paragraph 1 // 27.6.1.3 paragraph 1
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -19,7 +19,7 @@ GLIBCPP_CONFIGURE(.) ...@@ -19,7 +19,7 @@ GLIBCPP_CONFIGURE(.)
AC_LIBTOOL_DLOPEN AC_LIBTOOL_DLOPEN
GLIBCPP_CHECK_GNU_MAKE GLIBCPP_CHECK_GNU_MAKE
if test "x$_cv_gnu_make_command" = "x"; then if test "x$_cv_gnu_make_command" = "x"; then
AC_MSG_ERROR([GNU Make not found. Please install it or correct your path.]) AC_MSG_ERROR([GNU make not found. Please install it or correct your path.])
fi fi
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
...@@ -187,8 +187,8 @@ fi ...@@ -187,8 +187,8 @@ fi
# Trying to get more people to read documentation. Possibly remove check # Trying to get more people to read documentation. Possibly remove check
# and warn all the time. # and warn all the time.
if test ! -f .sanity_warned; then if test ! -f stamp-sanity-warned; then
touch .sanity_warned touch stamp-sanity-warned
# There is no "informational" AC_MSG_ macro, so these are going to be # There is no "informational" AC_MSG_ macro, so these are going to be
# printed even when --quiet/--silent is given. # printed even when --quiet/--silent is given.
echo '' echo ''
......
...@@ -26,9 +26,12 @@ AUTOMAKE_OPTIONS = 1.3 cygnus ...@@ -26,9 +26,12 @@ AUTOMAKE_OPTIONS = 1.3 cygnus
# Passed down for cross compilers, canadian crosses. # Passed down for cross compilers, canadian crosses.
TOPLEVEL_INCLUDES = -I$(includedir) TOPLEVEL_INCLUDES = -I$(includedir)
LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio if GLIBCPP_NEED_LIBIO
LIBIO_INCLUDES = \
CSHADOW_INCLUDES = @CSHADOWFLAGS@ @CSHADOW_INCLUDES@ -I$(top_builddir)/libio -I$(top_srcdir)/libio
else
LIBIO_INCLUDES =
endif
CONFIG_INCLUDES = \ CONFIG_INCLUDES = \
-I$(top_srcdir)/@cpu_include_dir@ \ -I$(top_srcdir)/@cpu_include_dir@ \
...@@ -36,7 +39,7 @@ CONFIG_INCLUDES = \ ...@@ -36,7 +39,7 @@ CONFIG_INCLUDES = \
INCLUDES = \ INCLUDES = \
-nostdinc++ -I$(top_srcdir) \ -nostdinc++ -I$(top_srcdir) \
$(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) \
$(TOPLEVEL_INCLUDES) $(TOPLEVEL_INCLUDES)
noinst_LTLIBRARIES = libio.la noinst_LTLIBRARIES = libio.la
......
...@@ -65,7 +65,6 @@ target_alias = @target_alias@ ...@@ -65,7 +65,6 @@ target_alias = @target_alias@
target_triplet = @target@ target_triplet = @target@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
CC = @CC@ CC = @CC@
CPP = @CPP@ CPP = @CPP@
CPU_FLAGS = @CPU_FLAGS@ CPU_FLAGS = @CPU_FLAGS@
...@@ -109,10 +108,9 @@ AUTOMAKE_OPTIONS = 1.3 cygnus ...@@ -109,10 +108,9 @@ AUTOMAKE_OPTIONS = 1.3 cygnus
# Passed down for cross compilers, canadian crosses. # Passed down for cross compilers, canadian crosses.
TOPLEVEL_INCLUDES = -I$(includedir) TOPLEVEL_INCLUDES = -I$(includedir)
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_INCLUDES = @GLIBCPP_NEED_LIBIO_TRUE@\
LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio @GLIBCPP_NEED_LIBIO_TRUE@ -I$(top_builddir)/libio -I$(top_srcdir)/libio
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_INCLUDES =
CSHADOW_INCLUDES = @CSHADOWFLAGS@ @CSHADOW_INCLUDES@
CONFIG_INCLUDES = \ CONFIG_INCLUDES = \
-I$(top_srcdir)/@cpu_include_dir@ \ -I$(top_srcdir)/@cpu_include_dir@ \
...@@ -121,7 +119,7 @@ CONFIG_INCLUDES = \ ...@@ -121,7 +119,7 @@ CONFIG_INCLUDES = \
INCLUDES = \ INCLUDES = \
-nostdinc++ -I$(top_srcdir) \ -nostdinc++ -I$(top_srcdir) \
$(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) \
$(TOPLEVEL_INCLUDES) $(TOPLEVEL_INCLUDES)
......
...@@ -65,12 +65,10 @@ target_alias = @target_alias@ ...@@ -65,12 +65,10 @@ target_alias = @target_alias@
target_triplet = @target@ target_triplet = @target@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
CC = @CC@ CC = @CC@
CPP = @CPP@ CPP = @CPP@
CPU_FLAGS = @CPU_FLAGS@ CPU_FLAGS = @CPU_FLAGS@
CSHADOWFLAGS = @CSHADOWFLAGS@ CSHADOWFLAGS = @CSHADOWFLAGS@
CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
CXX = @CXX@ CXX = @CXX@
CXXCPP = @CXXCPP@ CXXCPP = @CXXCPP@
DEBUG_FLAGS = @DEBUG_FLAGS@ DEBUG_FLAGS = @DEBUG_FLAGS@
......
...@@ -52,7 +52,7 @@ AC_CXXFLAGS = \ ...@@ -52,7 +52,7 @@ AC_CXXFLAGS = \
# the end of the compile line so that -O2 can be overridden as the # the end of the compile line so that -O2 can be overridden as the
# occasion call for it. (ie, --enable-debug) # occasion call for it. (ie, --enable-debug)
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-D_GNU_SOURCE -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) \ -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) \
-Wall -Wno-format -W -Wwrite-strings -Winline \ -Wall -Wno-format -W -Wwrite-strings -Winline \
$(AC_CXXFLAGS) $(AC_CXXFLAGS)
...@@ -60,18 +60,29 @@ AM_CXXFLAGS = \ ...@@ -60,18 +60,29 @@ AM_CXXFLAGS = \
# Passed down for cross compilers, canadian crosses. # Passed down for cross compilers, canadian crosses.
TOPLEVEL_INCLUDES = -I$(includedir) TOPLEVEL_INCLUDES = -I$(includedir)
LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio if GLIBCPP_NEED_LIBIO
LIBIO_INCLUDES = \
-I$(top_builddir)/libio -I$(top_srcdir)/libio
else
LIBIO_INCLUDES =
endif
CSHADOW_INCLUDES = @CSHADOWFLAGS@ @CSHADOW_INCLUDES@ if GLIBCPP_USE_CSHADOW
CSHADOW_INCLUDES =
#CSHADOW_INCLUDES = \
# @CSHADOWFLAGS@ -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow
else
CSHADOW_INCLUDES =
endif
CONFIG_INCLUDES = \ CONFIG_INCLUDES = \
-I$(top_srcdir)/@cpu_include_dir@ \ -I$(top_srcdir)/@cpu_include_dir@ \
-I$(top_srcdir)/@ctype_include_dir@ -I$(top_srcdir)/@ctype_include_dir@
INCLUDES = \ INCLUDES = \
-nostdinc++ -I$(top_srcdir) \ -D_GNU_SOURCE -nostdinc++ -I$(top_srcdir) \
$(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(CSHADOW_INCLUDES) $(LIBIO_INCLUDES) \
$(TOPLEVEL_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES)
# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, # Need to explicitly set this so that AM_CXXFLAGS is last. (That way,
......
...@@ -64,7 +64,6 @@ target_alias = @target_alias@ ...@@ -64,7 +64,6 @@ target_alias = @target_alias@
target_triplet = @target@ target_triplet = @target@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
CC = @CC@ CC = @CC@
CPP = @CPP@ CPP = @CPP@
CPU_FLAGS = @CPU_FLAGS@ CPU_FLAGS = @CPU_FLAGS@
...@@ -129,17 +128,20 @@ AC_CXXFLAGS = \ ...@@ -129,17 +128,20 @@ AC_CXXFLAGS = \
# the end of the compile line so that -O2 can be overridden as the # the end of the compile line so that -O2 can be overridden as the
# occasion call for it. (ie, --enable-debug) # occasion call for it. (ie, --enable-debug)
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-D_GNU_SOURCE -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) \ -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) \
-Wall -Wno-format -W -Wwrite-strings -Winline \ -Wall -Wno-format -W -Wwrite-strings -Winline \
$(AC_CXXFLAGS) $(AC_CXXFLAGS)
# Passed down for cross compilers, canadian crosses. # Passed down for cross compilers, canadian crosses.
TOPLEVEL_INCLUDES = -I$(includedir) TOPLEVEL_INCLUDES = -I$(includedir)
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_INCLUDES = @GLIBCPP_NEED_LIBIO_TRUE@\
LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio @GLIBCPP_NEED_LIBIO_TRUE@ -I$(top_builddir)/libio -I$(top_srcdir)/libio
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_INCLUDES =
CSHADOW_INCLUDES = @CSHADOWFLAGS@ @CSHADOW_INCLUDES@ #CSHADOW_INCLUDES = \
# @CSHADOWFLAGS@ -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow
@GLIBCPP_USE_CSHADOW_TRUE@CSHADOW_INCLUDES =
@GLIBCPP_USE_CSHADOW_FALSE@CSHADOW_INCLUDES =
CONFIG_INCLUDES = \ CONFIG_INCLUDES = \
-I$(top_srcdir)/@cpu_include_dir@ \ -I$(top_srcdir)/@cpu_include_dir@ \
...@@ -147,9 +149,9 @@ CONFIG_INCLUDES = \ ...@@ -147,9 +149,9 @@ CONFIG_INCLUDES = \
INCLUDES = \ INCLUDES = \
-nostdinc++ -I$(top_srcdir) \ -D_GNU_SOURCE -nostdinc++ -I$(top_srcdir) \
$(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(CSHADOW_INCLUDES) \ $(CSHADOW_INCLUDES) $(LIBIO_INCLUDES) \
$(TOPLEVEL_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES)
# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, # Need to explicitly set this so that AM_CXXFLAGS is last. (That way,
......
...@@ -163,11 +163,13 @@ bool test02(void) ...@@ -163,11 +163,13 @@ bool test02(void)
// istream& getline(char* s, streamsize n) // istream& getline(char* s, streamsize n)
state1 = is_00.rdstate(); state1 = is_00.rdstate();
is_00.getline(carray1, 20, '*'); is_00.getline(carray1, 20, '*');
state2 = is_00.rdstate(); state2 = is_00.rdstate();
test &= is_04.gcount() == 0; // make sure failbit was set, since we couldn't extract
// from the NULL streambuf...
test &= state1 != state2; test &= state1 != state2;
test &= bool(state2 & statefail); test &= static_cast<bool>(state2 & statefail);
test &= is_04.gcount() == 0;
state1 = is_04.rdstate(); state1 = is_04.rdstate();
is_04.getline(carray1, 1, '\t'); // extracts, throws away is_04.getline(carray1, 1, '\t'); // extracts, throws away
state2 = is_04.rdstate(); state2 = is_04.rdstate();
...@@ -351,7 +353,6 @@ void test04() ...@@ -351,7 +353,6 @@ void test04()
// http://sourceware.cygnus.com/ml/libstdc++/2000-07/msg00003.html // http://sourceware.cygnus.com/ml/libstdc++/2000-07/msg00003.html
bool test05() bool test05()
{ {
const char* charray = " const char* charray = "
a a
aa aa
...@@ -383,7 +384,7 @@ aaaaaaaaaaaaaa ...@@ -383,7 +384,7 @@ aaaaaaaaaaaaaa
if(ifs.eof()) if(ifs.eof())
{ {
// Just sanity checks to make sure we've extracted the same // Just sanity checks to make sure we've extracted the same
// number of chars that were in the file. // number of chars that were in the streambuf
VERIFY(br == blen); VERIFY(br == blen);
// Also, we should only set the failbit if we could // Also, we should only set the failbit if we could
// _extract_ no chars from the stream, i.e. the first read // _extract_ no chars from the stream, i.e. the first read
...@@ -392,21 +393,24 @@ aaaaaaaaaaaaaa ...@@ -392,21 +393,24 @@ aaaaaaaaaaaaaa
} }
else if(ifs.fail()) else if(ifs.fail())
{ {
// delimiter not read
//
// either // either
// -> extracted no characters // -> extracted no characters
// or // or
// -> n - 1 characters are stored // -> n - 1 characters are stored
VERIFY(strlen(tmp) == it - 1);
ifs.clear(ifs.rdstate() & ~std::ios::failbit); ifs.clear(ifs.rdstate() & ~std::ios::failbit);
VERIFY((ifs.gcount() == 0) || (strlen(tmp) == it - 1));
VERIFY(ifs); VERIFY(ifs);
continue; continue;
} }
else else
{ {
// delimiter was read.
//
// -> strlen(__s) < n - 1 // -> strlen(__s) < n - 1
// -> delimiter was seen -> gcount() > strlen(__s) // -> delimiter was seen -> gcount() > strlen(__s)
VERIFY(ifs.gcount() > strlen(tmp)); VERIFY(ifs.gcount() == strlen(tmp) + 1);
VERIFY(it - 1 > strlen(tmp));
continue; continue;
} }
} }
...@@ -414,6 +418,39 @@ aaaaaaaaaaaaaa ...@@ -414,6 +418,39 @@ aaaaaaaaaaaaaa
return 0; return 0;
} }
// http://sources.redhat.com/ml/libstdc++/2000-07/msg00126.html
bool
test06()
{
using namespace std;
bool test = true;
const streamsize it = 5;
char tmp[it];
const char* str_lit = "abcd\n";
stringbuf strbuf(str_lit, std::ios_base::in);
istream istr(&strbuf);
istr.getline(tmp,it);
test &= istr.gcount() == it; // extracted whole string
test &= strlen(tmp) == 4; // stored all but '\n'
test &= !istr.eof(); // extracted up to but not eof
test &= !istr.fail(); // failbit not set
char c = 'z';
istr.get(c);
test &= c == 'z';
test &= istr.eof();
#ifdef DEBUG_ASSERT
assert(test);
#endif
return test;
}
int main() int main()
{ {
test01(); test01();
...@@ -421,6 +458,7 @@ int main() ...@@ -421,6 +458,7 @@ int main()
test03(); test03();
test04(); test04();
test05(); test05();
test06();
return 0; return 0;
} }
...@@ -431,3 +469,4 @@ int main() ...@@ -431,3 +469,4 @@ int main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment