-008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
+2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): New, checks for
+ common values of EOF, SEEK_CUR, SEEK_END.
+ * configure.ac: Use it.
+ * include/bits/ios_base.h: Likewise.
+ * include/bits/char_traits.h: Likewise.
+ * config/locale/gnu/ctype_members.cc: Include <cstdio>.
+ * config/locale/generic/ctype_members.cc: Likewise.
+ * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error lines.
+ * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise.
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+
+2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
* acinclude.m4 ([GLIBCXX_CHECK_INT64_T]): Also check whether int64_t
is actually a typedef to long or long long.
])
dnl
+dnl Check whether EOF, SEEK_CUR, and SEEK_END have the most common values:
+dnl in that case including <cstdio> in some C++ headers can be avoided.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_STDIO_MACROS], [
+
+ AC_MSG_CHECKING([for EOF == -1, SEEK_CUR == 1, SEEK_END == 2])
+ AC_CACHE_VAL(glibcxx_cv_stdio_macros, [
+ AC_TRY_COMPILE([#include <stdio.h>],
+ [#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2))
+ unusual values...
+ #endif
+ ], [glibcxx_cv_stdio_macros=yes],
+ [glibcxx_cv_stdio_macros=no])
+ ])
+ AC_MSG_RESULT($glibcxx_cv_stdio_macros)
+ if test x"$glibcxx_cv_stdio_macros" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_STDIO_MACROS, 1,
+ [Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2.])
+ fi
+
+])
+
+dnl
dnl Check whether macros, etc are present for <system_error>
dnl
AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
#undef _GLIBCXX_SJLJ_EXCEPTIONS
+/* Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2. */
+#undef _GLIBCXX_STDIO_MACROS
+
/* Define to use symbol versioning in the shared library. */
#undef _GLIBCXX_SYMVER
// std::ctype implementation details, generic version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
#include <locale>
#include <cstdlib>
#include <cstring>
+#include <cstdio>
_GLIBCXX_BEGIN_NAMESPACE(std)
// std::ctype implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <locale>
+#include <cstdio>
#include <bits/c++locale_internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
+ #
+
+
+ echo "$as_me:$LINENO: checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2" >&5
+echo $ECHO_N "checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2... $ECHO_C" >&6
+ if test "${glibcxx_cv_stdio_macros+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2))
+ unusual values...
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_stdio_macros=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_stdio_macros=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $glibcxx_cv_stdio_macros" >&5
+echo "${ECHO_T}$glibcxx_cv_stdio_macros" >&6
+ if test x"$glibcxx_cv_stdio_macros" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_STDIO_MACROS 1
+_ACEOF
+
+ fi
+
+
+
# For TLS support.
# Check whether --enable-tls or --disable-tls was given.
# For gettimeofday support.
GLIBCXX_CHECK_GETTIMEOFDAY
+ #
+ GLIBCXX_CHECK_STDIO_MACROS
+
# For TLS support.
GCC_CHECK_TLS
// Character Traits for use by standard string and iostream -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007
+// 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
#include <bits/stl_algobase.h> // std::copy, std::fill_n
#include <bits/postypes.h> // For streampos
-#include <cstdio> // For EOF
#include <cwchar> // For WEOF, wmemmove, wmemset, etc.
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For EOF
+# define _CHAR_TRAITS_EOF EOF
+#else
+# define _CHAR_TRAITS_EOF (-1)
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
/**
static int_type
eof()
- { return static_cast<int_type>(EOF); }
+ { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
static int_type
not_eof(const int_type& __c)
{ return __c1 == __c2; }
static int_type
- eof() { return static_cast<int_type>(EOF); }
+ eof() { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
static int_type
not_eof(const int_type& __c)
#include <ext/atomicity.h>
#include <bits/localefwd.h>
#include <bits/locale_classes.h>
-#include <cstdio> // For SEEK_CUR, SEEK_END
+
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For SEEK_CUR, SEEK_END
+# define _IOS_BASE_SEEK_CUR SEEK_CUR
+# define _IOS_BASE_SEEK_END SEEK_END
+#else
+# define _IOS_BASE_SEEK_CUR 1
+# define _IOS_BASE_SEEK_END 2
+#endif
_GLIBCXX_BEGIN_NAMESPACE(std)
enum _Ios_Seekdir
{
_S_beg = 0,
- _S_cur = SEEK_CUR,
- _S_end = SEEK_END,
+ _S_cur = _IOS_BASE_SEEK_CUR,
+ _S_end = _IOS_BASE_SEEK_END,
_S_ios_seekdir_end = 1L << 16
};
}
// { dg-error "synthesized" "" { target *-*-* } 42 }
// { dg-error "within this context" "" { target *-*-* } 35 }
-// { dg-error "is private" "" { target *-*-* } 786 }
+// { dg-error "is private" "" { target *-*-* } 794 }
// { dg-error "operator=" "" { target *-*-* } 0 }
}
// { dg-error "within this context" "" { target *-*-* } 36 }
// { dg-error "synthesized" "" { target *-*-* } 42 }
-// { dg-error "is private" "" { target *-*-* } 783 }
+// { dg-error "is private" "" { target *-*-* } 791 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }