This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, fortran, committed] Use ISO C remove() instead of unlink()
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 30 Aug 2014 00:21:41 +0300
- Subject: [Patch, fortran, committed] Use ISO C remove() instead of unlink()
- Authentication-results: sourceware.org; auth=none
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 <jb@gcc.gnu.org>
+
+ * module.c (gfc_dump_module): Use ISO C remove() instead of POSIX
+ unlink().
+
2014-08-29 Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com>
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));
}
--
Janne Blomqvist