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]

[egcs 1.1] Fix gcc.c handling of %O vis-a-vis temp files


This fixes, possibly among other things, `g77 -v' so it finishes.
(The problem was that each %g%O was being given an entirely new
temp file name.)

Jeff, if this looks okay to you (and nobody objects), could you put
it in both the mainline and 1.1 branches?  Having `g77 -v' work
for 1.1 would sure be nice, at least.

        tq vm, (burley)


Sun Jul 26 14:45:35 1998  Craig Burley  <burley@gnu.org>

	* gcc.c (do_spec_1): Fix support for %O so the
	temporary file name made for it the first time
	gets reused subsequently.


*** g77-e/gcc/gcc.c.~1~	Tue Jul 21 03:53:30 1998
--- g77-e/gcc/gcc.c	Sun Jul 26 14:41:32 1998
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 3622,3635 ****
  		   In 2.4, do something about that.  */
  		struct temp_name *t;
  		char *suffix = p;
! 		while (*p == '.' || ISALPHA (*p)
! 		       || (p[0] == '%' && p[1] == 'O'))
! 		  p++;
  
  		/* See if we already have an association of %g/%u/%U and
  		   suffix.  */
  		for (t = temp_names; t; t = t->next)
! 		  if (t->length == p - suffix
! 		      && strncmp (t->suffix, suffix, p - suffix) == 0
  		      && t->unique == (c != 'g'))
  		    break;
--- 3622,3649 ----
  		   In 2.4, do something about that.  */
  		struct temp_name *t;
+ 		int suffix_length;
  		char *suffix = p;
! 
! 		if (p[0] == '%' && p[1] == 'O')
! 		  {
! 		    /* We don't support extra suffix characters after %O.  */
! 		    if (*p == '.' || ISALPHA (*p))
! 		      abort ();
! 		    suffix = OBJECT_SUFFIX;
! 		    suffix_length = strlen (OBJECT_SUFFIX);
! 		    p += 2;
! 		  }
! 		else
! 		  {
! 		    while (*p == '.' || ISALPHA (*p))
! 		      p++;
! 		    suffix_length = p - suffix;
! 		  }
  
  		/* See if we already have an association of %g/%u/%U and
  		   suffix.  */
  		for (t = temp_names; t; t = t->next)
! 		  if (t->length == suffix_length
! 		      && strncmp (t->suffix, suffix, suffix_length) == 0
  		      && t->unique == (c != 'g'))
  		    break;
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 3644,3662 ****
  			temp_names = t;
  		      }
! 		    if (strncmp (suffix, "%O", 2) == 0)
! 		      {
! 			t->length = strlen(OBJECT_SUFFIX);
! 			t->suffix = save_string (OBJECT_SUFFIX,
! 						 strlen(OBJECT_SUFFIX));
! 			t->unique = (c != 'g');
! 			temp_filename = make_temp_file (OBJECT_SUFFIX);
! 		      }
! 		    else
! 		      {
! 			t->length = p - suffix;
! 			t->suffix = save_string (suffix, p - suffix);
! 			t->unique = (c != 'g');
! 			temp_filename = make_temp_file (t->suffix);
! 		      }
  		    temp_filename_length = strlen (temp_filename);
  		    t->filename = temp_filename;
--- 3658,3665 ----
  			temp_names = t;
  		      }
! 		    t->length = suffix_length;
! 		    t->suffix = save_string (suffix, suffix_length);
! 		    t->unique = (c != 'g');
! 		    temp_filename = make_temp_file (t->suffix);
  		    temp_filename_length = strlen (temp_filename);
  		    t->filename = temp_filename;


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