[Go] Ensure structs are properly packed between gc and GCC/clang.

From https://github.com/swig/swig/pull/262.
This commit is contained in:
Ian Lance Taylor 2016-01-27 15:51:13 -08:00
commit 15b75a74c5
3 changed files with 26 additions and 5 deletions

View file

@ -2160,7 +2160,7 @@ private:
Delete(ct);
Delete(ln);
}
Printv(swigargs, "\t} *swig_a = (struct swigargs *) swig_v;\n", NULL);
Printv(swigargs, "\t} SWIGSTRUCTPACKED *swig_a = (struct swigargs *) swig_v;\n", NULL);
// Copy the input arguments out of the structure into the Go local
// variables.
@ -3982,7 +3982,7 @@ private:
Printv(f_c_directors, director_sig, NULL);
if (!gccgo_flag) {
Printv(f_c_directors, " struct { intgo p; } a;\n", NULL);
Printv(f_c_directors, " struct { intgo p; } SWIGSTRUCTPACKED a;\n", NULL);
Printv(f_c_directors, " a.p = go_val;\n", NULL);
Printv(f_c_directors, " crosscall2(", wname, ", &a, (int) sizeof a);\n", NULL);
@ -5116,7 +5116,7 @@ private:
Delete(rname);
}
Printv(w->code, " } swig_a;\n", NULL);
Printv(w->code, " } SWIGSTRUCTPACKED swig_a;\n", NULL);
Printv(w->code, " swig_a.go_val = go_val;\n", NULL);
p = parms;