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]

[gfortran] PR 15234



This is a patch for the issue that unit_t is already used by system headers on Tru64. I simply replaced every occurence of unit_t by gfc_unit, and verified that the library still builds.


Rainer, could you see how much farther you get with this patch?

Another thing that I jsut spotted: Why do we check that we're using the GNU Fortran 77 compiler when building libgfortran? Or is the configure message inaccurate?

- Tobi

2004-05-14 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/15234
	* io/io.h (unit_t): Rename to ...
	(gfc_unit) ... this.
	(unit_root, current_unit, find_file, find_unit, get_unit): Now
	of type gfc_unit.
	(delete_file, insert_unit, close_unit): Argument now of type
	gfc_unit.
	* backspace.c (st_backspace), close.c (st_close), endfile.c
	(st_endfile), inquire.c (inquire_via_unit, st_inquire), open.c
	(test_endfile, edit_modes, new_unit, already_open, st_open),
	rewind.c (st_rewind), transfer.c (current_unit), unit.c
	(internal_unit, unit_cache, rotate_left, rotate_right, insert,
	insert_unit, delete_root, delete_treap, delete_unit, find_unit,
	get_unit, init_units, close_unit), unix.c (find_file0,
	find_file, delete_file): Replace all occurences of unit_t by
	gfc_unit.


