OSDN Git Service

2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 23:17:05 +0000 (23:17 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 23:17:05 +0000 (23:17 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138829 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/config/locale/generic/ctype_members.cc
libstdc++-v3/config/locale/gnu/ctype_members.cc
libstdc++-v3/configure
libstdc++-v3/configure.ac
libstdc++-v3/include/bits/char_traits.h
libstdc++-v3/include/bits/ios_base.h
libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc

index 8d81860..2a4e4ad 100644 (file)
@@ -1,4 +1,18 @@
-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.
index 50f207c..3197682 100644 (file)
@@ -1461,6 +1461,29 @@ AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
 ])
 
 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], [
index 438fe14..b4cb3f3 100644 (file)
 /* 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
 
index ae1c7cf..6b4fbd7 100644 (file)
@@ -1,6 +1,6 @@
 // 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
@@ -37,6 +37,7 @@
 #include <locale>
 #include <cstdlib>
 #include <cstring>
+#include <cstdio>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
index 3aec312..9e51760 100644 (file)
@@ -1,6 +1,6 @@
 // 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
@@ -35,6 +35,7 @@
 // Written by Benjamin Kosnik <bkoz@redhat.com>
 
 #include <locale>
+#include <cstdio>
 #include <bits/c++locale_internal.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
index 5fb3107..fd77609 100755 (executable)
@@ -41812,6 +41812,78 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+  #
+
+
+  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.
index b23e177..6f530b3 100644 (file)
@@ -167,6 +167,9 @@ if $GLIBCXX_IS_NATIVE; then
   # For gettimeofday support.
   GLIBCXX_CHECK_GETTIMEOFDAY
 
+  #
+  GLIBCXX_CHECK_STDIO_MACROS
+
   # For TLS support.
   GCC_CHECK_TLS
 
index ae0f6cf..85e4167 100644 (file)
@@ -1,7 +1,7 @@
 // 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)
 
   /**
@@ -138,7 +144,7 @@ _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)
@@ -292,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       { 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)
index 95a3d2b..8b55028 100644 (file)
 #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)
 
@@ -186,8 +194,8 @@ _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 
     };
 
index 5325523..7df9d46 100644 (file)
@@ -43,5 +43,5 @@ void test01()
 }
 // { 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 } 
index 536682e..8f17ac6 100644 (file)
@@ -43,5 +43,5 @@ void test02()
 }
 // { 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 }