[fortran,patch] Creating a common header to the front-end and runtime library

David Edelsohn dje@watson.ibm.com
Wed Sep 5 18:08:00 GMT 2007


	This patch is needed to allow AIX to build libgfortran again.  I
am not sure which of the various changes in headers over the weekend
caused the problem.

	_LARGE_FILES needs to be defined from config.h before including
system headers.

	unix.c use of "truncate" member name then conflicts with system
header renaming the token.

Okay?

Thanks, David


	* libgfortran.h: Include config.h first.
	* io/io.h (struct stream): Rename truncate to trunc.
	* io/unix.c (fd_open): Same.
	(open_internal): Same.

Index: libgfortran.h
===================================================================
--- libgfortran.h	(revision 128130)
+++ libgfortran.h	(working copy)
@@ -31,6 +31,9 @@
 #ifndef LIBGFOR_H
 #define LIBGFOR_H
 
+/* config.h MUST be first because it can affect system headers.  */
+#include "config.h"
+
 #include <stdio.h>
 #include <math.h>
 #include <stddef.h>
@@ -45,7 +48,6 @@
 
 #include "../gcc/fortran/libgfortran.h"
 
-#include "config.h"
 #include "c99_protos.h"
 
 #if HAVE_IEEEFP_H
Index: unix.c
===================================================================
--- unix.c	(revision 128130)
+++ unix.c	(working copy)
@@ -828,7 +828,7 @@
   s->st.sfree = (void *) fd_sfree;
   s->st.close = (void *) fd_close;
   s->st.seek = (void *) fd_seek;
-  s->st.truncate = (void *) fd_truncate;
+  s->st.trunc = (void *) fd_truncate;
   s->st.read = (void *) fd_read;
   s->st.write = (void *) fd_write;
   s->st.set = (void *) fd_sset;
@@ -1042,7 +1042,7 @@
   s->st.sfree = (void *) mem_sfree;
   s->st.close = (void *) mem_close;
   s->st.seek = (void *) mem_seek;
-  s->st.truncate = (void *) mem_truncate;
+  s->st.trunc = (void *) mem_truncate;
   s->st.read = (void *) mem_read;
   s->st.write = (void *) mem_write;
   s->st.set = (void *) mem_set;



More information about the Fortran mailing list