? libdiff
? sedRHclpH
? sedtUhMSE
? seduprgQq
Index: backspace.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/backspace.c,v
retrieving revision 1.2
diff -u -p -r1.2 backspace.c
--- backspace.c	13 May 2004 06:41:02 -0000	1.2
+++ backspace.c	14 May 2004 18:44:01 -0000
@@ -117,7 +117,7 @@ io_error:
 void
 st_backspace (void)
 {
-  unit_t *u;
+  gfc_unit *u;
 
   library_start ();
 
Index: close.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/close.c,v
retrieving revision 1.2
diff -u -p -r1.2 close.c
--- close.c	13 May 2004 06:41:02 -0000	1.2
+++ close.c	14 May 2004 18:44:01 -0000
@@ -37,7 +37,7 @@ void
 st_close (void)
 {
   close_status status;
-  unit_t *u;
+  gfc_unit *u;
 
   library_start ();
 
Index: endfile.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/endfile.c,v
retrieving revision 1.2
diff -u -p -r1.2 endfile.c
--- endfile.c	13 May 2004 06:41:02 -0000	1.2
+++ endfile.c	14 May 2004 18:44:01 -0000
@@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA.  */
 void
 st_endfile (void)
 {
-  unit_t *u;
+  gfc_unit *u;
 
   library_start ();
 
Index: inquire.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/inquire.c,v
retrieving revision 1.2
diff -u -p -r1.2 inquire.c
--- inquire.c	13 May 2004 06:41:02 -0000	1.2
+++ inquire.c	14 May 2004 18:44:02 -0000
@@ -32,7 +32,7 @@ static char undefined[] = "UNDEFINED";
 /* inquire_via_unit()-- Inquiry via unit number.  The unit might not exist. */
 
 static void
-inquire_via_unit (unit_t * u)
+inquire_via_unit (gfc_unit * u)
 {
   const char *p;
 
@@ -352,7 +352,7 @@ inquire_via_filename (void)
 void
 st_inquire (void)
 {
-  unit_t *u;
+  gfc_unit *u;
 
   library_start ();
 
Index: io.h
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/io.h,v
retrieving revision 1.2
diff -u -p -r1.2 io.h
--- io.h	13 May 2004 06:41:02 -0000	1.2
+++ io.h	14 May 2004 18:44:02 -0000
@@ -254,13 +254,13 @@ unit_flags;
 #define DEFAULT_RECL 10000
 
 
-typedef struct unit_t
+typedef struct gfc_unit
 {
   int unit_number;
 
   stream *s;
 
-  struct unit_t *left, *right;	/* Treap links.  */
+  struct gfc_unit *left, *right;	/* Treap links.  */
   int priority;
 
   int read_bad, current_record;
@@ -279,7 +279,7 @@ typedef struct unit_t
   int file_len;
   char file[1];	      /* Filename is allocated at the end of the structure.  */
 }
-unit_t;
+gfc_unit;
 
 /* Global variables.  Putting these in a structure makes it easier to
    maintain, particularly with the constraint of a prefix.  */
@@ -293,7 +293,7 @@ typedef struct
   int reversion_flag;	/* Format reversion has occurred.  */
   int first_item;
 
-  unit_t *unit_root;
+  gfc_unit *unit_root;
   int seen_dollar;
 
   enum {READING, WRITING} mode;
@@ -311,7 +311,7 @@ extern global_t g;
 
 
 #define current_unit prefix(current_unit)
-extern unit_t *current_unit;
+extern gfc_unit *current_unit;
 
 /* Format tokens.  Only about half of these can be stored in the
    format nodes.  */
@@ -409,7 +409,7 @@ stream *output_stream (void);
 int compare_file_filename (stream *, const char *, int);
 
 #define find_file prefix(find_file)
-unit_t *find_file (void);
+gfc_unit *find_file (void);
 
 #define stream_at_bof prefix(stream_at_bof)
 int stream_at_bof (stream *);
@@ -418,7 +418,7 @@ int stream_at_bof (stream *);
 int stream_at_eof (stream *);
 
 #define delete_file prefix(delete_file)
-int delete_file (unit_t *);
+int delete_file (gfc_unit *);
 
 #define file_exists prefix(file_exists)
 int file_exists (void);
@@ -460,24 +460,24 @@ void empty_internal_buffer(stream *);
 /* unit.c */
 
 #define insert_unit prefix(insert_unix)
-void insert_unit (unit_t *);
+void insert_unit (gfc_unit *);
 
 #define close_unit prefix(close_unit)
-int close_unit (unit_t *);
+int close_unit (gfc_unit *);
 
 #define is_internal_unit prefix(is_internal_unit)
 int is_internal_unit (void);
 
 #define find_unit prefix(find_unit)
-unit_t *find_unit (int);
+gfc_unit *find_unit (int);
 
 #define get_unit prefix(get_unit)
-unit_t *get_unit (int);
+gfc_unit *get_unit (int);
 
 /* open.c */
 
 #define test_endfile prefix(test_endfile)
-void test_endfile (unit_t *);
+void test_endfile (gfc_unit *);
 
 #define new_unit prefix(new_unit)
 void new_unit (unit_flags *);
Index: open.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/open.c,v
retrieving revision 1.2
diff -u -p -r1.2 open.c
--- open.c	13 May 2004 06:41:02 -0000	1.2
+++ open.c	14 May 2004 18:44:03 -0000
@@ -140,7 +140,7 @@ static st_option access_opt[] = {
  * state from AFTER_ENDFILE to AT_ENDFILE. */
 
 void
-test_endfile (unit_t * u)
+test_endfile (gfc_unit * u)
 {
 
   if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s))
@@ -152,7 +152,7 @@ test_endfile (unit_t * u)
  * to be changed. */
 
 static void
-edit_modes (unit_t * u, unit_flags * flags)
+edit_modes (gfc_unit * u, unit_flags * flags)
 {
 
   /* Complain about attempts to change the unchangeable */
@@ -250,7 +250,7 @@ edit_modes (unit_t * u, unit_flags * fla
 void
 new_unit (unit_flags * flags)
 {
-  unit_t *u;
+  gfc_unit *u;
   stream *s;
   char tmpname[5 /* fort. */ + 10 /* digits of unit number */ + 1 /* 0 */];
 
@@ -384,7 +384,7 @@ new_unit (unit_flags * flags)
 
   /* Create the unit structure */
 
-  u = get_mem (sizeof (unit_t) + ioparm.file_len);
+  u = get_mem (sizeof (gfc_unit) + ioparm.file_len);
 
   u->unit_number = ioparm.unit;
   u->s = s;
@@ -430,7 +430,7 @@ cleanup:
  * file. */
 
 static void
-already_open (unit_t * u, unit_flags * flags)
+already_open (gfc_unit * u, unit_flags * flags)
 {
 
   if (ioparm.file == NULL)
@@ -465,7 +465,7 @@ void
 st_open (void)
 {
   unit_flags flags;
-  unit_t *u = NULL;
+  gfc_unit *u = NULL;
  
   library_start ();
 
Index: rewind.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/rewind.c,v
retrieving revision 1.2
diff -u -p -r1.2 rewind.c
--- rewind.c	13 May 2004 06:41:02 -0000	1.2
+++ rewind.c	14 May 2004 18:44:05 -0000
@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA.  */
 void
 st_rewind (void)
 {
-  unit_t *u;
+  gfc_unit *u;
 
   library_start ();
 
Index: transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.2
diff -u -p -r1.2 transfer.c
--- transfer.c	13 May 2004 06:41:02 -0000	1.2
+++ transfer.c	14 May 2004 18:44:05 -0000
@@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA.  */
  *  transferred.
  */
 
-unit_t *current_unit;
+gfc_unit *current_unit;
 static int sf_seen_eor = 0;
 
 char scratch[SCRATCH_SIZE];
Index: unit.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/unit.c,v
retrieving revision 1.2
diff -u -p -r1.2 unit.c
--- unit.c	13 May 2004 06:41:02 -0000	1.2
+++ unit.c	14 May 2004 18:44:05 -0000
@@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 #define CACHE_SIZE 3
-static unit_t internal_unit, *unit_cache[CACHE_SIZE];
+static gfc_unit internal_unit, *unit_cache[CACHE_SIZE];
 
 
 /* This implementation is based on Stefan Nilsson's article in the
@@ -51,10 +51,10 @@ pseudo_random (void)
 
 /* rotate_left()-- Rotate the treap left */
 
-static unit_t *
-rotate_left (unit_t * t)
+static gfc_unit *
+rotate_left (gfc_unit * t)
 {
-  unit_t *temp;
+  gfc_unit *temp;
 
   temp = t->right;
   t->right = t->right->left;
@@ -66,10 +66,10 @@ rotate_left (unit_t * t)
 
 /* rotate_right()-- Rotate the treap right */
 
-static unit_t *
-rotate_right (unit_t * t)
+static gfc_unit *
+rotate_right (gfc_unit * t)
 {
-  unit_t *temp;
+  gfc_unit *temp;
 
   temp = t->left;
   t->left = t->left->right;
@@ -95,8 +95,8 @@ compare (int a, int b)
 
 /* insert()-- Recursive insertion function.  Returns the updated treap. */
 
-static unit_t *
-insert (unit_t * new, unit_t * t)
+static gfc_unit *
+insert (gfc_unit * new, gfc_unit * t)
 {
   int c;
 
@@ -130,7 +130,7 @@ insert (unit_t * new, unit_t * t)
  * an error to insert a key that already exists. */
 
 void
-insert_unit (unit_t * new)
+insert_unit (gfc_unit * new)
 {
 
   new->priority = pseudo_random ();
@@ -138,10 +138,10 @@ insert_unit (unit_t * new)
 }
 
 
-static unit_t *
-delete_root (unit_t * t)
+static gfc_unit *
+delete_root (gfc_unit * t)
 {
-  unit_t *temp;
+  gfc_unit *temp;
 
   if (t->left == NULL)
     return t->right;
@@ -168,8 +168,8 @@ delete_root (unit_t * t)
  * must just point to a treap structure with the key to be deleted.
  * Returns the new root node of the tree. */
 
-static unit_t *
-delete_treap (unit_t * old, unit_t * t)
+static gfc_unit *
+delete_treap (gfc_unit * old, gfc_unit * t)
 {
   int c;
 
@@ -192,7 +192,7 @@ delete_treap (unit_t * old, unit_t * t)
 /* delete_unit()-- Delete a unit from a tree */
 
 static void
-delete_unit (unit_t * old)
+delete_unit (gfc_unit * old)
 {
 
   g.unit_root = delete_treap (old, g.unit_root);
@@ -202,10 +202,10 @@ delete_unit (unit_t * old)
 /* find_unit()-- Given an integer, return a pointer to the unit
  * structure.  Returns NULL if the unit does not exist. */
 
-unit_t *
+gfc_unit *
 find_unit (int n)
 {
-  unit_t *p;
+  gfc_unit *p;
   int c;
 
   for (c = 0; c < CACHE_SIZE; c++)
@@ -241,10 +241,10 @@ find_unit (int n)
 /* get_unit()-- Returns the unit structure associated with the integer
  * unit or the internal file. */
 
-unit_t *
+gfc_unit *
 get_unit (int read_flag)
 {
-  unit_t *u;
+  gfc_unit *u;
 
   if (ioparm.internal_unit != NULL)
     {
@@ -290,12 +290,12 @@ void
 init_units (void)
 {
   offset_t m, n;
-  unit_t *u;
+  gfc_unit *u;
   int i;
 
   if (options.stdin_unit >= 0)
     {				/* STDIN */
-      u = get_mem (sizeof (unit_t));
+      u = get_mem (sizeof (gfc_unit));
 
       u->unit_number = options.stdin_unit;
       u->s = input_stream ();
@@ -316,7 +316,7 @@ init_units (void)
 
   if (options.stdout_unit >= 0)
     {				/* STDOUT */
-      u = get_mem (sizeof (unit_t));
+      u = get_mem (sizeof (gfc_unit));
 
       u->unit_number = options.stdout_unit;
       u->s = output_stream ();
@@ -351,7 +351,7 @@ init_units (void)
  * associated with the stream is freed.  Returns nonzero on I/O error. */
 
 int
-close_unit (unit_t * u)
+close_unit (gfc_unit * u)
 {
   int i, rc;
 
Index: unix.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.2
diff -u -p -r1.2 unix.c
--- unix.c	13 May 2004 06:41:02 -0000	1.2
+++ unix.c	14 May 2004 18:44:05 -0000
@@ -1112,11 +1112,11 @@ compare_file_filename (stream * s, const
 
 /* find_file0()-- Recursive work function for find_file() */
 
-static unit_t *
-find_file0 (unit_t * u, struct stat *st1)
+static gfc_unit *
+find_file0 (gfc_unit * u, struct stat *st1)
 {
   struct stat st2;
-  unit_t *v;
+  gfc_unit *v;
 
   if (u == NULL)
     return NULL;
@@ -1140,7 +1140,7 @@ find_file0 (unit_t * u, struct stat *st1
 /* find_file()-- Take the current filename and see if there is a unit
  * that has the file already open.  Returns a pointer to the unit if so. */
 
-unit_t *
+gfc_unit *
 find_file (void)
 {
   char path[PATH_MAX + 1];
@@ -1194,7 +1194,7 @@ stream_at_eof (stream * s)
  * with the unit.  Returns nonzero if something went wrong. */
 
 int
-delete_file (unit_t * u)
+delete_file (gfc_unit * u)
 {
   char path[PATH_MAX + 1];
 

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