Remove Go -longsize option.

This commit is contained in:
Ian Lance Taylor 2013-12-17 17:37:55 -08:00
commit ba049db40b
6 changed files with 13 additions and 57 deletions

View file

@ -5,15 +5,19 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.0 (in progress)
============================
2013-12-17: iant
2013-12-17: ianlancetaylor
[Go] Remove -longsize option (for backward compatibility,
ignore it if seen).
2013-12-17: ianlancetaylor
[Go] Add -go-pkgpath option.
2013-12-16: iant
2013-12-16: ianlancetaylor
[Go] Update for Go 1.2 release. Add support for linking
SWIG code directly into executable, rather than using a
shared library.
2013-12-13: iant
2013-12-13: ianlancetaylor
[Go] Add SWIG source file name as comments in generated
files. This can be used by Go documentation tools.

View file

@ -148,13 +148,6 @@ swig -go -help
ignored.</td>
</tr>
<tr>
<td>-long-type-size &lt;s&gt;</td>
<td>Set the size for the C/C++ type <tt>long</tt>. This controls
whether <tt>long</tt> is converted to the Go type <tt>int32</tt>
or <tt>int64</tt>. The &lt;s&gt; argument should be 32 or 64.</td>
</tr>
</table>
<H3><a name="Go_outputs"></a>22.2.2 Go Output Files</H3>
@ -501,12 +494,12 @@ uses a given C/C++ type.
<tr>
<td>long</td>
<td>int32 or int64, depending on <tt>-long-type-size</tt></td>
<td>int64</td>
</tr>
<tr>
<td>unsigned long</td>
<td>uint32 or uint64, depending on <tt>-long-type-size</tt></td>
<td>uint64</td>
</tr>
<tr>

View file

@ -3,7 +3,7 @@ package main
import "./template_opaque"
func main() {
v := template_opaque.NewOpaqueVectorType(10)
v := template_opaque.NewOpaqueVectorType(int64(10))
template_opaque.FillVector(v)
}

View file

@ -5,7 +5,7 @@ import "./wrapmacro"
func main() {
a := 2
b := -1
wrapmacro.Maximum(a, b)
wrapmacro.Maximum(a/7.0, -b*256)
wrapmacro.Maximum(int64(a), int64(b))
wrapmacro.Maximum(float64(a/7.0), float64(-b*256))
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1)
}

View file

@ -14,15 +14,8 @@
%typemap(gotype) unsigned short, const unsigned short & "uint16"
%typemap(gotype) int, const int & "int"
%typemap(gotype) unsigned int, const unsigned int & "uint"
#if SWIGGO_LONG_TYPE_SIZE == 32
%typemap(gotype) long, const long & "int32"
%typemap(gotype) unsigned long, const unsigned long & "uint32"
#elif SWIGGO_LONG_TYPE_SIZE == 64
%typemap(gotype) long, const long & "int64"
%typemap(gotype) unsigned long, const unsigned long & "uint64"
#else
#error "SWIGGO_LONG_TYPE_SIZE not 32 or 64"
#endif
%typemap(gotype) long long, const long long & "int64"
%typemap(gotype) unsigned long long, const unsigned long long & "uint64"
%typemap(gotype) float, const float & "float32"
@ -163,11 +156,7 @@
/* The size_t type. */
#if SWIGGO_LONG_TYPE_SIZE == 32
%typemap(gotype) size_t, const size_t & %{int%}
#else
%typemap(gotype) size_t, const size_t & %{int64%}
#endif
%typemap(in) size_t
%{ $1 = (size_t)$input; %}
@ -486,32 +475,16 @@
const unsigned int &
""
#if SWIGGO_LONG_TYPE_SIZE == 32
%typecheck(SWIG_TYPECHECK_INT32) /* Go int32 */
long,
const long &
""
%typecheck(SWIG_TYPECHECK_INT32) /* Go uint32 */
unsigned long,
const unsigned long &
""
#endif
%typecheck(SWIG_TYPECHECK_INT64) /* Go int64 */
#if SWIGGO_LONG_TYPE_SIZE == 64
long,
const long &,
#endif
long long,
const long long &
""
%typecheck(SWIG_TYPECHECK_INT64) /* Go uint64 */
#if SWIGGO_LONG_TYPE_SIZE == 64
unsigned long,
const unsigned long &,
#endif
unsigned long long,
const unsigned long long &
""

View file

@ -30,8 +30,6 @@ class GO:public Language {
bool use_shlib;
// Name of shared library to import.
String *soname;
// Size in bits of the C type "long".
int long_type_size;
// Size in bits of the Go type "int". 0 if not specified.
int intgo_type_size;
@ -96,7 +94,6 @@ public:
pkgpath_option(NULL),
use_shlib(false),
soname(NULL),
long_type_size(32),
intgo_type_size(0),
f_c_begin(NULL),
f_go_begin(NULL),
@ -184,12 +181,8 @@ private:
Swig_arg_error();
}
} else if (strcmp(argv[i], "-longsize") == 0) {
// Ignore for backward compatibility.
if (argv[i + 1]) {
long_type_size = atoi(argv[i + 1]);
if (long_type_size != 32 && long_type_size != 64) {
Printf(stderr, "-longsize not 32 or 64\n");
Swig_arg_error();
}
Swig_mark_arg(i);
Swig_mark_arg(i + 1);
++i;
@ -227,12 +220,6 @@ private:
Preprocessor_define("SWIGGO_GCCGO 1", 0);
}
if (long_type_size == 32) {
Preprocessor_define("SWIGGO_LONG_TYPE_SIZE 32", 0);
} else {
Preprocessor_define("SWIGGO_LONG_TYPE_SIZE 64", 0);
}
// This test may be removed in the future, when we can assume that
// everybody has upgraded to Go 1.1. The code below is prepared
// for this test to simply be taken out.
@ -4967,7 +4954,6 @@ Go Options (available with -go)\n\
-gccgo - Generate code for gccgo rather than 6g/8g\n\
-go-pkgpath <p> - Like gccgo -fgo-pkgpath option\n\
-go-prefix <p> - Like gccgo -fgo-prefix option\n\
-longsize <s> - Set size of C/C++ long type--32 or 64 bits\n\
-intgosize <s> - Set size of Go int type--32 or 64 bits\n\
-package <name> - Set name of the Go package to <name>\n\
-use-shlib - Force use of a shared library\n\