aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-10-16 19:28:51 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-10-16 19:28:51 +0000
commitada24741761fd8b041c75634829acf1525b8d597 (patch)
tree5892f9f195d7f6a61ac0decb83a70534a65387bd /gcc
parentf6e31dffc122fc91ca33a9b43ab8b5051585b979 (diff)
downloadgcc-ada24741761fd8b041c75634829acf1525b8d597.zip
gcc-ada24741761fd8b041c75634829acf1525b8d597.tar.gz
gcc-ada24741761fd8b041c75634829acf1525b8d597.tar.bz2
compiler: Don't record interface types with blank type names.
Fixes issue 8079. From-SVN: r216343
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/parse.cc15
-rw-r--r--gcc/go/gofrontend/parse.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index b24de60..09369e0 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -245,7 +245,7 @@ Parse::type()
|| token->is_op(OPERATOR_CHANOP))
return this->channel_type();
else if (token->is_keyword(KEYWORD_INTERFACE))
- return this->interface_type();
+ return this->interface_type(true);
else if (token->is_keyword(KEYWORD_FUNC))
{
Location location = token->location();
@@ -1179,7 +1179,7 @@ Parse::block()
// MethodSpecList = MethodSpec { ";" MethodSpec } [ ";" ] .
Type*
-Parse::interface_type()
+Parse::interface_type(bool record)
{
go_assert(this->peek_token()->is_keyword(KEYWORD_INTERFACE));
Location location = this->location();
@@ -1227,7 +1227,8 @@ Parse::interface_type()
}
Interface_type* ret = Type::make_interface_type(methods, location);
- this->gogo_->record_interface_type(ret);
+ if (record)
+ this->gogo_->record_interface_type(ret);
return ret;
}
@@ -1526,7 +1527,13 @@ Parse::type_spec(void*)
}
Type* type;
- if (!this->peek_token()->is_op(OPERATOR_SEMICOLON))
+ if (name == "_" && this->peek_token()->is_keyword(KEYWORD_INTERFACE))
+ {
+ // We call Parse::interface_type explicity here because we do not want
+ // to record an interface with a blank type name.
+ type = this->interface_type(false);
+ }
+ else if (!this->peek_token()->is_op(OPERATOR_SEMICOLON))
type = this->type();
else
{
diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h
index 86698a1..3749645 100644
--- a/gcc/go/gofrontend/parse.h
+++ b/gcc/go/gofrontend/parse.h
@@ -182,7 +182,7 @@ class Parse
void parameter_decl(bool, Typed_identifier_list*, bool*, bool*, bool*);
bool result(Typed_identifier_list**);
Location block();
- Type* interface_type();
+ Type* interface_type(bool record);
void method_spec(Typed_identifier_list*);
void declaration();
bool declaration_may_start_here();