From patchwork Fri Mar 9 10:13:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 145708 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]) by ozlabs.org (Postfix) with SMTP id 9D643B6ED0 for ; Fri, 9 Mar 2012 21:13:31 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331892812; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:Content-Type:Content-Transfer-Encoding:Subject: Date:Message-Id:To:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=/VlKC5MDD4Klv49uWTiWITaHheA=; b=PTf/LxES5m3AhOY adlvL1knUWTuQjfIQ6Nvt4bAIh19OT+BAqRU2dKSPgD009FgBD0aLPO69/w1+XVq JDNMythiEtWJoofZ0CxUNYaZwZNbxfotlJIWl3Fv0JzImDdsMWhpRab12aEH2LhW CeWnGo73tcN0wN1257VAPQ5EcDoQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wVYGNYEj2JtkdrniP/A2tessvNsowjcyQnN1TRKTLNeWvKHgArGHGKwLfMgiu4 axwcafVKoXp8vrpDuuYVSXw+9lNS0CbT6Olwb4dtAYJtZx2oOoAmtniXKOrkS8l/ 7kEcvuKTaKx2gcfiF7zZzytddKgckZkIO7/wTaiPUe348=; Received: (qmail 12513 invoked by alias); 9 Mar 2012 10:13:20 -0000 Received: (qmail 12503 invoked by uid 22791); 9 Mar 2012 10:13:18 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_CP X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Mar 2012 10:13:05 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C4A35290031 for ; Fri, 9 Mar 2012 11:13:05 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2bWwhMhBuKqg for ; Fri, 9 Mar 2012 11:13:05 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B033C29002D for ; Fri, 9 Mar 2012 11:13:05 +0100 (CET) From: Tristan Gingold Subject: [VMS/committed]: Follow VMS name rules more closely for module include files Date: Fri, 9 Mar 2012 11:13:03 +0100 Message-Id: <7CF684AD-788C-4010-8647-9C558B1D890E@adacore.com> To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1257) X-IsSubscribed: yes 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 Hi, on VMS systems, the systems headers are in text archives. We require that these headers are unarchived, but we also need to follow more closely the naming rules. In particular, directories and suffixes are stripped when DEC-C looks in archives, and the archives are case insensitive. To follow that, the patch uses the lower case base name of the file with the .h extension when looking for files in module directories. Simply building building gcc for VMS tests this patch as there is at least an '#include ' instance. (Before, the trick was to add a symlink). Committed on trunk. Tristan. 2012-03-09 Tristan Gingold * config/vms/vms-c.c (vms_construct_include_filename): New function. (vms_c_register_includes): Reference it. Index: vms-c.c =================================================================== --- vms-c.c (revision 185132) +++ vms-c.c (working copy) @@ -304,6 +304,36 @@ c_register_pragma (NULL, "__extern_prefix", vms_pragma_extern_prefix); } +/* Canonicalize the filename (remove directory prefix, force the .h extension), + and append it to the directory to create the path, but don't + turn / into // or // into ///; // may be a namespace escape. */ + +static char * +vms_construct_include_filename (const char *fname, cpp_dir *dir) +{ + size_t dlen, flen; + char *path; + const char *fbasename = lbasename (fname); + size_t i; + + dlen = dir->len; + flen = strlen (fbasename) + 2; + path = XNEWVEC (char, dlen + 1 + flen + 1); + memcpy (path, dir->name, dlen); + if (dlen && !IS_DIR_SEPARATOR (path[dlen - 1])) + path[dlen++] = '/'; + for (i = 0; i < flen; i++) + if (fbasename[i] == '.') + break; + else + path[dlen + i] = TOLOWER (fbasename[i]); + path[dlen + i + 0] = '.'; + path[dlen + i + 1] = 'h'; + path[dlen + i + 2] = 0; + + return path; +} + /* Standard modules list. */ static const char * const vms_std_modules[] = { "rtldef", "starlet_c", NULL }; @@ -341,7 +371,7 @@ p->next = NULL; p->name = path; p->sysp = 1; - p->construct = 0; + p->construct = vms_construct_include_filename; p->user_supplied_p = 0; add_cpp_dir_path (p, SYSTEM); }