aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 23:29:49 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 23:29:49 +0000
commit5667638c698a7278aba553815e68226cd8d604d8 (patch)
treed8e649c922b189726921e13e6b4397a2cf445265 /gcc/go
parent3ebb5ca6cc306dd91af6fd129033971a47da6c8c (diff)
downloadgcc-5667638c698a7278aba553815e68226cd8d604d8.zip
gcc-5667638c698a7278aba553815e68226cd8d604d8.tar.gz
gcc-5667638c698a7278aba553815e68226cd8d604d8.tar.bz2
Check for identical package name and prefix in imported package.
From-SVN: r168494
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/gogo.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 6685156..b12eeb7 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -332,6 +332,12 @@ Gogo::import_package(const std::string& filename,
Package* package = imp.import(this, local_name, is_local_name_exported);
if (package != NULL)
{
+ if (package->name() == this->package_name()
+ && package->unique_prefix() == this->unique_prefix())
+ error_at(location,
+ ("imported package uses same package name and prefix "
+ "as package being compiled (see -fgo-prefix option)"));
+
this->imports_.insert(std::make_pair(filename, package));
package->set_is_imported();
}