This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran, committed] Use ISO C remove() instead of unlink()


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);

@@ -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
-      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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]