aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-02-23 04:57:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-02-23 04:57:01 +0000
commit8c88f9c957d844c03113bd70100329d2314a9874 (patch)
treeb4f90928d5bf554bbabc10e21ac50cf2dd3974ae /gcc/go
parentb68a9b10c8081a0e4b4811bbbbfa39749d167c09 (diff)
downloadgcc-8c88f9c957d844c03113bd70100329d2314a9874.zip
gcc-8c88f9c957d844c03113bd70100329d2314a9874.tar.gz
gcc-8c88f9c957d844c03113bd70100329d2314a9874.tar.bz2
Traverse erroneous function redefinitions.
From-SVN: r170428
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/gogo.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 0be8c66..b062c54 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -682,10 +682,15 @@ Gogo::start_function(const std::string& name, Function_type* type,
else if (!type->is_method())
{
ret = this->package_->bindings()->add_function(*pname, NULL, function);
- if (!ret->is_function())
+ if (!ret->is_function() || ret->func_value() != function)
{
- // Redefinition error.
- ret = Named_object::make_function(name, NULL, function);
+ // Redefinition error. Invent a name to avoid knockon
+ // errors.
+ static int redefinition_count;
+ char buf[30];
+ snprintf(buf, sizeof buf, ".$redefined%d", redefinition_count);
+ ++redefinition_count;
+ ret = this->package_->bindings()->add_function(buf, NULL, function);
}
}
else