From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22116 invoked by alias); 26 Aug 2011 12:46:53 -0000 Received: (qmail 22102 invoked by uid 22791); 26 Aug 2011 12:46:52 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Aug 2011 12:46:33 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 8D49E69B; Fri, 26 Aug 2011 14:46:31 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sasC-iI6wiVg; Fri, 26 Aug 2011 14:46:26 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id C349369A; Fri, 26 Aug 2011 14:46:26 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p7QCkQfd007160; Fri, 26 Aug 2011 14:46:26 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org Subject: [v3] Handle different versions of Solaris 8 , Date: Fri, 26 Aug 2011 13:04:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg02152.txt.bz2 --=-=-= Content-length: 2160 All my testing of the __cplusplus 199711L patches had been on Solaris 8+/x86. During last weekend's bootstrap on the whole range of systems (Solaris 8 to 11, SPARC and x86), it turned out that there are possible variations of and between Solaris 8 FCS and patches, so we cannot statically configure which overloads are present, but need autoconf checks for that. The situation is as follows: * Solaris 8 FCS shipped rev. 1.1 of which only had double std::abs(double). Later, in patches 111721-04 (SPARC) and 112757-01 (x86), rev. 1.3 whas shipped that has everything that's also present in Solaris 9 and up. * Similarly, Solaris 8 FCS has rev. 1.1 of without any overloads. Patches 109607-02 (SPARC) and 109608-02 (x86) added long std::abs(long) and ldiv_t div(lng, long) in rev. 1.3. Since is included before configure results, configure needs to define the affected __CORRECT_ISO_CPP_MATH_H_PROTO[12] and __CORRECT_ISO_CPP_STDLIB_H_PROTO directly. The following patch does just that. Bootstrapped without regressions on x86_64-unknown-linux-gnu and i386-pc-solaris2.11, bootstraps on i386-pc-solaris2.8 (with the old rev. 1.1 headers) and sparc-sun-solaris2.8 (with the the rev. 1.3 headers) are still in progress, but I've verified that the __CORRECT_ISO_CPP_* macros are all defined correctly.. Since errors in previous versions of the patch manifested themselves in build failures immediately, I'm pretty certain that there are no errors. Ok for mainline if bootstraps pass? Thanks. Rainer 2011-08-25 Rainer Orth * acinclude.m4 (GLIBCXX_CHECK_MATH_PROTO) (GLIBCXX_CHECK_STDLIB_PROTO): New tests. * configure.ac (GLIBCXX_CHECK_MATH_PROTO) (GLIBCXX_CHECK_STDLIB_PROTO): Call them. * configure: Regenerate. * config.h.in: Regenerate. * config/os/solaris/solaris2.8/os_defines.h (__CORRECT_ISO_CPP_MATH_H_PROTO2): Don't define. * config/os/solaris/solaris2.9: Remove. * configure.host (solaris2.8): Merge with ... (solaris2.9, solaris2.1[0-9]): ... this. Always use os/solaris/solaris2.8. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol8-v3-math_iso.patch Content-length: 5180 # HG changeset patch # Parent b3524f20d0077532a567b222d37ef05976af2743 Handle different versions of Solaris 8 diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1693,6 +1693,100 @@ AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_ ]) dnl +dnl Check whether required C++ overloads are present in . +dnl + +AC_DEFUN([GLIBCXX_CHECK_MATH_PROTO], [ + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + case "$host" in + *-*-solaris2.*) + # Solaris 8 FCS only had an overload for double std::abs(double) in + # . Patches 111721-04 (SPARC) and 112757-01 (x86) + # introduced the full set also found from Solaris 9 onwards. + AC_MSG_CHECKING([for float std::abs(float) overload]) + AC_CACHE_VAL(glibcxx_cv_abs_float, [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [#include + namespace std { + inline float abs(float __x) + { return __builtin_fabsf(__x); } + } + ])], + [glibcxx_cv_abs_float=no], + [glibcxx_cv_abs_float=yes] + )]) + + # autoheader cannot handle indented templates. + AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO1], + [/* Define if all C++ overloads are available in . */ +#if __cplusplus >= 199711L +#undef __CORRECT_ISO_CPP_MATH_H_PROTO1 +#endif]) + AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO2], + [/* Define if only double std::abs(double) is available in . */ +#if __cplusplus >= 199711L +#undef __CORRECT_ISO_CPP_MATH_H_PROTO2 +#endif]) + + if test $glibcxx_cv_abs_float = yes; then + AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1) + else + AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2) + fi + AC_MSG_RESULT($glibcxx_cv_abs_float) + ;; + esac + + AC_LANG_RESTORE +]) + +dnl +dnl Check whether required C++ overloads are present in . +dnl + +AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [ + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + case "$host" in + *-*-solaris2.*) + # Solaris 8 FCS lacked the overloads for long std::abs(long) and + # ldiv_t std::div(long, long) in . Patches 109607-02 + # (SPARC) and 109608-02 (x86) introduced them. + AC_MSG_CHECKING([for long std::abs(long) overload]) + AC_CACHE_VAL(glibcxx_cv_abs_long, [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [#include + namespace std { + inline long + abs(long __i) { return labs(__i); } + } + ])], + [glibcxx_cv_abs_long=no], + [glibcxx_cv_abs_long=yes] + )]) + + # autoheader cannot handle indented templates. + AH_VERBATIM([__CORRECT_ISO_CPP_STDLIB_H_PROTO], + [/* Define if all C++ overloads are available in . */ +#if __cplusplus >= 199711L +#undef __CORRECT_ISO_CPP_STDLIB_H_PROTO +#endif]) + if test $glibcxx_cv_abs_long = yes; then + AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1) + fi + AC_MSG_RESULT($glibcxx_cv_abs_long) + ;; + esac + + AC_LANG_RESTORE +]) + +dnl dnl Check whether macros, etc are present for dnl AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [ diff --git a/libstdc++-v3/config/os/solaris/solaris2.8/os_defines.h b/libstdc++-v3/config/os/solaris/solaris2.8/os_defines.h --- a/libstdc++-v3/config/os/solaris/solaris2.8/os_defines.h +++ b/libstdc++-v3/config/os/solaris/solaris2.8/os_defines.h @@ -1,4 +1,4 @@ -// Specific definitions for Solaris 8 -*- C++ -*- +// Specific definitions for Solaris 8+ -*- C++ -*- // Copyright (C) 2000, 2002, 2005, 2009, 2011 Free Software Foundation, Inc. // @@ -28,9 +28,12 @@ // System-specific #define, typedefs, corrections, etc, go here. This // file will come before all others. -// FIXME: Autoconf if possible. #if __cplusplus >= 199711L -#define __CORRECT_ISO_CPP_MATH_H_PROTO2 +// Overloads in and changed with +// Solaris 8 patches. Since includes +// before configure results, +// __CORRECT_ISO_CPP_MATH_H_PROTO[12] and __CORRECT_ISO_CPP_STDLIB_H_PROTO +// must be defined via acinclude.m4. #define __CORRECT_ISO_CPP_STRING_H_PROTO #define __CORRECT_ISO_CPP_WCHAR_H_PROTO #endif diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -135,6 +135,8 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no] GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes]) # Checks for operating systems support that doesn't require linking. +GLIBCXX_CHECK_MATH_PROTO +GLIBCXX_CHECK_STDLIB_PROTO GLIBCXX_CHECK_SYSTEM_ERROR # For the streamoff typedef. diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -288,12 +288,9 @@ case "${host_os}" in echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2 exit 1 ;; - solaris2.8) + solaris2.[89] | solaris2.1[0-9]) os_include_dir="os/solaris/solaris2.8" ;; - solaris2.9 | solaris2.1[0-9]) - os_include_dir="os/solaris/solaris2.9" - ;; tpf) os_include_dir="os/tpf" ;; --=-=-= Content-length: 143 -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University --=-=-=--