autoconf between stages. was: java fails to build

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sun Jan 31 12:28:00 GMT 1999


 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > 
 >   > 	IMHO we need to do exactly what I said in my last message, which
 >   > is to test for inline for the stage1 compiler and assume gcc has it for
 >   > stage2 and later.  Give me a little time and I'll work something out
 >   > hopefully today or tomorrow and create a patch.
 > 
 > Let's look for a reasonably simple solution to get us through to egcs-1.2,

	Okay, see the attached patch.  Robert, does it allow your
bootstrap to succeed?  Jeff, is it okay to install?

		--Kaveh

Sun Jan 31 08:41:19 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* system.h (inline): Handle `inline' for stage2 (and later) gcc.

	* dwarf2out.c (inline): Don't define.

	* dwarfout.c (inline): Likewise.

diff -rup orig/egcs-CVS19990131/gcc/system.h egcs-CVS19990131/gcc/system.h
--- orig/egcs-CVS19990131/gcc/system.h	Sun Jan 31 08:43:11 1999
+++ egcs-CVS19990131/gcc/system.h	Sun Jan 31 11:59:39 1999
@@ -392,6 +392,14 @@ extern void abort ();
 # endif
 #endif /* ! STRINGIFY */
 
+/* Autoconf will possibly define the `inline' keyword as a macro,
+   however this is only valid for the stage1 compiler.  If we detect a
+   modern version of gcc, unconditionally reset the value of `inline'.
+   This makes sure the right thing happens in stage2 and later. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# undef inline
+# define inline __inline__  /* Modern gcc can use `__inline__' freely. */
+#endif /* GCC >= 2.7 */
 
 /* These macros are here in preparation for the use of gettext in egcs.  */
 #define _(String) String
diff -rup orig/egcs-CVS19990131/gcc/dwarf2out.c egcs-CVS19990131/gcc/dwarf2out.c
--- orig/egcs-CVS19990131/gcc/dwarf2out.c	Sun Jan 31 08:42:13 1999
+++ egcs-CVS19990131/gcc/dwarf2out.c	Sun Jan 31 12:02:46 1999
@@ -72,10 +72,6 @@ dwarf2out_do_frame ()
 
 #if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
 
-#ifndef __GNUC__
-#define inline
-#endif
-
 /* How to start an assembler comment.  */
 #ifndef ASM_COMMENT_START
 #define ASM_COMMENT_START ";#"
diff -rup orig/egcs-CVS19990131/gcc/dwarfout.c egcs-CVS19990131/gcc/dwarfout.c
--- orig/egcs-CVS19990131/gcc/dwarfout.c	Sun Jan 31 08:42:14 1999
+++ egcs-CVS19990131/gcc/dwarfout.c	Sun Jan 31 12:04:01 1999
@@ -63,10 +63,6 @@ extern char *getpwd PROTO((void));
 /* Note that the implementation of C++ support herein is (as yet) unfinished.
    If you want to try to complete it, more power to you.  */
 
-#if !defined(__GNUC__) || (NDEBUG != 1)
-#define inline
-#endif
-
 /* How to start an assembler comment.  */
 #ifndef ASM_COMMENT_START
 #define ASM_COMMENT_START ";#"




Sun Jan 31 08:41:19 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* input.c (inline): Don't define.

diff -rup orig/egcs-CVS19990131/gcc/cp/input.c egcs-CVS19990131/gcc/cp/input.c
--- orig/egcs-CVS19990131/gcc/cp/input.c	Sun Jan 31 08:41:42 1999
+++ egcs-CVS19990131/gcc/cp/input.c	Sun Jan 31 12:08:27 1999
@@ -53,12 +53,6 @@ static struct input_source *input, *free
 extern char *input_filename;
 extern int lineno;
 
-#ifdef __GNUC__
-#define inline __inline__
-#else
-#define inline
-#endif
-
 #if USE_CPPLIB
 extern unsigned char *yy_cur, *yy_lim;
 extern int yy_get_token ();




Sun Jan 31 08:41:19 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (gjavah.o): Depend on $(CONFIG_H) and system.h.

	* gjavah.c: Include config.h and system.h.

	* javaop.h (inline): Don't define.
	(WORD_TO_FLOAT, WORDS_TO_LONG, WORDS_TO_DOUBLE): Change these
	from `inline' to `static inline'.

	* jcf.h (inline): Don't define.

	* lex.c (inline): Likewise.

