This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to prototype anc constify make_temp_file
- To: egcs-patches@egcs.cygnus.com
- Subject: Patch to prototype anc constify make_temp_file
- From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
- Date: Mon, 30 Aug 1999 21:46:22 -0400 (EDT)
Since libiberty/choose-temp.c exports make_temp_file, I added
a prototype for it in include/libiberty.h. I also constified the arg.
One quirk, mips/mips.c defines a static function of the same name, but
with slighty different behavior. It returns an open FILE*. I just
renamed it to mips_make_temp_file to avoid a conflict.
Bootstrapped on Irix6. Okay to install?
--Kaveh
1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (make_temp_file): Add a prototype.
diff -rup orig/egcs-CVS19990829/include/libiberty.h egcs-CVS19990829/include/libiberty.h
--- orig/egcs-CVS19990829/include/libiberty.h Wed Apr 7 09:29:03 1999
+++ egcs-CVS19990829/include/libiberty.h Sun Aug 29 18:48:08 1999
@@ -59,6 +59,10 @@ extern long get_run_time PARAMS ((void))
extern char *choose_temp_base PARAMS ((void));
+/* Return a temporary file name or NULL if unable to create one. */
+
+extern char *make_temp_file PARAMS ((const char *));
+
/* Allocate memory filled with spaces. Allocates using malloc. */
extern const char *spaces PARAMS ((int count));
1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* choose-temp.c: Remove obsolete comment about gcc.
(make_temp_file): Constify a char*.
diff -rup orig/egcs-CVS19990829/libiberty/choose-temp.c egcs-CVS19990829/libiberty/choose-temp.c
--- orig/egcs-CVS19990829/libiberty/choose-temp.c Thu Jul 15 09:33:05 1999
+++ egcs-CVS19990829/libiberty/choose-temp.c Sun Aug 29 18:48:08 1999
@@ -19,9 +19,6 @@ Boston, MA 02111-1307, USA. */
/* This file exports two functions: choose_temp_base and make_temp_file. */
-/* This file lives in at least two places: libiberty and gcc.
- Don't change one without the other. */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -148,7 +145,7 @@ choose_temp_base ()
char *
make_temp_file (suffix)
- char *suffix;
+ const char *suffix;
{
char *base = 0;
char *temp_filename;
1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* collect2.c (make_temp_file): Don't prototype.
* gcc.c (make_temp_file): Likewise.
* mips.c (mips_make_temp_file): Renamed from `make_temp_file'.
diff -rup orig/egcs-CVS19990829/gcc/collect2.c egcs-CVS19990829/gcc/collect2.c
--- orig/egcs-CVS19990829/gcc/collect2.c Wed Aug 4 07:42:13 1999
+++ egcs-CVS19990829/gcc/collect2.c Sun Aug 29 18:48:07 1999
@@ -52,8 +52,6 @@ Boston, MA 02111-1307, USA. */
/* Obstack allocation and deallocation routines. */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-
-extern char *make_temp_file PROTO ((char *));
/* On certain systems, we have code that works by scanning the object file
directly. But this code uses system-specific header files and library
diff -rup orig/egcs-CVS19990829/gcc/gcc.c egcs-CVS19990829/gcc/gcc.c
--- orig/egcs-CVS19990829/gcc/gcc.c Fri Aug 27 09:44:08 1999
+++ egcs-CVS19990829/gcc/gcc.c Sun Aug 29 18:48:07 1999
@@ -1291,8 +1291,6 @@ static int argbuf_index;
#ifdef MKTEMP_EACH_FILE
-extern char *make_temp_file PROTO((const char *));
-
/* This is the list of suffixes and codes (%g/%u/%U) and the associated
temp file. */
diff -rup orig/egcs-CVS19990829/gcc/config/mips/mips.c egcs-CVS19990829/gcc/config/mips/mips.c
--- orig/egcs-CVS19990829/gcc/config/mips/mips.c Mon Aug 9 15:42:33 1999
+++ egcs-CVS19990829/gcc/config/mips/mips.c Sun Aug 29 18:49:51 1999
@@ -90,7 +90,7 @@ static int m16_check_op PROTO ((rtx,
static void block_move_loop PROTO ((rtx, rtx, int, int,
rtx, rtx));
static void block_move_call PROTO ((rtx, rtx, rtx));
-static FILE *make_temp_file PROTO ((void));
+static FILE *mips_make_temp_file PROTO ((void));
static void save_restore_insns PROTO ((int, rtx,
long, FILE *));
static void mips16_output_gp_offset PROTO ((FILE *, rtx));
@@ -5093,7 +5093,7 @@ mips_output_external_libcall (file, name
#endif
static FILE *
-make_temp_file ()
+mips_make_temp_file ()
{
FILE *stream;
const char *base = getenv ("TMPDIR");
@@ -5312,7 +5312,7 @@ mips_asm_file_start (stream)
if (TARGET_FILE_SWITCHING && ! TARGET_MIPS16)
{
asm_out_data_file = stream;
- asm_out_text_file = make_temp_file ();
+ asm_out_text_file = mips_make_temp_file ();
}
else