From: ian Date: Tue, 17 Jan 2012 19:50:59 +0000 (+0000) Subject: compiler: Don't use import path for ./ or ../ imports. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=487ecfe987fa0a567e39bc153975326099bff014;hp=2e851bb8acd6ed85d5f9769a4d522dd0acca046a compiler: Don't use import path for ./ or ../ imports. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183261 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc index a62069e8e23..fc9c1505c13 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::const_iterator p = search_path.begin(); p != search_path.end();