From patchwork Tue Apr 1 10:17:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 335733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4739C14007E for ; Tue, 1 Apr 2014 21:17:38 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=UhMbfXLEGYpQg20YiJQjWTl4amaeSAkttV4Mdq7zKMMx0P/JZcQDZ KVq9uARjfSJoU9NGgxvhBJAfGqTmBTBBTSTESKBt5hRwmuv+NVeTQbtUPRSD0up4 PUqlwux85/531x/AcS2ALsQvmjH+zm6L1UwdljfLsgBwJZwHMmPx8o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=wJysatB1uIPResxpXlOTAx17Zmw=; b=Ugd7+78OTkC23UmXIAxmnMk/KYj9 /APRlAoQI/cdriqqhQtrwzco9XBqRe/rDXliXTm/FTWVXcPUr/B5A0um3D9pbLS6 d7xbYOVO3+8ynVNJOMpBviqplOObqSWYnHkDV3ZxeKy/k+6Es8Z4we1rmBCCSJEO tJoz+YAj8VYllPw= Received: (qmail 15987 invoked by alias); 1 Apr 2014 10:17:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15973 invoked by uid 89); 1 Apr 2014 10:17:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Apr 2014 10:17:29 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 01 Apr 2014 11:17:26 +0100 Received: from SHAWIN205 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 1 Apr 2014 11:17:40 +0100 From: "Joey Ye" To: "'Ian Lance Taylor'" Cc: "gcc-patches" References: <000a01cf4808$67f71ce0$37e556a0$@arm.com> In-Reply-To: Subject: RE: [patch] Shorten Windows path Date: Tue, 1 Apr 2014 18:17:36 +0800 Message-ID: <000601cf4d93$9c975b50$d5c611f0$@arm.com> MIME-Version: 1.0 X-MC-Unique: 114040111172606901 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 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);