Patchwork [gccgo] gofrontend fixes for building with --enable-build-with-cxx

login
register
mail settings
Submitter Ian Taylor
Date Nov. 11, 2010, 11:03 p.m.
Message ID <mcrk4kjpinb.fsf@google.com>
Download mbox | patch
Permalink /patch/70889/
State New
Headers show

Comments

Ian Taylor - Nov. 11, 2010, 11:03 p.m.
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

Patch

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 <gmp.h>
 
+#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 <gmp.h>
 
+#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 <cstring>
 #include <unistd.h>
 
+#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 <tr1/unordered_set>
 #include <gmp.h>
 
+#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 <gmp.h>
 
+#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"