This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [PATCH, FORTRAN] Include unistd.h in environ.c


David Edelsohn wrote:
environ.c is referencing functions like getuid(), geteuid(), getgid()
and getegid(), but it does not include the header file that declares
them.

I also noticed that libgfortran is not consistent about checking that
unistd.h exists.

You can add io/unix.c and io/open.c to the list of files which do not check whether unistd.h exists. Can you add the #ifdef there as well?

Bootstrapped on powerpc-ibm-aix7.1.0.0.
Okay for trunk?

Okay. Thanks for the patch!

Tobias

         * runtime/pause.c: Test HAVE_UNISTD_H.
         * runtime/environ.c: Include unistd.h.
         * runtime/stop.c: Test HAVE_UNISTD_H.

Index: runtime/pause.c
===================================================================
--- runtime/pause.c     (revision 198587)
+++ runtime/pause.c     (working copy)
@@ -25,8 +25,12 @@

  #include "libgfortran.h"
  #include <string.h>
+
+#ifdef HAVE_UNISTD_H
  #include <unistd.h>
+#endif

+
  static void
  do_pause (void)
  {
Index: runtime/environ.c
===================================================================
--- runtime/environ.c   (revision 198587)
+++ runtime/environ.c   (working copy)
@@ -28,7 +28,11 @@
  #include <stdlib.h>
  #include <ctype.h>

+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif

+
  /* Environment scanner.  Examine the environment for controlling minor
   * aspects of the program's execution.  Our philosophy here that the
   * environment should not prevent the program from running, so an
Index: runtime/stop.c
===================================================================
--- runtime/stop.c      (revision 198587)
+++ runtime/stop.c      (working copy)
@@ -26,8 +26,12 @@
  #include "libgfortran.h"
  #include <stdlib.h>
  #include <string.h>
+
+#ifdef HAVE_UNISTD_H
  #include <unistd.h>
+#endif

+
  /* A numeric STOP statement.  */

  extern void stop_numeric (GFC_INTEGER_4)



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