From patchwork Fri Aug 29 21:21:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 384388 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 EC842140119 for ; Sat, 30 Aug 2014 07:21:57 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=JynwhUTSOZp+90yeONdriPRQb7ULUTGMEQfg9N9eaQAhVs a+JnH6k5OS+IEBIlRdrKIvJckMqHULcxgv8B+43qJOemyDwMRrKtOS7GhehNRwD+ uGh21CPoFS0vsQl9qORV62XCX6dIGP3cmQMz1UyIquVNXv9v/HUmOPrDC1dwQ= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=sTMV184Yq9pkYDJbGHEeQeYYPwU=; b=uGc7eek570L+nCL3E2Ow QoGR2pFJN2FcYrtXjG+zgzkR31tgeMxwQJMk/9jz+lQSrjUk2gG5TBhEfQseasxD 58Eagc0tdT30PtGgY0874k28tHNgyQahaPwGlO1owSHH/A2XWmSTHeLvYxBCg5VC awiNpn147XYO/gMGN4i4srQ= Received: (qmail 24001 invoked by alias); 29 Aug 2014 21:21:45 -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 23979 invoked by uid 89); 29 Aug 2014 21:21:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 29 Aug 2014 21:21:43 +0000 Received: by mail-oi0-f47.google.com with SMTP id x69so1992363oia.6 for ; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.59.196 with SMTP id b4mr12914581oer.38.1409347301851; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) Received: by 10.182.228.20 with HTTP; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) Date: Sat, 30 Aug 2014 00:21:41 +0300 Message-ID: Subject: [Patch, fortran, committed] Use ISO C remove() instead of unlink() From: Janne Blomqvist To: Fortran List , GCC Patches Hi, when removing a file we can instead use the remove() function specified in ISO C instead of unlink(), as found in POSIX, Windows and probably other systems as well. Thus giving us a bit better guarantee about the provided semantics, which header file it's found in etc. Committed to trunk as obvious. Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (revision 214743) +++ gcc/fortran/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-08-30 Janne Blomqvist + + * module.c (gfc_dump_module): Use ISO C remove() instead of POSIX + unlink(). + 2014-08-29 Jeffrey Armstrong PR fortran/62215 Index: gcc/fortran/module.c =================================================================== --- gcc/fortran/module.c (revision 214743) +++ gcc/fortran/module.c (working copy) @@ -6000,7 +6000,7 @@ gfc_dump_module (const char *name, int d module file, even if it was already there. */ if (!dump_flag) { - unlink (filename); + remove (filename); return; } @@ -6040,7 +6040,7 @@ gfc_dump_module (const char *name, int d || crc_old != crc) { /* Module file have changed, replace the old one. */ - if (unlink (filename) && errno != ENOENT) + if (remove (filename) && errno != ENOENT) gfc_fatal_error ("Can't delete module file '%s': %s", filename, xstrerror (errno)); if (rename (filename_tmp, filename)) @@ -6049,7 +6049,7 @@ gfc_dump_module (const char *name, int d } else { - if (unlink (filename_tmp)) + if (remove (filename_tmp)) gfc_fatal_error ("Can't delete temporary module file '%s': %s", filename_tmp, xstrerror (errno)); }