From patchwork Tue Jul 27 10:38:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 59993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BB7E8B6F0E for ; Tue, 27 Jul 2010 20:39:00 +1000 (EST) Received: (qmail 25353 invoked by alias); 27 Jul 2010 10:38:57 -0000 Received: (qmail 25343 invoked by uid 22791); 27 Jul 2010 10:38:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet10.oracle.com (HELO rcsinet10.oracle.com) (148.87.113.121) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Jul 2010 10:38:45 +0000 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o6RAcgYP025425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Jul 2010 10:38:44 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o6R7hciH011221 for ; Tue, 27 Jul 2010 10:38:41 GMT Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 460641721280227120; Tue, 27 Jul 2010 03:38:40 -0700 Received: from [192.168.0.4] (/79.52.233.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Jul 2010 03:38:40 -0700 Message-ID: <4C4EB72D.4040907@oracle.com> Date: Tue, 27 Jul 2010 12:38:37 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100520 SUSE/3.0.5 Thunderbird/3.0.5 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Use AC_COMPUTE_INT for EOF, SEEK_CUR, etc. X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, fixed the hack we had in place to avoid including unnecessarily thanks to Ralf help. Tested x86_64-linux, committed to mainline. Paolo. //////////////////// 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 . Index: configure.ac =================================================================== --- configure.ac (revision 162556) +++ configure.ac (working copy) @@ -153,8 +153,8 @@ # 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 Index: include/bits/ios_base.h =================================================================== --- include/bits/ios_base.h (revision 162556) +++ include/bits/ios_base.h (working copy) @@ -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 @@ 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_END_NAMESPACE -#undef _IOS_BASE_SEEK_CUR -#undef _IOS_BASE_SEEK_END - #endif /* _IOS_BASE_H */ Index: include/bits/char_traits.h =================================================================== --- include/bits/char_traits.h (revision 162556) +++ include/bits/char_traits.h (working copy) @@ -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 @@ 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 @@ 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 @@ #endif -#undef _CHAR_TRAITS_EOF - #endif // _CHAR_TRAITS_H Index: testsuite/27_io/ios_base/cons/assign_neg.cc =================================================================== --- testsuite/27_io/ios_base/cons/assign_neg.cc (revision 162556) +++ testsuite/27_io/ios_base/cons/assign_neg.cc (working copy) @@ -34,5 +34,5 @@ } // { 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 } Index: testsuite/27_io/ios_base/cons/copy_neg.cc =================================================================== --- testsuite/27_io/ios_base/cons/copy_neg.cc (revision 162556) +++ testsuite/27_io/ios_base/cons/copy_neg.cc (working copy) @@ -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 @@ } // { 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 } Index: config/io/c_io_stdio.h =================================================================== --- config/io/c_io_stdio.h (revision 162556) +++ config/io/c_io_stdio.h (working copy) @@ -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) Index: acinclude.m4 =================================================================== --- acinclude.m4 (revision 162556) +++ acinclude.m4 (working copy) @@ -1619,26 +1619,38 @@ ]) 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