This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Libiberty for VMS - mkstemps.c don't mix case
- From: Douglas B Rupp <rupp at gnat dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: ian at airs dot com, gcc-patches at gcc dot gnu dot org
- Date: Sun, 27 Jun 2010 15:30:44 -0700
- Subject: Re: [PATCH] Libiberty for VMS - mkstemps.c don't mix case
- References: <4A67B113.7010903@gnat.com> <200907230045.n6N0j7NW029586@greed.delorie.com> <4A67B704.6030402@gnat.com> <200907230110.n6N1Aqt6031945@greed.delorie.com> <4A67BAA2.4020502@gnat.com> <200907230123.n6N1NYa6000851@greed.delorie.com> <4C27902E.7030300@gnat.com>
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)