From ddc9c40d207ed67a7c438b4bd3166eeaa44dd08a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 27 Jul 2010 10:36:50 +0000 Subject: [PATCH] acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): Remove. 2010-07-27 Paolo Carlini Ralf Wildenhues * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): Remove. ([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS]): Add, actually compute the constants via AC_COMPUTE_INT. * configure.ac: Call the latter. * include/bits/ios_base.h: Adjust. * include/bits/char_traits.h: Likewise. * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error line number. * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise. * config.h.in: Regenerate. * configure: Likewise. 2010-07-27 Paolo Carlini * config/io/c_io_stdio.h: Do not include . Co-Authored-By: Ralf Wildenhues From-SVN: r162562 --- libstdc++-v3/ChangeLog | 19 ++ libstdc++-v3/acinclude.m4 | 44 ++-- libstdc++-v3/config.h.in | 10 +- libstdc++-v3/config/io/c_io_stdio.h | 3 +- libstdc++-v3/configure | 188 ++++++++++-------- libstdc++-v3/configure.ac | 4 +- libstdc++-v3/include/bits/char_traits.h | 13 +- libstdc++-v3/include/bits/ios_base.h | 16 +- .../27_io/ios_base/cons/assign_neg.cc | 2 +- .../testsuite/27_io/ios_base/cons/copy_neg.cc | 4 +- 10 files changed, 173 insertions(+), 130 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 433d84fd248..ce732b4362e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2010-07-27 Paolo Carlini + Ralf Wildenhues + + * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): Remove. + ([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS]): Add, actually + compute the constants via AC_COMPUTE_INT. + * configure.ac: Call the latter. + * include/bits/ios_base.h: Adjust. + * include/bits/char_traits.h: Likewise. + * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error + line number. + * testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise. + * config.h.in: Regenerate. + * configure: Likewise. + +2010-07-27 Paolo Carlini + + * config/io/c_io_stdio.h: Do not include . + 2010-07-26 Rainer Orth * testsuite/22_locale/num_put/put/char/14220.cc: XFAIL on Solaris diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 6786cbcb9ea..8977f3d7cb7 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1619,26 +1619,38 @@ 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 in some C++ headers can be avoided. +dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants. dnl -AC_DEFUN([GLIBCXX_CHECK_STDIO_MACROS], [ +AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [ - AC_MSG_CHECKING([for EOF == -1, SEEK_CUR == 1, SEEK_END == 2]) - AC_CACHE_VAL(glibcxx_cv_stdio_macros, [ - AC_TRY_COMPILE([#include ], - [#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2)) - unusual values... - #endif - ], [glibcxx_cv_stdio_macros=yes], - [glibcxx_cv_stdio_macros=no]) + AC_MSG_CHECKING([For some integer constants.]) + + AC_CACHE_VAL(glibcxx_cv_stdio_eof, [ + AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]], + [#include ], + [AC_MSG_ERROR([computing EOF failed])]) ]) - 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 + AC_MSG_RESULT($glibcxx_cv_stdio_eof) + AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof, + [Define to the value of the EOF integer constant.]) + AC_CACHE_VAL(glibcxx_cv_stdio_seek_cur, [ + AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]], + [#include ], + [AC_MSG_ERROR([computing SEEK_CUR failed])]) + ]) + AC_MSG_RESULT($glibcxx_cv_stdio_seek_cur) + AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur, + [Define to the value of the SEEK_CUR integer constant.]) + + AC_CACHE_VAL(glibcxx_cv_stdio_seek_end, [ + AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]], + [#include ], + [AC_MSG_ERROR([computing SEEK_END failed])]) + ]) + AC_MSG_RESULT($glibcxx_cv_stdio_seek_end) + AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end, + [Define to the value of the SEEK_END integer constant.]) ]) dnl diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 00aed69c388..6ab257fa344 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -713,8 +713,14 @@ /* 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 the value of the EOF integer constant. */ +#undef _GLIBCXX_STDIO_EOF + +/* Define to the value of the SEEK_CUR integer constant. */ +#undef _GLIBCXX_STDIO_SEEK_CUR + +/* Define to the value of the SEEK_END integer constant. */ +#undef _GLIBCXX_STDIO_SEEK_END /* Define to use symbol versioning in the shared library. */ #undef _GLIBCXX_SYMVER diff --git a/libstdc++-v3/config/io/c_io_stdio.h b/libstdc++-v3/config/io/c_io_stdio.h index 86ca53baafb..f6eeadc9ba9 100644 --- a/libstdc++-v3/config/io/c_io_stdio.h +++ b/libstdc++-v3/config/io/c_io_stdio.h @@ -1,6 +1,6 @@ // Underlying io library details -*- C++ -*- -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -34,7 +34,6 @@ #define _GLIBCXX_CXX_IO_H 1 #include -#include #include _GLIBCXX_BEGIN_NAMESPACE(std) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 90985426c50..2e6affaf740 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -2201,60 +2201,6 @@ fi } # ac_fn_cxx_check_header_mongrel -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type - # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2432,6 +2378,60 @@ rm -f conftest.val return $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -18676,45 +18676,73 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# For common values of EOF, SEEK_CUR, SEEK_END. +# For the EOF, SEEK_CUR, and SEEK_END integer constants. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2" >&5 -$as_echo_n "checking for EOF == -1, SEEK_CUR == 1, SEEK_END == 2... " >&6; } - if test "${glibcxx_cv_stdio_macros+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking For some integer constants." >&5 +$as_echo_n "checking For some integer constants.... " >&6; } + + if test "${glibcxx_cv_stdio_eof+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2)) - unusual values... - #endif + if ac_fn_c_compute_int "$LINENO" "EOF" "glibcxx_cv_stdio_eof" "#include "; then : - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - glibcxx_cv_stdio_macros=yes else - glibcxx_cv_stdio_macros=no + as_fn_error "computing EOF failed" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_stdio_macros" >&5 -$as_echo "$glibcxx_cv_stdio_macros" >&6; } - if test x"$glibcxx_cv_stdio_macros" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_stdio_eof" >&5 +$as_echo "$glibcxx_cv_stdio_eof" >&6; } -$as_echo "#define _GLIBCXX_STDIO_MACROS 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define _GLIBCXX_STDIO_EOF $glibcxx_cv_stdio_eof +_ACEOF - fi + + if test "${glibcxx_cv_stdio_seek_cur+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if ac_fn_c_compute_int "$LINENO" "SEEK_CUR" "glibcxx_cv_stdio_seek_cur" "#include "; then : + +else + as_fn_error "computing SEEK_CUR failed" "$LINENO" 5 +fi + + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_stdio_seek_cur" >&5 +$as_echo "$glibcxx_cv_stdio_seek_cur" >&6; } + +cat >>confdefs.h <<_ACEOF +#define _GLIBCXX_STDIO_SEEK_CUR $glibcxx_cv_stdio_seek_cur +_ACEOF + + + if test "${glibcxx_cv_stdio_seek_end+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if ac_fn_c_compute_int "$LINENO" "SEEK_END" "glibcxx_cv_stdio_seek_end" "#include "; then : + +else + as_fn_error "computing SEEK_END failed" "$LINENO" 5 +fi + + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_stdio_seek_end" >&5 +$as_echo "$glibcxx_cv_stdio_seek_end" >&6; } + +cat >>confdefs.h <<_ACEOF +#define _GLIBCXX_STDIO_SEEK_END $glibcxx_cv_stdio_seek_end +_ACEOF diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 2d99a236440..f3dfe0142d0 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -153,8 +153,8 @@ GLIBCXX_CHECK_WRITEV # For C99 support to TR1. GLIBCXX_CHECK_C99_TR1 -# For common values of EOF, SEEK_CUR, SEEK_END. -GLIBCXX_CHECK_STDIO_MACROS +# For the EOF, SEEK_CUR, and SEEK_END integer constants. +GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS # For gettimeofday support. GLIBCXX_CHECK_GETTIMEOFDAY diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 412e75a2ec0..786c1c6b380 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -42,13 +42,6 @@ #include // For streampos #include // For WEOF, wmemmove, wmemset, etc. -#ifndef _GLIBCXX_STDIO_MACROS -# include // For EOF -# define _CHAR_TRAITS_EOF EOF -#else -# define _CHAR_TRAITS_EOF (-1) -#endif - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** @@ -139,7 +132,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) static int_type eof() - { return static_cast(_CHAR_TRAITS_EOF); } + { return static_cast(_GLIBCXX_STDIO_EOF); } static int_type not_eof(const int_type& __c) @@ -294,7 +287,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) static int_type eof() - { return static_cast(_CHAR_TRAITS_EOF); } + { return static_cast(_GLIBCXX_STDIO_EOF); } static int_type not_eof(const int_type& __c) @@ -570,6 +563,4 @@ _GLIBCXX_END_NAMESPACE #endif -#undef _CHAR_TRAITS_EOF - #endif // _CHAR_TRAITS_H diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h index 0ac3d692647..6515dd40e8e 100644 --- a/libstdc++-v3/include/bits/ios_base.h +++ b/libstdc++-v3/include/bits/ios_base.h @@ -42,15 +42,6 @@ #include #include -#ifndef _GLIBCXX_STDIO_MACROS -# include // 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) // The following definitions of bitmask types are enums, not ints, @@ -189,8 +180,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) enum _Ios_Seekdir { _S_beg = 0, - _S_cur = _IOS_BASE_SEEK_CUR, - _S_end = _IOS_BASE_SEEK_END, + _S_cur = _GLIBCXX_STDIO_SEEK_CUR, + _S_end = _GLIBCXX_STDIO_SEEK_END, _S_ios_seekdir_end = 1L << 16 }; @@ -970,8 +961,5 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_END_NAMESPACE -#undef _IOS_BASE_SEEK_CUR -#undef _IOS_BASE_SEEK_END - #endif /* _IOS_BASE_H */ diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc index f569a7bce82..9f85ad1c9d8 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc @@ -34,5 +34,5 @@ void test01() } // { dg-error "synthesized" "" { target *-*-* } 33 } // { dg-error "within this context" "" { target *-*-* } 26 } -// { dg-error "is private" "" { target *-*-* } 788 } +// { dg-error "is private" "" { target *-*-* } 779 } // { dg-error "operator=" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc index e02ab105911..2a7573749bd 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software // Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -34,5 +34,5 @@ void test02() } // { dg-error "within this context" "" { target *-*-* } 26 } // { dg-error "synthesized" "" { target *-*-* } 33 } -// { dg-error "is private" "" { target *-*-* } 785 } +// { dg-error "is private" "" { target *-*-* } 776 } // { dg-error "copy constructor" "" { target *-*-* } 0 }