public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joey Ye" <joey.ye@arm.com>
To: <gcc-patches@gcc.gnu.org>,	"Ian Lance Taylor" <iant@google.com>
Subject: [patch] Shorten Windows path
Date: Wed, 19 Feb 2014 07:45:00 -0000	[thread overview]
Message-ID: <000001cf2d46$85948ee0$90bdaca0$@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Max length of path on Windows is 255, which is easy to exceed in a
complicated project. Ultimate solution may be complex but canonizing the
path and skipping the ".."s in path is helpful.

Relative discussion in gcc-patches:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00582.html

OK to trunk stage 1?

ChangeLog.libcpp:
    * files.c (find_file_in_dir): Always try to shorten for DOS.

diff --git a/libcpp/files.c b/libcpp/files.c
index 7e88778..9dcc71f 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -386,9 +386,18 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file,
bool *invalid_pch)
       hashval_t hv;
       char *copy;
       void **pp;
+      bool do_canonical;
 
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+      /* For DOS based file system, we always try to shorten file path
+       * to as it has a shorter constraint on max path length.  */
+      do_canonical = true;
+#else
       /* We try to canonicalize system headers.  */
-      if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp)
+      do_canonical = (CPP_OPTION (pfile, canonical_system_headers)
+                      && file->dir->sysp);
+#endif
+      if ( do_canonical )
 	{
 	  char * canonical_path = maybe_shorter_path (path);
 	  if (canonical_path)

[-- Attachment #2: max_path_joey-140109-1.patch --]
[-- Type: application/octet-stream, Size: 866 bytes --]

diff --git a/libcpp/files.c b/libcpp/files.c
index 7e88778..9dcc71f 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -386,9 +386,18 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch)
       hashval_t hv;
       char *copy;
       void **pp;
+      bool do_canonical;
 
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+      /* For DOS based file system, we always try to shorten file path
+       * to as it has a shorter constraint on max path length.  */
+      do_canonical = true;
+#else
       /* We try to canonicalize system headers.  */
-      if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp)
+      do_canonical = (CPP_OPTION (pfile, canonical_system_headers)
+                      && file->dir->sysp);
+#endif
+      if ( do_canonical )
 	{
 	  char * canonical_path = maybe_shorter_path (path);
 	  if (canonical_path)

             reply	other threads:[~2014-02-19  7:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19  7:45 Joey Ye [this message]
2014-03-25  9:06 Joey Ye
2014-03-25 13:18 ` Ian Lance Taylor
2014-04-01 10:17   ` Joey Ye
2014-06-04 18:45     ` Meador Inge
2014-04-25 10:28   ` Joey Ye
2014-04-25 13:58     ` Ian Lance Taylor
2014-05-09  6:30     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001cf2d46$85948ee0$90bdaca0$@arm.com' \
    --to=joey.ye@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).