From patchwork Thu Jul 21 12:48:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 106038 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 3B333B6F7F for ; Thu, 21 Jul 2011 22:49:17 +1000 (EST) Received: (qmail 4991 invoked by alias); 21 Jul 2011 12:49:15 -0000 Received: (qmail 4979 invoked by uid 22791); 21 Jul 2011 12:49:14 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD 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; Thu, 21 Jul 2011 12:48:37 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 5CAEA87E; Thu, 21 Jul 2011 14:48:36 +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 3xyanbznmWFK; Thu, 21 Jul 2011 14:48:32 +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 89A2E87C; Thu, 21 Jul 2011 14:48:32 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p6LCmWFw002792; Thu, 21 Jul 2011 14:48:32 +0200 (MEST) From: Rainer Orth To: Ian Lance Taylor Cc: "Ralf Wildenhues" , gcc-patches@gcc.gnu.org Subject: Re: [build, ada] Allow Solaris bootstrap with C++ (PR bootstrap/49794) References: <20110720205954.270130@gmx.net> Date: Thu, 21 Jul 2011 14:48:32 +0200 In-Reply-To: (Ian Lance Taylor's message of "Wed, 20 Jul 2011 15:14:08 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 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 Ian, >> I think something like this should work: >> >> AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], >> [AC_LANG_PUSH([C++]) >> AM_ICONV >> AC_LANG_POP([C++])], >> [AM_ICONV]) >> >> Rationale for using AS_IF rather than plain 'if' is that any macros >> required by AM_ICONV will get pulled out to before the AS_IF. If they >> also need to be run with C++ enabled, then we need to wrap the second >> argument of AS_IF into a separate macro. Untested, but please complain >> if it doesn't work. > > Cool. > > In general, though, we should ideally be using C++ when appropriate for > most or all of the compilation tests, not just for AM_ICONV. Fully agreed. In the meantime, the following patch just passed i386-pc-solaris2.10 bootstrap, testing still running. Ok for mainline as a stopgap measure if it passes? All but the (identical) libcpp/configure.ac and gcc/configure.ac pieces have already been approved. Thanks. Rainer 2011-07-20 Rainer Orth Ralf Wildenhues gcc: PR bootstrap/49794 * configure.ac: Test AM_ICONV with CXX. * configure: Regenerate. * config/sol2-c.c (solaris_format_types): Use EXPORTED_CONST. gcc/ada: PR bootstrap/49794 * init.c [sun && __SVR4 && !__vxworks] (__gnat_install_handler): Assign to act.sa_sigaction. * tracebak.c [USE_GENERIC_UNWINDER] (__gnat_backtrace): Cast current->return_address to char * before arithmetic. libcpp: PR bootstrap/49794 * configure.ac: Test AM_ICONV with CXX. * configure: Regenerate. * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++. diff --git a/gcc/ada/init.c b/gcc/ada/init.c --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -1031,7 +1031,7 @@ __gnat_install_handler (void) exceptions. Make sure that the handler isn't interrupted by another signal that might cause a scheduling event! */ - act.sa_handler = __gnat_error_handler; + act.sa_sigaction = __gnat_error_handler; act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -482,12 +482,12 @@ __gnat_backtrace (void **array, while (cnt < size) { if (STOP_FRAME (current, top_stack) || - !VALID_STACK_FRAME((char *)(current->return_address + PC_ADJUST))) + !VALID_STACK_FRAME(((char *) current->return_address) + PC_ADJUST)) break; if (current->return_address < exclude_min || current->return_address > exclude_max) - array[cnt++] = current->return_address + PC_ADJUST; + array[cnt++] = ((char *) current->return_address) + PC_ADJUST; current = (struct layout *) ((size_t) current->next + FRAME_OFFSET (1)); } diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c --- a/gcc/config/sol2-c.c +++ b/gcc/config/sol2-c.c @@ -1,5 +1,6 @@ /* Solaris support needed only by C/C++ frontends. - Copyright (C) 2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2009, 2010, 2011 + Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file is part of GCC. @@ -68,7 +69,7 @@ static const format_char_info cmn_err_ch { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; -const format_kind_info solaris_format_types[] = { +EXPORTED_CONST format_kind_info solaris_format_types[] = { { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL, cmn_err_flag_specs, cmn_err_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1041,7 +1041,14 @@ case "${host}" in esac AC_FUNC_FORK -AM_ICONV +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. +AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], + [AC_LANG_PUSH([C++]) + AM_ICONV + AC_LANG_POP([C++])], + [AM_ICONV]) + # Until we have in-tree GNU iconv: LIBICONV_DEP= AC_SUBST(LIBICONV_DEP) diff --git a/libcpp/configure.ac b/libcpp/configure.ac --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -102,7 +102,13 @@ if test $ac_cv_type_uchar = yes; then [Define if defines \`uchar'.]) fi -AM_ICONV +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. +AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], + [AC_LANG_PUSH([C++]) + AM_ICONV + AC_LANG_POP([C++])], + [AM_ICONV]) # More defines and substitutions. PACKAGE="$PACKAGE_TARNAME" diff --git a/libcpp/system.h b/libcpp/system.h --- a/libcpp/system.h +++ b/libcpp/system.h @@ -1,6 +1,6 @@ /* Get common system includes and various definitions and declarations based on autoconf macros. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -353,8 +353,8 @@ extern void abort (void); compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) #define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) + (!defined(__cplusplus) \ + && ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))) #endif #ifndef offsetof