aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-08-27 22:41:55 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-08-27 22:41:55 +0000
commit26343eaf9d25412f6deba7eae9117fc5e9bc02cc (patch)
tree045990655e34b3435a5031d1bed792e930c8662a /gcc/go
parentf6a665d39fec278d8b499641a9d0d5014e9194bb (diff)
downloadgcc-26343eaf9d25412f6deba7eae9117fc5e9bc02cc.zip
gcc-26343eaf9d25412f6deba7eae9117fc5e9bc02cc.tar.gz
gcc-26343eaf9d25412f6deba7eae9117fc5e9bc02cc.tar.bz2
compiler: Allow multiple blank label definitions.
Fixes golang/go#12316. Reviewed-on: https://go-review.googlesource.com/13907 From-SVN: r227284
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/gogo.h7
-rw-r--r--gcc/go/gofrontend/statements.cc5
3 files changed, 13 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 4561966..dc519b2 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-a1d2cac484f46068b5a6ddf3e041d425a3d25e0c
+9ae5835a010a55fba875103be5f4e61485a97099
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/gogo.h b/gcc/go/gofrontend/gogo.h
index 374f155..3af2af7 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -2689,6 +2689,8 @@ class Label
void
define(Location location, Bindings_snapshot* snapshot)
{
+ if (this->is_dummy_label())
+ return;
go_assert(Linemap::is_unknown_location(this->location_)
&& this->snapshot_ == NULL);
this->location_ = location;
@@ -2709,6 +2711,11 @@ class Label
static Label*
create_dummy_label();
+ // Return TRUE if this is a dummy label.
+ bool
+ is_dummy_label() const
+ { return this->name_ == "_"; }
+
private:
// The name of the label.
std::string name_;
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 72b41cb..5d102bf 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -3080,6 +3080,11 @@ Label_statement::do_traverse(Traverse*)
Bstatement*
Label_statement::do_get_backend(Translate_context* context)
{
+ if (this->label_->is_dummy_label())
+ {
+ Bexpression* bce = context->backend()->boolean_constant_expression(false);
+ return context->backend()->expression_statement(bce);
+ }
Blabel* blabel = this->label_->get_backend_label(context);
return context->backend()->label_definition_statement(blabel);
}