From patchwork Thu Jul 21 12:57: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: 106040 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 3E22BB6F62 for ; Thu, 21 Jul 2011 22:57:55 +1000 (EST) Received: (qmail 8405 invoked by alias); 21 Jul 2011 12:57:53 -0000 Received: (qmail 8395 invoked by uid 22791); 21 Jul 2011 12:57:53 -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:57: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 E9AEC8C1; Thu, 21 Jul 2011 14:57:35 +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 vMe5mEm3zMGb; Thu, 21 Jul 2011 14:57:33 +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 399168C0; Thu, 21 Jul 2011 14:57:33 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p6LCvWQ8002795; Thu, 21 Jul 2011 14:57:32 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Ian Lance Taylor Subject: Allow Tru64 UNIX bootstrap with C++ Date: Thu, 21 Jul 2011 14:57:32 +0200 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 On Tru64 UNIX, I ran into two problems with C++ bootstrap: * gcc.c doesn't compile: In file included from /vol/gcc/src/hg/trunk/local/gcc/../include/xregex.h:26:0, from /vol/gcc/src/hg/trunk/local/gcc/gcc.c:38: /vol/gcc/src/hg/trunk/local/gcc/../include/xregex2.h:402:13: error: conflicting declaration 'typedef int regoff_t' /usr/include/reg_types.h:49:15: error: 'regoff_t' has a previous declaration as 'typedef off_t regoff_t' make[3]: *** [gcc.o] Error 1 include/xregex2.h has /* Type for byte offsets within the string. POSIX mandates this. */ typedef int regoff_t; while has typedef off_t regoff_t; with : typedef long off_t; /* file offset */ While this would conflict with C, too, I only find the xregex2.h typedef in C -save-temps output. C++ is different, though: has /* only include when using full prototypes to avoid extra */ /* name space cruft in default case */ #ifndef _NO_PROTO #include #include #ifdef __cplusplus #include #endif #endif I'm thus special-casing osf in regex2.h. I had a look at upstream (gnulib) regex.h, but it is unchanged in this regard. * lto-wrapper failed to link (also on IRIX 6.5, both of which lack strsignal in libc): strsignal(int) collect2: error: ld returned 1 exit status make[3]: *** [lto-wrapper] Error 1 While the object file uses the mangled form _Z9strsignali | 0000000000000000 | U | 0000000000000000 lto-wrapper.o libiberty.a has it as a C function. The problem is that gcc/system.h isn't wrapped in extern "C". Doing so allows the link to succeed. The bootstraps are still running, ok for mainline if they succeed? Thanks. Rainer 2011-07-21 Rainer Orth gcc: * system.h [__cplusplus]: Wrap in extern "C". include: * xregex2.h [__osf__ && __cplusplus] (regoff_t): Alternative typedef. diff --git a/gcc/system.h b/gcc/system.h --- a/gcc/system.h +++ b/gcc/system.h @@ -24,6 +24,10 @@ along with GCC; see the file COPYING3. #ifndef GCC_SYSTEM_H #define GCC_SYSTEM_H +#ifdef __cplusplus +extern "C" { +#endif + /* We must include stdarg.h before stdio.h. */ #include @@ -969,4 +973,8 @@ helper_const_non_const_cast (const char #define DEBUG_VARIABLE #endif +#ifdef __cplusplus +} +#endif + #endif /* ! GCC_SYSTEM_H */ diff --git a/include/xregex2.h b/include/xregex2.h --- a/include/xregex2.h +++ b/include/xregex2.h @@ -399,7 +399,11 @@ struct re_pattern_buffer typedef struct re_pattern_buffer regex_t; /* Type for byte offsets within the string. POSIX mandates this. */ +#if defined(__osf__) && defined(__cplusplus) +typedef off_t regoff_t; +#else typedef int regoff_t; +#endif /* This is the structure we store register match data in. See