This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Shorten Windows path
- From: Ian Lance Taylor <iant at google dot com>
- To: Joey Ye <joey dot ye at arm dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 25 Apr 2014 06:53:30 -0700
- Subject: Re: [patch] Shorten Windows path
- Authentication-results: sourceware.org; auth=none
- References: <000a01cf4808$67f71ce0$37e556a0$ at arm dot com> <CAKOQZ8wOiFwKA7BpA4bmo8HsxmWsvJY2TP8dCsJb+0nLNLKVKw at mail dot gmail dot com> <002301cf606f$6a0d3300$3e279900$ at arm dot com>
On Fri, Apr 25, 2014 at 3:16 AM, Joey Ye <joey.ye@arm.com> wrote:
> Ping
To be clear, I am not a libcpp maintainer and I don't plan to approve
this patch. This should be reviewed by a libcpp maintainer or a C or
C++ frontend maintainer.
Ian
>> -----Original Message-----
>> From: Joey Ye [mailto:joey.ye@arm.com]
>> Sent: Tuesday, April 01, 2014 6:18 PM
>> To: 'Ian Lance Taylor'
>> Cc: gcc-patches
>> Subject: RE: [patch] Shorten Windows path
>>
>> Ian, thanks for your comments. Please find answers and new version below:
>>
>> > -----Original Message-----
>> > From: Ian Lance Taylor [mailto:iant@google.com]
>> > Sent: 25 March 2014 21:09
>> > To: Joey Ye
>> > Cc: gcc-patches
>> > Subject: Re: [patch] Shorten Windows path
>> >
>> > On Tue, Mar 25, 2014 at 1:58 AM, Joey Ye <joey.ye@arm.com> wrote:
>> > > Ping
>> >
>> > This code looks different on mainline.
>> >
>> > Writing "if ( do_canonical )" is not GCC style.
>> Fixed
>> >
>> > This patch does not respect the configure option --disable-canonical-
>> system-
>> > headers.
>> Solved by put is under the control of default
>> ENABLE_CANONICAL_SYSTEM_HEADERS
>> >
>> > Also I personally don't actually know what the consequences would be.
>> > Are there any downsides to canonicalizing header names?
>> Since 4.8 system headers are by default canonicalized. This version only
>> additionally canonical non-system headers. I can't think of any downsides.
>>
>> >
>> > Ian
>>
>> ChangeLog.libcpp:
>>
>> * files.c (find_file_in_dir): Always try to shorten for DOS non-system
>> headers.
>> * init.c (ENABLE_CANONICAL_SYSTEM_HEADERS): Default enabled for DOS.
>>
>> diff --git a/libcpp/files.c b/libcpp/files.c
>> index 7e88778..ad68682 100644
>> --- a/libcpp/files.c
>> +++ b/libcpp/files.c
>> @@ -387,8 +387,14 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file,
>> bool *invalid_pch)
>> char *copy;
>> void **pp;
>>
>> - /* We try to canonicalize system headers. */
>> - if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp)
>> + /* We try to canonicalize system headers. For DOS based file
>> + * system, we always try to shorten non-system headers, as DOS
>> + * has a tighter constraint on max path length. */
>> + if (CPP_OPTION (pfile, canonical_system_headers) && file->dir->sysp
>> +#ifdef HAVE_DOS_BASED_FILE_SYSTEM
>> + || !file->dir->sysp
>> +#endif
>> + )
>> {
>> char * canonical_path = maybe_shorter_path (path);
>> if (canonical_path)
>> diff --git a/libcpp/init.c b/libcpp/init.c
>> index f10413a..b809515 100644
>> --- a/libcpp/init.c
>> +++ b/libcpp/init.c
>> @@ -27,8 +27,12 @@ along with this program; see the file COPYING3. If not
>> see
>> #include "filenames.h"
>>
>> #ifndef ENABLE_CANONICAL_SYSTEM_HEADERS
>> +#ifdef HAVE_DOS_BASED_FILE_SYSTEM
>> +#define ENABLE_CANONICAL_SYSTEM_HEADERS 1
>> +#else
>> #define ENABLE_CANONICAL_SYSTEM_HEADERS 0
>> #endif
>> +#endif
>>
>> static void init_library (void);
>> static void mark_named_operators (cpp_reader *, int);
>
>