re PR libstdc++/8399 (sync_with_stdio(false) breaks unformatted input)

2002-11-15  Paolo Carlini  <pcarlini@unitus.it>
	    Loren J. Rittle  <ljrittle@acm.org>

	PR libstdc++/8399
	* acinclude.m4
	(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1): New macro to
	check for unistd.h functions.
	(GLIBCPP_CHECK_UNISTD_SUPPORT): New macro, check for isatty
	in unistd.h.
	* configure.in: Call here.
	* src/ios.cc (ios_base::Init::_S_ios_create(bool)):
	Use _GLIBCPP_HAVE_ISATTY: ifdef, in case of interactive
	input __in_size = 1 even when sync_with_stdio is false;
	otherwise fall back to __in_size = 1.
	* aclocal.m4: Regenerate.
	* config.h.in: Regenerate.
	* configure: Regenerate.

Co-Authored-By: Loren J. Rittle <ljrittle@acm.org>

From-SVN: r59118
This commit is contained in:
Paolo Carlini 2002-11-15 09:06:35 +01:00 committed by Paolo Carlini
parent 90024bdce0
commit 74af99e5a2
7 changed files with 1534 additions and 1332 deletions

View file

@ -1,3 +1,21 @@
2002-11-15 Paolo Carlini <pcarlini@unitus.it>
Loren J. Rittle <ljrittle@acm.org>
PR libstdc++/8399
* acinclude.m4
(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1): New macro to
check for unistd.h functions.
(GLIBCPP_CHECK_UNISTD_SUPPORT): New macro, check for isatty
in unistd.h.
* configure.in: Call here.
* src/ios.cc (ios_base::Init::_S_ios_create(bool)):
Use _GLIBCPP_HAVE_ISATTY: ifdef, in case of interactive
input __in_size = 1 even when sync_with_stdio is false;
otherwise fall back to __in_size = 1.
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
2002-11-13 Benjamin Kosnik <bkoz@redhat.com>
* acconfig.h (HAVE_DRAND48): Add.

View file

@ -591,6 +591,33 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
fi
])
dnl
dnl Check to see if the (unistd function) argument passed is
dnl 1) declared when using the c++ compiler
dnl 2) has "C" linkage
dnl
dnl argument 1 is name of function to check
dnl
dnl ASSUMES argument is a function with ONE parameter
dnl
dnl GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1
AC_DEFUN(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1, [
AC_MSG_CHECKING([for $1 declaration])
if test x${glibcpp_cv_func_$1_use+set} != xset; then
AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <unistd.h>],
[ $1(0);],
[glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
AC_LANG_RESTORE
])
fi
AC_MSG_RESULT($glibcpp_cv_func_$1_use)
if test x$glibcpp_cv_func_$1_use = x"yes"; then
AC_CHECK_FUNCS($1)
fi
])
dnl
dnl Because the builtins are picky picky picky about the arguments they take,
@ -702,9 +729,8 @@ AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
fi
])
dnl
dnl Check to see what the underlying c library
dnl Check to see what the underlying c library is like
dnl These checks need to do two things:
dnl 1) make sure the name is declared when using the c++ compiler
dnl 2) make sure the name has "C" linkage
@ -727,6 +753,25 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
CXXFLAGS="$ac_save_CXXFLAGS"
])
dnl
dnl Check to see what the underlying c library is like
dnl These checks need to do two things:
dnl 1) make sure the name is declared when using the c++ compiler
dnl 2) make sure the name has "C" linkage
dnl This might seem like overkill but experience has shown that it's not...
dnl
dnl Define HAVE_ISATTY if "isatty" is declared and links
dnl
dnl GLIBCPP_CHECK_UNISTD_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_UNISTD_SUPPORT, [
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1(isatty)
CXXFLAGS="$ac_save_CXXFLAGS"
])
dnl
dnl Check to see what the underlying c library or math library is like.

View file

@ -1,4 +1,4 @@
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
dnl aclocal.m4 generated automatically by aclocal 1.4-p6
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@ -603,6 +603,33 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
fi
])
dnl
dnl Check to see if the (unistd function) argument passed is
dnl 1) declared when using the c++ compiler
dnl 2) has "C" linkage
dnl
dnl argument 1 is name of function to check
dnl
dnl ASSUMES argument is a function with ONE parameter
dnl
dnl GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1
AC_DEFUN(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1, [
AC_MSG_CHECKING([for $1 declaration])
if test x${glibcpp_cv_func_$1_use+set} != xset; then
AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <unistd.h>],
[ $1(0);],
[glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
AC_LANG_RESTORE
])
fi
AC_MSG_RESULT($glibcpp_cv_func_$1_use)
if test x$glibcpp_cv_func_$1_use = x"yes"; then
AC_CHECK_FUNCS($1)
fi
])
dnl
dnl Because the builtins are picky picky picky about the arguments they take,
@ -714,9 +741,8 @@ AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
fi
])
dnl
dnl Check to see what the underlying c library
dnl Check to see what the underlying c library is like
dnl These checks need to do two things:
dnl 1) make sure the name is declared when using the c++ compiler
dnl 2) make sure the name has "C" linkage
@ -739,6 +765,25 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
CXXFLAGS="$ac_save_CXXFLAGS"
])
dnl
dnl Check to see what the underlying c library is like
dnl These checks need to do two things:
dnl 1) make sure the name is declared when using the c++ compiler
dnl 2) make sure the name has "C" linkage
dnl This might seem like overkill but experience has shown that it's not...
dnl
dnl Define HAVE_ISATTY if "isatty" is declared and links
dnl
dnl GLIBCPP_CHECK_UNISTD_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_UNISTD_SUPPORT, [
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1(isatty)
CXXFLAGS="$ac_save_CXXFLAGS"
])
dnl
dnl Check to see what the underlying c library or math library is like.
@ -2217,31 +2262,6 @@ AC_MSG_RESULT($enable_symvers)
])
# isc-posix.m4 serial 1 (gettext-0.10.40)
dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
@ -2285,7 +2305,8 @@ dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
@ -2301,13 +2322,42 @@ AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
# Copyright 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.4-p6])])
#
# Check to make sure that the build environment is sane.
#

View file

@ -3,6 +3,9 @@
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
// Define if GCC supports weak symbols.
#undef _GLIBCPP_SUPPORTS_WEAK
@ -461,6 +464,9 @@
/* Define if you have the iconv_open function. */
#undef HAVE_ICONV_OPEN
/* Define if you have the isatty function. */
#undef HAVE_ISATTY
/* Define if you have the isinf function. */
#undef HAVE_ISINF

2674
libstdc++-v3/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -397,6 +397,7 @@ else
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
GLIBCPP_CHECK_WCHAR_T_SUPPORT
GLIBCPP_CHECK_STDLIB_SUPPORT
GLIBCPP_CHECK_UNISTD_SUPPORT
AC_LC_MESSAGES
AC_TRY_COMPILE([

View file

@ -157,7 +157,11 @@ namespace std
ios_base::Init::_S_ios_create(bool __sync)
{
int __out_size = __sync ? 0 : static_cast<int>(BUFSIZ);
int __in_size = __sync ? 1 : static_cast<int>(BUFSIZ);
#ifdef _GLIBCPP_HAVE_ISATTY
int __in_size = (__sync || isatty (0)) ? 1 : static_cast<int>(BUFSIZ);
#else
int __in_size = 1;
#endif
// NB: The file globals.cc creates the four standard files
// with NULL buffers. At this point, we swap out the dummy NULL