diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 7 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 13 |
3 files changed, 21 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 6e5d3c4..092baa2 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -e51657a576367c7a498c94baf985b79066fc082a +f3fb9bf2d5a009a707962a416fcd1a8435756218 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 5342e45..64b0d3c 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -3787,6 +3787,13 @@ Unary_expression::do_flatten(Gogo* gogo, Named_object*, if ((n->encoding() & ESCAPE_MASK) == int(Node::ESCAPE_NONE)) this->escapes_ = false; + // When compiling the runtime, the address operator does not + // cause local variables to escapes. When escape analysis + // becomes the default, this should be changed to make it an + // error if we have an address operator that escapes. + if (gogo->compiling_runtime() && gogo->package_name() == "runtime") + this->escapes_ = false; + Named_object* var = NULL; if (this->expr_->var_expression() != NULL) var = this->expr_->var_expression()->named_object(); diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 587ebd4..30392f7 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -4480,6 +4480,19 @@ Gogo::write_c_header() ++p) { Named_object* no = *p; + + // Skip names that start with underscore followed by something + // other than an uppercase letter, as when compiling the runtime + // package they are mostly types defined by mkrsysinfo.sh based + // on the C system header files. We don't need to translate + // types to C and back to Go. But do accept the special cases + // _defer and _panic. + std::string name = Gogo::unpack_hidden_name(no->name()); + if (name[0] == '_' + && (name[1] < 'A' || name[1] > 'Z') + && (name != "_defer" && name != "_panic")) + continue; + if (no->is_type() && no->type_value()->struct_type() != NULL) types.push_back(no); if (no->is_const() && no->const_value()->type()->integer_type() != NULL) |