Remove support for using gccgo 4.6 as the Go compiler. Gccgo 4.7

works, as does the more commonly used gc compiler.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13031 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Ian Lance Taylor 2012-05-02 18:10:45 +00:00
commit c9d8e6720b
4 changed files with 19 additions and 57 deletions

View file

@ -3,6 +3,11 @@ SWIG (Simplified Wrapper and Interface Generator)
See the CHANGES.current file for changes in the current version.
See the RELEASENOTES file for a summary of changes in each release.
2012-05-02: ianlancetaylor
[Go] Remove compatibility support for gccgo 4.6. Using
SWIG with gccgo will now require gccgo 4.7. Using SWIG
with the more commonly used gc compiler is unaffected.
Version 2.0.6 (30 April 2012)
=============================

View file

@ -99,19 +99,6 @@ swig -go -help
6g/8g/5g.</td>
</tr>
<tr>
<td>-gccgo-46</td>
<td>Generate code for gccgo 4.6. The default is set by the configure
script. This generates code that does not use some facilities
that are only available in gccgo 4.7 and later.</td>
</tr>
<tr>
<td>-no-gccgo-46</td>
<td>Turn off <code>-gccgo-46</code>, whether set by default or earlier
on the command line.
</tr>
<tr>
<td>-package &lt;name&gt;</td>
<td>Set the name of the Go package to &lt;name&gt;. The default

View file

@ -13,12 +13,6 @@ char cvsroot_go_cxx[] = "$Id";
#include "cparse.h"
#include <ctype.h>
#ifdef HAVE_GCCGO_46
#define GCCGO_46_DEFAULT true
#else
#define GCCGO_46_DEFAULT false
#endif
class GO:public Language {
static const char *const usage;
@ -26,8 +20,6 @@ class GO:public Language {
String *package;
// Flag for generating gccgo output.
bool gccgo_flag;
// Flag for generating gccgo 4.6 output.
bool gccgo_46_flag;
// Prefix to use with gccgo.
String *go_prefix;
// Name of shared library to import.
@ -90,7 +82,6 @@ class GO:public Language {
public:
GO():package(NULL),
gccgo_flag(false),
gccgo_46_flag(GCCGO_46_DEFAULT),
go_prefix(NULL),
soname(NULL),
long_type_size(32),
@ -148,12 +139,6 @@ private:
} else if (strcmp(argv[i], "-gccgo") == 0) {
Swig_mark_arg(i);
gccgo_flag = true;
} else if (strcmp(argv[i], "-gccgo-46") == 0) {
Swig_mark_arg(i);
gccgo_46_flag = true;
} else if (strcmp(argv[i], "-no-gccgo-46") == 0) {
Swig_mark_arg(i);
gccgo_46_flag = false;
} else if (strcmp(argv[i], "-go-prefix") == 0) {
if (argv[i + 1]) {
go_prefix = NewString(argv[i + 1]);
@ -794,7 +779,7 @@ private:
if (needs_wrapper) {
wrapper_name = buildGoWrapperName(name, overname);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "//extern ", go_prefix, "_", wname, "\n", NULL);
}
@ -845,16 +830,12 @@ private:
}
}
if (gccgo_flag && gccgo_46_flag) {
Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", wname, "\")", NULL);
}
Printv(f_go_wrappers, "\n\n", NULL);
}
// Start defining the Go function.
if (!needs_wrapper && gccgo_flag && !gccgo_46_flag) {
if (!needs_wrapper && gccgo_flag) {
Printv(f_go_wrappers, "//extern ", go_prefix, "_", wname, "\n", NULL);
}
@ -959,7 +940,7 @@ private:
}
}
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
}
@ -1003,10 +984,6 @@ private:
}
Printv(f_go_wrappers, ")\n", NULL);
Printv(f_go_wrappers, "}\n", NULL);
} else {
if (gccgo_flag && gccgo_46_flag) {
Printv(f_go_wrappers, " __asm__ (\"", go_prefix, "_", wname, "\")\n", NULL);
}
}
Printv(f_go_wrappers, "\n", NULL);
@ -2522,7 +2499,7 @@ private:
if (!is_ignored) {
// Declare the C++ wrapper.
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "//extern ", go_prefix, "_", wname, "\n", NULL);
}
@ -2541,13 +2518,7 @@ private:
p = nextParm(p);
}
Printv(f_go_wrappers, ") ", go_type_name, NULL);
if (gccgo_flag && gccgo_46_flag) {
Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", wname, "\")", NULL);
}
Printv(f_go_wrappers, "\n\n", NULL);
Printv(f_go_wrappers, ") ", go_type_name, "\n\n", NULL);
Printv(f_go_wrappers, "func ", func_with_over_name, "(v interface{}", NULL);
@ -2566,7 +2537,7 @@ private:
Printv(f_go_wrappers, "\tp := &", director_struct_name, "{0, v}\n", NULL);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
}
@ -3026,7 +2997,7 @@ private:
String *upcall_gc_name = buildGoWrapperName(upcall_name, overname);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "//extern ", go_prefix, "_", upcall_wname, "\n", NULL);
}
@ -3049,10 +3020,6 @@ private:
Delete(tm);
}
if (gccgo_flag && gccgo_46_flag) {
Printv(f_go_wrappers, " __asm__(\"", go_prefix, "_", upcall_wname, "\")", NULL);
}
Printv(f_go_wrappers, "\n", NULL);
// Define the method on the director class in Go.
@ -3082,7 +3049,7 @@ private:
Printv(f_go_wrappers, " {\n", NULL);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
}
@ -3254,7 +3221,7 @@ private:
Printv(f_go_wrappers, " {\n", NULL);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "\tsyscall.Entersyscall()\n", NULL);
Printv(f_go_wrappers, "\tdefer syscall.Exitsyscall()\n", NULL);
}
@ -3301,7 +3268,7 @@ private:
}
Printv(f_go_wrappers, "{\n", NULL);
if (gccgo_flag && !gccgo_46_flag) {
if (gccgo_flag) {
Printv(f_go_wrappers, "\tsyscall.Exitsyscall()\n", NULL);
Printv(f_go_wrappers, "\tdefer syscall.Entersyscall()\n", NULL);
}

View file

@ -2082,9 +2082,12 @@ else
if test -n "$GO" ; then
if $GO --help 2>/dev/null | grep gccgo >/dev/null 2>&1 ; then
GOGCC=true
AC_MSG_CHECKING([whether gccgo version is too old])
go_version=`$GO --version | sed -e 's/[^0-9]* \([0-9.]*\) .*$/\1/' -e 's/[.]//g'`
if test "$go_version" -lt 470; then
AC_DEFINE(HAVE_GCCGO_46, 1, [Define if using gccgo before 4.7.0])
AC_MSG_RESULT([yes - minimum version is 4.7.0])
else
AC_MSG_RESULT([no])
fi
elif test "`echo $GO | sed -e 's|.*/||'`" = "go"; then
GO1=true