aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-01-17 19:50:59 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-01-17 19:50:59 +0000
commitcd2705aadedff9e94b72b66cfc1e45937bec8602 (patch)
treea0a6fd9e1a1f4e8dac8c30dc39b7afb77455101f /gcc
parentee3d2ecdc509868214e682f4192cf7047d57a78d (diff)
downloadgcc-cd2705aadedff9e94b72b66cfc1e45937bec8602.zip
gcc-cd2705aadedff9e94b72b66cfc1e45937bec8602.tar.gz
gcc-cd2705aadedff9e94b72b66cfc1e45937bec8602.tar.bz2
compiler: Don't use import path for ./ or ../ imports.
From-SVN: r183261
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/import.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc
index a62069e..fc9c150 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -42,8 +42,8 @@ const char* const Import::import_marker = "*imported*";
// returns a pointer to a Stream object to read the data that it
// exports. If the file is not found, it returns NULL.
-// When FILENAME is not an absolute path, we use the search path
-// provided by -I and -L options.
+// When FILENAME is not an absolute path and does not start with ./ or
+// ../, we use the search path provided by -I and -L options.
// When FILENAME does not exist, we try modifying FILENAME to find the
// file. We use the first of these which exists:
@@ -61,7 +61,18 @@ const char* const Import::import_marker = "*imported*";
Import::Stream*
Import::open_package(const std::string& filename, Location location)
{
- if (!IS_ABSOLUTE_PATH(filename))
+ bool is_local;
+ if (IS_ABSOLUTE_PATH(filename))
+ is_local = true;
+ else if (filename[0] == '.' && IS_DIR_SEPARATOR(filename[1]))
+ is_local = true;
+ else if (filename[0] == '.'
+ && filename[1] == '.'
+ && IS_DIR_SEPARATOR(filename[2]))
+ is_local = true;
+ else
+ is_local = false;
+ if (!is_local)
{
for (std::vector<std::string>::const_iterator p = search_path.begin();
p != search_path.end();