From patchwork Thu Apr 26 09:59:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 155221 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 32EF3B6FA8 for ; Thu, 26 Apr 2012 20:00:37 +1000 (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=1336039237; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=zu2gYDCNXBWd7fRAinER nOGdTKQ=; b=WlKzTecji8VomDOmNbMgpfJehgBuVqMw5pWR5MWMP6mVBLWrL9uX fep/184nLiF3hP8qFqHvKxrGz+Py8F/N++7c8bGKujB40SoXcuCoE0XrsAD60i4d V62x5ZoQShnsWwIneqsCXuXA9pS0HV+ZDBd9TaA6vUy+tJcTfXyGUV4= 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:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qmYiVoSDkrI57rHE6ZgwMOLjgcJtG0/Kzwi7YDICyNeZx2N+1dDW7ch7wjZiG5 uXadxneEyuT8KcixAolIQ+NUvqjuPZAIjdXe5oiecbcjkisUg5B5CEVrKGoNOfjF ZbV71jNUv1uaKtfwoGdT1ERuCN26dbC+l4Uw9fdOIHqIY=; Received: (qmail 26518 invoked by alias); 26 Apr 2012 10:00:20 -0000 Received: (qmail 26452 invoked by uid 22791); 26 Apr 2012 10:00:18 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, TW_CP X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Apr 2012 10:00:00 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8DD5F1C69BB; Thu, 26 Apr 2012 05:59:59 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UJtMBjQA6uEn; Thu, 26 Apr 2012 05:59:59 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 651101C6993; Thu, 26 Apr 2012 05:59:59 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 642E13FEE8; Thu, 26 Apr 2012 05:59:59 -0400 (EDT) Date: Thu, 26 Apr 2012 05:59:59 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Tristan Gingold Subject: [Ada] Minor reformatting and cleanup in adaint.c Message-ID: <20120426095959.GA6782@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 Function to_host_path_spec is removed (was unused). No functional change. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-04-26 Tristan Gingold * adaint.c (to_host_path_spec): Removed (unused). Minor reformatting. Index: adaint.c =================================================================== --- adaint.c (revision 186860) +++ adaint.c (working copy) @@ -3086,11 +3086,12 @@ char * __gnat_translate_vms (char *src) { - static char retbuf [NAM$C_MAXRSS+1]; + static char retbuf [NAM$C_MAXRSS + 1]; char *srcendpos, *pos1, *pos2, *retpos; int disp, path_present = 0; - if (!src) return NULL; + if (!src) + return NULL; srcendpos = strchr (src, '\0'); retpos = retbuf; @@ -3099,112 +3100,132 @@ pos1 = src; pos2 = strchr (pos1, ':'); - if (pos2 && (pos2 < srcendpos) && (*(pos2 + 1) == ':')) { - /* There is a node name. "node_name::" becomes "node_name!" */ - disp = pos2 - pos1; - strncpy (retbuf, pos1, disp); - retpos [disp] = '!'; - retpos = retpos + disp + 1; - pos1 = pos2 + 2; - pos2 = strchr (pos1, ':'); - } + if (pos2 && (pos2 < srcendpos) && (*(pos2 + 1) == ':')) + { + /* There is a node name. "node_name::" becomes "node_name!" */ + disp = pos2 - pos1; + strncpy (retbuf, pos1, disp); + retpos [disp] = '!'; + retpos = retpos + disp + 1; + pos1 = pos2 + 2; + pos2 = strchr (pos1, ':'); + } - if (pos2) { - /* There is a device name. "dev_name:" becomes "/dev_name/" */ - *(retpos++) = '/'; - disp = pos2 - pos1; - strncpy (retpos, pos1, disp); - retpos = retpos + disp; - pos1 = pos2 + 1; - *(retpos++) = '/'; - } + if (pos2) + { + /* There is a device name. "dev_name:" becomes "/dev_name/" */ + *(retpos++) = '/'; + disp = pos2 - pos1; + strncpy (retpos, pos1, disp); + retpos = retpos + disp; + pos1 = pos2 + 1; + *(retpos++) = '/'; + } else /* No explicit device; we must look ahead and prepend /sys$disk/ if the path is absolute */ if ((*pos1 == '[' || *pos1 == '<') && (pos1 < srcendpos) - && !strchr (".-]>", *(pos1 + 1))) { - strncpy (retpos, "/sys$disk/", 10); - retpos += 10; - } + && !strchr (".-]>", *(pos1 + 1))) + { + strncpy (retpos, "/sys$disk/", 10); + retpos += 10; + } /* Process the path part */ - while (*pos1 == '[' || *pos1 == '<') { - path_present++; - pos1++; - if (*pos1 == ']' || *pos1 == '>') { - /* Special case, [] translates to '.' */ - *(retpos++) = '.'; + while (*pos1 == '[' || *pos1 == '<') + { + path_present++; pos1++; - } - else { - /* '[000000' means root dir. It can be present in the middle of - the path due to expansion of logical devices, in which case - we skip it */ - if (!strncmp (pos1, "000000", 6) && path_present > 1 && - (*(pos1 + 6) == ']' || *(pos1 + 6) == '>' || *(pos1 + 6) == '.')) { - pos1 += 6; - if (*pos1 == '.') pos1++; + if (*pos1 == ']' || *pos1 == '>') + { + /* Special case, [] translates to '.' */ + *(retpos++) = '.'; + pos1++; } - else if (*pos1 == '.') { - /* Relative path */ - *(retpos++) = '.'; - } - - /* There is a qualified path */ - while (*pos1 && *pos1 != ']' && *pos1 != '>') { - switch (*pos1) { - case '.': - /* '.' is used to separate directories. Replace it with '/' but - only if there isn't already '/' just before */ - if (*(retpos - 1) != '/') *(retpos++) = '/'; - pos1++; - if (pos1 + 1 < srcendpos && *pos1 == '.' && *(pos1 + 1) == '.') { - /* ellipsis refers to entire subtree; replace with '**' */ - *(retpos++) = '*'; *(retpos++) = '*'; *(retpos++) = '/'; - pos1 += 2; + else + { + /* '[000000' means root dir. It can be present in the middle of + the path due to expansion of logical devices, in which case + we skip it */ + if (!strncmp (pos1, "000000", 6) && path_present > 1 && + (*(pos1 + 6) == ']' || *(pos1 + 6) == '>' || *(pos1 + 6) == '.')) + { + pos1 += 6; + if (*pos1 == '.') pos1++; } - break; - case '-' : - /* When after '.' '[' '<' is equivalent to Unix ".." but there - may be several in a row */ - if (*(pos1 - 1) == '.' || *(pos1 - 1) == '[' || - *(pos1 - 1) == '<') { - while (*pos1 == '-') { - pos1++; - *(retpos++) = '.'; *(retpos++) = '.'; *(retpos++) = '/'; - } - retpos--; - break; + else if (*pos1 == '.') + { + /* Relative path */ + *(retpos++) = '.'; } - /* otherwise fall through to default */ - default: - *(retpos++) = *(pos1++); + + /* There is a qualified path */ + while (*pos1 && *pos1 != ']' && *pos1 != '>') + { + switch (*pos1) + { + case '.': + /* '.' is used to separate directories. Replace it with '/' but + only if there isn't already '/' just before */ + if (*(retpos - 1) != '/') + *(retpos++) = '/'; + pos1++; + if (pos1 + 1 < srcendpos && *pos1 == '.' && *(pos1 + 1) == '.') + { + /* ellipsis refers to entire subtree; replace with '**' */ + *(retpos++) = '*'; + *(retpos++) = '*'; + *(retpos++) = '/'; + pos1 += 2; + } + break; + case '-' : + /* When after '.' '[' '<' is equivalent to Unix ".." but there + may be several in a row */ + if (*(pos1 - 1) == '.' || *(pos1 - 1) == '[' || + *(pos1 - 1) == '<') + { + while (*pos1 == '-') + { + pos1++; + *(retpos++) = '.'; + *(retpos++) = '.'; + *(retpos++) = '/'; + } + retpos--; + break; + } + /* otherwise fall through to default */ + default: + *(retpos++) = *(pos1++); + } + } + pos1++; } - } - pos1++; } - } - if (pos1 < srcendpos) { - /* Now add the actual file name, until the version suffix if any */ - if (path_present) *(retpos++) = '/'; - pos2 = strchr (pos1, ';'); - disp = pos2? (pos2 - pos1) : (srcendpos - pos1); - strncpy (retpos, pos1, disp); - retpos += disp; - if (pos2 && pos2 < srcendpos) { - /* There is a non-empty version suffix. ";" becomes "." */ - *retpos++ = '.'; - disp = srcendpos - pos2 - 1; - strncpy (retpos, pos2 + 1, disp); + if (pos1 < srcendpos) + { + /* Now add the actual file name, until the version suffix if any */ + if (path_present) + *(retpos++) = '/'; + pos2 = strchr (pos1, ';'); + disp = pos2? (pos2 - pos1) : (srcendpos - pos1); + strncpy (retpos, pos1, disp); retpos += disp; + if (pos2 && pos2 < srcendpos) + { + /* There is a non-empty version suffix. ";" becomes "." */ + *retpos++ = '.'; + disp = srcendpos - pos2 - 1; + strncpy (retpos, pos2 + 1, disp); + retpos += disp; + } } - } *retpos = '\0'; return retbuf; - } /* Translate a VMS syntax directory specification in to Unix syntax. If @@ -3355,52 +3376,13 @@ static char filename_buff [MAXPATH]; static int -translate_unix (char *name, int type) +translate_unix (char *name, int type ATTRIBUTE_UNUSED) { strncpy (filename_buff, name, MAXPATH); filename_buff [MAXPATH - 1] = (char) 0; return 0; } -/* Translate a Unix syntax path spec into a VMS style (comma separated list of - directories. */ - -static char * -to_host_path_spec (char *pathspec) -{ - char *curr, *next, buff [MAXPATH]; - - if (pathspec == 0) - return pathspec; - - /* Can't very well test for colons, since that's the Unix separator! */ - if (strchr (pathspec, ']') || strchr (pathspec, ',')) - return pathspec; - - new_host_pathspec[0] = 0; - curr = pathspec; - - for (;;) - { - next = strchr (curr, ':'); - if (next == 0) - next = strchr (curr, 0); - - strncpy (buff, curr, next - curr); - buff[next - curr] = 0; - - strncat (new_host_pathspec, __gnat_to_host_dir_spec (buff, 0), MAXPATH); - if (*next == 0) - break; - strncat (new_host_pathspec, ",", MAXPATH); - curr = next + 1; - } - - new_host_pathspec [MAXPATH - 1] = (char) 0; - - return new_host_pathspec; -} - /* Translate a Unix syntax directory specification into VMS syntax. The PREFIXFLAG has no effect, but is kept for symmetry with to_canonical_dir_spec. If indicators of VMS syntax found, return input @@ -3592,7 +3574,8 @@ Returns 0 if operation was successful and -1 in case of error. */ int -__gnat_copy_attribs (char *from, char *to, int mode) +__gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, + int mode ATTRIBUTE_UNUSED) { #if defined (VMS) || (defined (__vxworks) && _WRS_VXWORKS_MAJOR < 6) || \ defined (__nucleus__)