[Go] Adjust last patch to avoid write-after-write data race on global

variable.  Only set the variable if another global variable is true,
but that variable is always false.  The effect is that the variable is
never written, but as far as the compiler is concerned it might escape.
This commit is contained in:
Ian Lance Taylor 2014-10-14 10:05:43 -07:00
commit 0577ff2220
2 changed files with 41 additions and 14 deletions

View file

@ -225,6 +225,16 @@ type _ unsafe.Pointer
%}
/* Swig_always_false is used to conditionally assign parameters to
Swig_escape_val so that the compiler thinks that they escape. We
only assign them if Swig_always_false is true, which it never is.
We export the variable so that the compiler doesn't realize that it
is never set. */
%insert(go_header) %{
var Swig_escape_always_false bool
var Swig_escape_val interface{}
%}
/* Function pointers are translated by the code in go.cxx into
_swig_fnptr. Member pointers are translated to _swig_memberptr. */