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] Libiberty for VMS - mkstemps.c don't mix case


Douglas B Rupp wrote:
What is your thinking?


For the sake of discussion, this is the patch.




diff -rupN gcc-head-src.orig/gcc/gcc.c gcc-head-src/gcc/gcc.c
--- gcc-head-src.orig/gcc/gcc.c	2010-06-24 17:26:24.000000000 -0700
+++ gcc-head-src/gcc/gcc.c	2010-06-27 15:22:34.000000000 -0700
@@ -5386,7 +5386,27 @@ do_spec_1 (const char *spec, int inswitc
 			saved_suffix = NULL;
 		      }
 		    else
-		      t->suffix = save_string (suffix, suffix_length);
+		      {
+#ifdef VMS
+			/* Force an explicit version number on VMS.  */
+			char *vmssuffix = alloca (suffix_length + 4);
+
+			strncpy (vmssuffix, suffix, suffix_length);
+			if (suffix_length > 0)
+			  {
+			    strncpy (vmssuffix + suffix_length, ".1", 3);
+			    suffix_length += 2;
+			  }
+			else
+			  {
+			    strncpy (vmssuffix + suffix_length, "..1", 4);
+			    suffix_length += 3;
+			  }
+			suffix = vmssuffix;
+#endif
+			t->suffix = save_string (suffix, suffix_length);
+		      }
+
 		    t->unique = (c == 'u' || c == 'U' || c == 'j');
 		    temp_filename = make_temp_file (t->suffix);
 		    temp_filename_length = strlen (temp_filename);
diff -rupN gcc-head-src.orig/gcc/toplev.c gcc-head-src/gcc/toplev.c
--- gcc-head-src.orig/gcc/toplev.c	2010-06-20 14:02:46.000000000 -0700
+++ gcc-head-src/gcc/toplev.c	2010-06-27 15:23:41.000000000 -0700
@@ -1382,9 +1382,22 @@ init_asm_output (const char *name)
       if (!strcmp (asm_file_name, "-"))
 	asm_out_file = stdout;
       else
-	asm_out_file = fopen (asm_file_name, "w+b");
+	asm_out_file = fopen (asm_file_name, "a+b");
       if (asm_out_file == 0)
 	fatal_error ("can%'t open %s for writing: %m", asm_file_name);
+
+      if (asm_out_file != stdout)
+	{
+	  int fd, ierr;
+
+	  fd = fileno (asm_out_file);
+	  if (fd < 0)
+	    fatal_error ("can%'t get fileno for %s: %m", asm_file_name);
+
+	  ierr = ftruncate (fd, 0);
+	  if (ierr < 0)
+	    fatal_error ("can%'t truncate %s: %m", asm_file_name);
+	}
     }
 
   if (!flag_syntax_only)

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