From ba049db40b5a4400fc19a72d9178df92ffcbc203 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Dec 2013 17:37:55 -0800 Subject: [PATCH] Remove Go -longsize option. --- CHANGES.current | 10 ++++--- Doc/Manual/Go.html | 11 ++------ .../test-suite/go/template_opaque_runme.go | 2 +- Examples/test-suite/go/wrapmacro_runme.go | 4 +-- Lib/go/go.swg | 27 ------------------- Source/Modules/go.cxx | 16 +---------- 6 files changed, 13 insertions(+), 57 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 4691d65d7..f7a882aa1 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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. diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html index 87e224aee..43bfc6971 100644 --- a/Doc/Manual/Go.html +++ b/Doc/Manual/Go.html @@ -148,13 +148,6 @@ swig -go -help ignored. - --long-type-size <s> -Set the size for the C/C++ type long. This controls - whether long is converted to the Go type int32 - or int64. The <s> argument should be 32 or 64. - -

22.2.2 Go Output Files

@@ -501,12 +494,12 @@ uses a given C/C++ type. long -int32 or int64, depending on -long-type-size +int64 unsigned long -uint32 or uint64, depending on -long-type-size +uint64 diff --git a/Examples/test-suite/go/template_opaque_runme.go b/Examples/test-suite/go/template_opaque_runme.go index c22b71946..201f7ba16 100644 --- a/Examples/test-suite/go/template_opaque_runme.go +++ b/Examples/test-suite/go/template_opaque_runme.go @@ -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) } diff --git a/Examples/test-suite/go/wrapmacro_runme.go b/Examples/test-suite/go/wrapmacro_runme.go index 4d3791be8..dc7e7bf5b 100644 --- a/Examples/test-suite/go/wrapmacro_runme.go +++ b/Examples/test-suite/go/wrapmacro_runme.go @@ -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) } diff --git a/Lib/go/go.swg b/Lib/go/go.swg index 3408f422e..b9086caac 100644 --- a/Lib/go/go.swg +++ b/Lib/go/go.swg @@ -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 & "" diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx index 6db099662..3dec6503b 100644 --- a/Source/Modules/go.cxx +++ b/Source/Modules/go.cxx @@ -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

- Like gccgo -fgo-pkgpath option\n\ -go-prefix

- Like gccgo -fgo-prefix option\n\ - -longsize - Set size of C/C++ long type--32 or 64 bits\n\ -intgosize - Set size of Go int type--32 or 64 bits\n\ -package - Set name of the Go package to \n\ -use-shlib - Force use of a shared library\n\