From patchwork Thu Nov 11 23:03:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 70889 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 074B8B7144 for ; Fri, 12 Nov 2010 10:04:15 +1100 (EST) Received: (qmail 26457 invoked by alias); 11 Nov 2010 23:04:06 -0000 Received: (qmail 26302 invoked by uid 22791); 11 Nov 2010 23:04:04 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, TW_CX, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Nov 2010 23:03:59 +0000 Received: from kpbe16.cbf.corp.google.com (kpbe16.cbf.corp.google.com [172.25.105.80]) by smtp-out.google.com with ESMTP id oABN3vhn007676 for ; Thu, 11 Nov 2010 15:03:57 -0800 Received: from pxi2 (pxi2.prod.google.com [10.243.27.2]) by kpbe16.cbf.corp.google.com with ESMTP id oABN3ckb020982 for ; Thu, 11 Nov 2010 15:03:55 -0800 Received: by pxi2 with SMTP id 2so585257pxi.12 for ; Thu, 11 Nov 2010 15:03:55 -0800 (PST) Received: by 10.142.166.13 with SMTP id o13mr1249522wfe.253.1289516635545; Thu, 11 Nov 2010 15:03:55 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id w42sm2968639wfh.3.2010.11.11.15.03.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 11 Nov 2010 15:03:54 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] gofrontend fixes for building with --enable-build-with-cxx Date: Thu, 11 Nov 2010 15:03:52 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true 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 This patch to the Go frontend fixes it for building with --enable-build-with-cxx. extern "C" is only used if --enable-build-with-cxx was not used. Committed to gccgo branch. Ian diff -r 6fe98b6297c5 go/export.cc --- a/go/export.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/export.cc Thu Nov 11 15:01:36 2010 -0800 @@ -9,12 +9,18 @@ #include "go-system.h" #include "sha1.h" +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "machmode.h" #include "output.h" #include "target.h" + +#ifndef ENABLE_BUILD_WITH_CXX } +#endif #include "gogo.h" #include "types.h" diff -r 6fe98b6297c5 go/expressions.cc --- a/go/expressions.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/expressions.cc Thu Nov 11 15:01:36 2010 -0800 @@ -8,8 +8,11 @@ #include +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "toplev.h" #include "intl.h" #include "tree.h" @@ -19,7 +22,10 @@ #include "real.h" #include "realmpfr.h" #include "tm_p.h" -} + +#ifndef ENABLE_BUILD_WITH_CXX +} +#endif #include "go-c.h" #include "gogo.h" diff -r 6fe98b6297c5 go/go-dump.cc --- a/go/go-dump.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/go-dump.cc Thu Nov 11 15:01:36 2010 -0800 @@ -47,7 +47,7 @@ // Enable a dump. Return 1 if this is a real name, 0 if not. -extern "C" +GO_EXTERN_C int go_enable_dump(const char* name) { diff -r 6fe98b6297c5 go/go.cc --- a/go/go.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/go.cc Thu Nov 11 15:01:36 2010 -0800 @@ -26,7 +26,7 @@ // Create the main IR data structure. -extern "C" +GO_EXTERN_C void go_create_gogo() { @@ -38,7 +38,7 @@ // Set the unique prefix we use for exported symbols. -extern "C" +GO_EXTERN_C void go_set_prefix(const char* arg) { @@ -58,7 +58,7 @@ // Parse the input files. -extern "C" +GO_EXTERN_C void go_parse_input_files(const char** filenames, unsigned int filename_count) { @@ -139,7 +139,7 @@ // Write out globals. -extern "C" +GO_EXTERN_C void go_write_globals() { diff -r 6fe98b6297c5 go/gogo-tree.cc --- a/go/gogo-tree.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/gogo-tree.cc Thu Nov 11 15:01:36 2010 -0800 @@ -11,8 +11,11 @@ #include +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "toplev.h" #include "tree.h" #include "gimple.h" @@ -24,7 +27,10 @@ #include "tm_p.h" #include "diagnostic.h" #include "rtl.h" + +#ifndef ENABLE_BUILD_WITH_CXX } +#endif #include "go-c.h" #include "types.h" @@ -1963,7 +1969,7 @@ // Return the integer type to use for a size. -extern "C" +GO_EXTERN_C tree go_type_for_size(unsigned int bits, int unsignedp) { @@ -1994,7 +2000,7 @@ // Return the type to use for a mode. -extern "C" +GO_EXTERN_C tree go_type_for_mode(enum machine_mode mode, int unsignedp) { diff -r 6fe98b6297c5 go/import.cc --- a/go/import.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/import.cc Thu Nov 11 15:01:36 2010 -0800 @@ -10,10 +10,16 @@ #include #include +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "filenames.h" + +#ifndef ENABLE_BUILD_WITH_CXX } +#endif #include "simple-object.h" @@ -30,7 +36,7 @@ // Add a directory to the search path. This is called from the option // handling language hook. -extern "C" +GO_EXTERN_C void go_add_search_path(const char* path) { diff -r 6fe98b6297c5 go/statements.cc --- a/go/statements.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/statements.cc Thu Nov 11 15:01:36 2010 -0800 @@ -9,8 +9,11 @@ #include #include +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "intl.h" #include "tree.h" #include "gimple.h" @@ -18,7 +21,10 @@ #include "tree-iterator.h" #include "tree-flow.h" #include "real.h" + +#ifndef ENABLE_BUILD_WITH_CXX } +#endif #include "go-c.h" #include "types.h" diff -r 6fe98b6297c5 go/types.cc --- a/go/types.cc Wed Nov 10 21:50:23 2010 -0800 +++ b/go/types.cc Thu Nov 11 15:01:36 2010 -0800 @@ -10,15 +10,21 @@ #include +#ifndef ENABLE_BUILD_WITH_CXX extern "C" { +#endif + #include "toplev.h" #include "intl.h" #include "tree.h" #include "gimple.h" #include "real.h" #include "convert.h" -} + +#ifndef ENABLE_BUILD_WITH_CXX +} +#endif #include "go-c.h" #include "gogo.h"