diff -rup orig/egcs-CVS19990131/gcc/java/Makefile.in egcs-CVS19990131/gcc/java/Makefile.in
--- orig/egcs-CVS19990131/gcc/java/Makefile.in	Sun Jan 31 08:42:57 1999
+++ egcs-CVS19990131/gcc/java/Makefile.in	Sun Jan 31 09:15:18 1999
@@ -275,7 +275,7 @@ force:
 
 parse.o: $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h
 jcf-dump.o: jcf-reader.c jcf.h javaop.h javaop.def
-gjavah.o: jcf-reader.c jcf.h javaop.h
+gjavah.o: $(CONFIG_H) $(srcdir)/../system.h jcf-reader.c jcf.h javaop.h
 buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \
   $(srcdir)/../system.h $(srcdir)/../toplev.h
 class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h $(PARSE_H) \
diff -rup orig/egcs-CVS19990131/gcc/java/gjavah.c egcs-CVS19990131/gcc/java/gjavah.c
--- orig/egcs-CVS19990131/gcc/java/gjavah.c	Sun Jan 31 08:42:58 1999
+++ egcs-CVS19990131/gcc/java/gjavah.c	Sun Jan 31 09:15:19 1999
@@ -24,16 +24,11 @@ The Free Software Foundation is independ
 
 /* Written by Per Bothner <bothner@cygnus.com>, February 1996. */
 
-#include <stdio.h>
+#include "config.h"
+#include "system.h"
 #include "jcf.h"
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#include <math.h>
-
-#include <string.h>
-
 #include "java-opcodes.h"
+#include <math.h>
 
 /* The output file.  */
 FILE *out = NULL;
diff -rup orig/egcs-CVS19990131/gcc/java/javaop.h egcs-CVS19990131/gcc/java/javaop.h
--- orig/egcs-CVS19990131/gcc/java/javaop.h	Sun Jan 31 08:42:58 1999
+++ egcs-CVS19990131/gcc/java/javaop.h	Sun Jan 31 12:01:25 1999
@@ -82,10 +82,6 @@ union Word {
 #define jword uint32
 #endif
 
-#if !defined(inline) && !defined(__GC__) && !defined(__cplusplus)
-#define inline static
-#endif
-
 #ifndef IMMEDIATE_u1
 #define IMMEDIATE_u1 (PC++, CHECK_PC_IN_RANGE(PC), BCODE[PC-1])
 #endif
@@ -106,14 +102,14 @@ union Word {
          | (BCODE[PC-2] << 8) | (BCODE[PC-1]))))
 #endif
 
-inline jfloat
+static inline jfloat
 WORD_TO_FLOAT(jword w)
 { union Word wu;
   wu.i = w;
   return wu.f;
 } 
 
-inline jlong
+static inline jlong
 WORDS_TO_LONG(jword hi, jword lo)
 {
   return ((jlong) hi << 32) | ((jlong)lo & (((jlong)1 << 32) -1));
@@ -125,7 +121,7 @@ union DWord {
   jword w[2];
 };
 
-inline jdouble
+static inline jdouble
 WORDS_TO_DOUBLE(jword hi, jword lo)
 { union DWord wu;
   wu.l = WORDS_TO_LONG(hi, lo);
diff -rup orig/egcs-CVS19990131/gcc/java/jcf.h egcs-CVS19990131/gcc/java/jcf.h
--- orig/egcs-CVS19990131/gcc/java/jcf.h	Sun Jan 31 08:42:59 1999
+++ egcs-CVS19990131/gcc/java/jcf.h	Sun Jan 31 12:06:28 1999
@@ -35,7 +35,6 @@ The Free Software Foundation is independ
 #define PTR             char *
 #define AND             ;
 #define DEFUN(name, arglist, args)      name arglist args;
-#define inline static
 #endif
 #endif /* !DEFUN */
 
diff -rup orig/egcs-CVS19990131/gcc/java/lex.c egcs-CVS19990131/gcc/java/lex.c
--- orig/egcs-CVS19990131/gcc/java/lex.c	Sun Jan 31 08:42:59 1999
+++ egcs-CVS19990131/gcc/java/lex.c	Sun Jan 31 12:10:58 1999
@@ -42,9 +42,6 @@ Addison Wesley 1996" ( http://java.sun.co
 #include <ctype.h>
 #endif
 
-#ifdef inline			/* javaop.h redefines inline as static */
-#undef inline
-#endif
 #include "keyword.h"
 
 #ifndef SEEK_SET



More information about the Gcc mailing list