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]

Reorg for including libiberty.h, [part 3/4]


	These changes span the cp/, f/, and java/ directories.  The
java/ dir actually adds some function implementations normally available
from libiberty.  The purpose is to allow Irix6 to bootstrap until a
resolution to http://www.cygnus.com/ml/egcs-bugs/1998-Nov/0017.html is
implemented and installed. 

	This is part 3/4.  Okay to install?



Sun Nov 22 08:46:44 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* g++spec.c: Don't prototype xmalloc.

diff -rup orig/egcs-CVS19981119/gcc/cp/g++spec.c egcs-CVS19981119/gcc/cp/g++spec.c
--- orig/egcs-CVS19981119/gcc/cp/g++spec.c	Thu Nov 19 16:07:08 1998
+++ egcs-CVS19981119/gcc/cp/g++spec.c	Fri Nov 20 15:52:58 1998
@@ -32,8 +32,6 @@ Boston, MA 02111-1307, USA.  */
 #define MATH_LIBRARY "-lm"
 #endif
 
-extern char *xmalloc PROTO((size_t));
-
 void
 lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
      void (*fn)();



Sun Nov 22 08:46:44 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* fini.c: Rename variable `spaces' to `xspaces' to avoid
	conflicting with function `spaces' from libiberty.

	* g77spec.c: Don't prototype libiberty functions.
	* malloc.c: Likewise.
	
diff -rup orig/egcs-CVS19981119/gcc/f/fini.c egcs-CVS19981119/gcc/f/fini.c
--- orig/egcs-CVS19981119/gcc/f/fini.c	Thu Nov 19 16:07:55 1998
+++ egcs-CVS19981119/gcc/f/fini.c	Fri Nov 20 15:52:59 1998
@@ -62,7 +62,7 @@ static FILE *out;
 static char prefix[32];
 static char postfix[32];
 static char storage[32];
-static char *spaces[]
+static char *xspaces[]
 =
 {
   "",				/* 0 */
@@ -636,7 +636,7 @@ testname (bool nested, int indent, name 
   int numhalf;
 
   assert (!nested || indent >= 2);
-  assert (((size_t) indent) + 4 < ARRAY_SIZE (spaces));
+  assert (((size_t) indent) + 4 < ARRAY_SIZE (xspaces));
 
   num = 0;
   numhalf = 0;
@@ -654,15 +654,15 @@ testname (bool nested, int indent, name 
 	     "\
 %s{\n\
 ",
-	     spaces[indent - 2]);
+	     xspaces[indent - 2]);
 
   fprintf (out,
 	   "\
 %sif ((c = ffesrc_strcmp_2c (ffe_case_match (), p, \"%s\", \"%s\", \"%s\")) == 0)\n\
 %sreturn %s%s%s;\n\
 ",
-	   spaces[indent], nhalf->name_uc, nhalf->name_lc, nhalf->name_ic,
-	   spaces[indent + 2], prefix, nhalf->kwname, postfix);
+	   xspaces[indent], nhalf->name_uc, nhalf->name_lc, nhalf->name_ic,
+	   xspaces[indent + 2], prefix, nhalf->kwname, postfix);
 
   if (num != 1)
     {
@@ -670,14 +670,14 @@ testname (bool nested, int indent, name 
 	       "\
 %selse if (c < 0)\n\
 ",
-	       spaces[indent]);
+	       xspaces[indent]);
 
       if (numhalf == 0)
 	fprintf (out,
 		 "\
 %s;\n\
 ",
-		 spaces[indent + 2]);
+		 xspaces[indent + 2]);
       else
 	testname (TRUE, indent + 4, first, nhalf->previous);
 
@@ -687,7 +687,7 @@ testname (bool nested, int indent, name 
 		   "\
 %selse\n\
 ",
-		   spaces[indent]);
+		   xspaces[indent]);
 
 	  testname (TRUE, indent + 4, nhalf->next, last);
 	}
@@ -698,7 +698,7 @@ testname (bool nested, int indent, name 
 	     "\
 %s}\n\
 ",
-	     spaces[indent - 2]);
+	     xspaces[indent - 2]);
 }
 
 void
@@ -710,7 +710,7 @@ testnames (bool nested, int indent, int 
   int numhalf;
 
   assert (!nested || indent >= 2);
-  assert (((size_t) indent) + 4 < ARRAY_SIZE (spaces));
+  assert (((size_t) indent) + 4 < ARRAY_SIZE (xspaces));
 
   num = 0;
   numhalf = 0;
@@ -728,15 +728,15 @@ testnames (bool nested, int indent, int 
 	     "\
 %s{\n\
 ",
-	     spaces[indent - 2]);
+	     xspaces[indent - 2]);
 
   fprintf (out,
 	   "\
 %sif ((c = ffesrc_strncmp_2c (ffe_case_match (), p, \"%s\", \"%s\", \"%s\", %d)) == 0)\n\
 %sreturn %s%s%s;\n\
 ",
-	   spaces[indent], nhalf->name_uc, nhalf->name_lc, nhalf->name_ic,
-	   len, spaces[indent + 2], prefix, nhalf->kwname, postfix);
+	   xspaces[indent], nhalf->name_uc, nhalf->name_lc, nhalf->name_ic,
+	   len, xspaces[indent + 2], prefix, nhalf->kwname, postfix);
 
   if (num != 1)
     {
@@ -744,14 +744,14 @@ testnames (bool nested, int indent, int 
 	       "\
 %selse if (c < 0)\n\
 ",
-	       spaces[indent]);
+	       xspaces[indent]);
 
       if (numhalf == 0)
 	fprintf (out,
 		 "\
 %s;\n\
 ",
-		 spaces[indent + 2]);
+		 xspaces[indent + 2]);
       else
 	testnames (TRUE, indent + 4, len, first, nhalf->previous);
 
@@ -761,7 +761,7 @@ testnames (bool nested, int indent, int 
 		   "\
 %selse\n\
 ",
-		   spaces[indent]);
+		   xspaces[indent]);
 
 	  testnames (TRUE, indent + 4, len, nhalf->next, last);
 	}
@@ -772,5 +772,5 @@ testnames (bool nested, int indent, int 
 	     "\
 %s}\n\
 ",
-	     spaces[indent - 2]);
+	     xspaces[indent - 2]);
 }
diff -rup orig/egcs-CVS19981119/gcc/f/g77spec.c egcs-CVS19981119/gcc/f/g77spec.c
--- orig/egcs-CVS19981119/gcc/f/g77spec.c	Thu Nov 19 16:07:57 1998
+++ egcs-CVS19981119/gcc/f/g77spec.c	Fri Nov 20 15:52:59 1998
@@ -92,8 +92,6 @@ static void (*g77_fn)();
 static int g77_newargc;
 static char **g77_newargv;
 
-extern char *xmalloc PROTO((size_t));
-
 extern char *version_string;
 
 /* --- This comes from gcc.c (2.8.1) verbatim: */
diff -rup orig/egcs-CVS19981119/gcc/f/malloc.c egcs-CVS19981119/gcc/f/malloc.c
--- orig/egcs-CVS19981119/gcc/f/malloc.c	Thu Nov 19 16:07:58 1998
+++ egcs-CVS19981119/gcc/f/malloc.c	Fri Nov 20 15:52:59 1998
@@ -33,10 +33,6 @@ the Free Software Foundation, 59 Temple 
 #include "proj.h"
 #include "malloc.h"
 
-/* Assume gcc/toplev.o is linked in.  */
-void *xmalloc (unsigned size);
-void *xrealloc (void *ptr, int size);
-
 /* Externals defined here.  */
 
 struct _malloc_root_ malloc_root_




Sun Nov 22 08:46:44 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (jc1, jv-scan): Link with $(SUBDIR_OBSTACK).

	* jv-scan.c: Fix xmalloc prototype.  Provide an xmalloc definition.
	
	* jvgenmain.c: Remove the xmalloc prototype, we get it from
	libiberty.h.  Provide an xmalloc definition.

	* jvspec.c: Remove the xmalloc prototype.

	* parse-scan.y: Include config.h and system.h.  Don't include
	OS headers or gansidecl.h.  Don't prototype xmalloc/xstrdup.
	Provide an xstrdup definition.
	
diff -rup orig/egcs-CVS19981119/gcc/java/Makefile.in egcs-CVS19981119/gcc/java/Makefile.in
--- orig/egcs-CVS19981119/gcc/java/Makefile.in	Thu Nov 19 16:08:11 1998
+++ egcs-CVS19981119/gcc/java/Makefile.in	Fri Nov 20 15:53:14 1998
@@ -196,11 +196,11 @@ compiler: ../jc1$(exeext) ../jv-scan$(ex
 ../jc1$(exeext): $(P) $(JAVA_OBJS) $(OBJDEPS) $(LIBDEPS)
 	rm -f ../jc1$(exeext)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-	      $(JAVA_OBJS) $(OBJS) $(LIBS)
+	      $(JAVA_OBJS) $(OBJS) $(SUBDIR_OBSTACK) $(LIBS)
 ../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) $(OBJDEPS) $(LIBDEPS)
 	rm -f ../jv-scan$(exeext)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-	      $(JAVA_OBJS_LITE) $(LIBS)
+	      $(JAVA_OBJS_LITE) $(SUBDIR_OBSTACK) $(LIBS)
 
 ../jcf-dump$(exeext): jcf-dump.o jcf-io.o jcf-depend.o jcf-path.o \
 		zextract.o
diff -rup orig/egcs-CVS19981119/gcc/java/jv-scan.c egcs-CVS19981119/gcc/java/jv-scan.c
--- orig/egcs-CVS19981119/gcc/java/jv-scan.c	Thu Nov 19 16:08:13 1998
+++ egcs-CVS19981119/gcc/java/jv-scan.c	Fri Nov 20 16:01:24 1998
@@ -34,7 +34,7 @@ void fatal VPROTO((char *s, ...));
 void warning VPROTO((char *s, ...));
 void gcc_obstack_init PROTO ((struct obstack *obstack));
 extern void reset_report PROTO ((void));
-extern char *xmalloc PROTO((size_t));
+extern PTR xmalloc PROTO((size_t));
 
 #define JC1_LITE
 #include "parse.h"
@@ -208,4 +208,15 @@ gcc_obstack_init (obstack)
   _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0,
 		  (void *(*) ()) OBSTACK_CHUNK_ALLOC,
 		  (void (*) ()) OBSTACK_CHUNK_FREE);
+}
+
+PTR
+xmalloc (size)
+  size_t size;
+{
+  register PTR val = (PTR) malloc (size);
+ 
+  if (val == 0)
+    fatal ("virtual memory exhausted");
+  return val;
 }
diff -rup orig/egcs-CVS19981119/gcc/java/jvgenmain.c egcs-CVS19981119/gcc/java/jvgenmain.c
--- orig/egcs-CVS19981119/gcc/java/jvgenmain.c	Thu Nov 19 16:08:13 1998
+++ egcs-CVS19981119/gcc/java/jvgenmain.c	Fri Nov 20 15:53:14 1998
@@ -35,8 +35,6 @@ const char class_mangling_prefix[] = "_C
 
 struct obstack name_obstack;
 
-extern char *xmalloc PROTO((size_t));
-
 void
 error (const char *str)
 {
@@ -110,4 +108,18 @@ main (int argc, const char **argv)
       exit (-1);
     }
   return 0;
+}
+
+PTR
+xmalloc (size)
+  size_t size;
+{
+  register PTR val = (PTR) malloc (size);
+ 
+  if (val == 0)
+    {
+      fprintf(stderr, "jvgenmain: virtual memory exhausted");
+      exit(FATAL_EXIT_CODE);
+    }
+  return val;
 }
diff -rup orig/egcs-CVS19981119/gcc/java/jvspec.c egcs-CVS19981119/gcc/java/jvspec.c
--- orig/egcs-CVS19981119/gcc/java/jvspec.c	Thu Nov 19 16:08:13 1998
+++ egcs-CVS19981119/gcc/java/jvspec.c	Fri Nov 20 15:53:00 1998
@@ -61,7 +61,6 @@ The Free Software Foundation is independ
 #define MATH_LIBRARY "-lm"
 #endif
 
-extern char *xmalloc PROTO((size_t));
 extern int do_spec		PROTO((char *));
 extern char *input_filename;
 extern size_t input_filename_length;
diff -rup orig/egcs-CVS19981119/gcc/java/parse-scan.y egcs-CVS19981119/gcc/java/parse-scan.y
--- orig/egcs-CVS19981119/gcc/java/parse-scan.y	Thu Nov 19 16:08:14 1998
+++ egcs-CVS19981119/gcc/java/parse-scan.y	Fri Nov 20 15:53:00 1998
@@ -37,12 +37,9 @@ definitions and other extensions.  */
 %{
 #define JC1_LITE
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "config.h"
+#include "system.h"
 
-/* Definitions for PROTO and VPROTO macros */
-#include "gansidecl.h"
 #include "obstack.h"
 
 extern char *input_filename;
@@ -91,10 +91,6 @@ struct method_declarator {
 static void report_class_declaration PROTO ((char *));
 static void report_main_declaration PROTO ((struct method_declarator *));
 
-/* Other extern functions */
-char *xmalloc PROTO ((unsigned));
-char *xstrdup PROTO ((char *));
-
 #include "lex.h"
 #include "parse.h"
 %}
@@ -1159,4 +1155,15 @@
 yyerror (msg)
      char *msg;
 {
+}
+
+char *
+xstrdup (s)
+     const char *s;
+{
+  char *ret;
+
+  ret = xmalloc (strlen (s) + 1);
+  strcpy (ret, s);
+  return ret;
 }
diff -rup orig/egcs-CVS19981119/gcc/java/parse-scan.c egcs-CVS19981119/gcc/java/parse-scan.c
--- orig/egcs-CVS19981119/gcc/java/parse-scan.c	Thu Nov 19 16:13:54 1998
+++ egcs-CVS19981119/gcc/java/parse-scan.c	Fri Nov 20 15:59:13 1998
@@ -117,12 +117,9 @@
 
 #define JC1_LITE
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "config.h"
+#include "system.h"
 
-/* Definitions for PROTO and VPROTO macros */
-#include "gansidecl.h"
 #include "obstack.h"
 
 extern char *input_filename;
@@ -171,10 +171,6 @@
 static void report_class_declaration PROTO ((char *));
 static void report_main_declaration PROTO ((struct method_declarator *));
 
-/* Other extern functions */
-char *xmalloc PROTO ((unsigned));
-char *xstrdup PROTO ((char *));
-
 #include "lex.h"
 #include "parse.h"
 
@@ -2401,4 +2401,15 @@ void
 yyerror (msg)
      char *msg;
 {
+}
+
+char *
+xstrdup (s)
+     const char *s;
+{
+  char *ret;
+
+  ret = xmalloc (strlen (s) + 1);
+  strcpy (ret, s);
+  return ret;
 }


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