public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: autoconf between stages. was: java fails to build
@ 1999-01-27 14:30 Mike Stump
  1999-01-27 15:06 ` Robert Lipe
  1999-01-31 23:58 ` Mike Stump
  0 siblings, 2 replies; 25+ messages in thread
From: Mike Stump @ 1999-01-27 14:30 UTC (permalink / raw)
  To: robertlipe; +Cc: egcs

> Date: Wed, 27 Jan 1999 14:52:05 -0600
> From: Robert Lipe <robertlipe@usa.net>

> > Do you autoconf with something other than gcc for stage1, and then use
> > gcc, but don't reautoconf, bad!

> Bingo.

> Yes, I was doing a full bootstrap which means that autoconf and stage1
> was run with a compiler that doesn't support 'inline'.  Therefore, we
> see:

> 	auto-host.h:#define inline

> Exactly what part of the Makefile is supposed to rerun autoconf to
> regenerate this between passes?

Someone submitted patches to do this, they were rejected as I recall.
So we don't rerun autocont.  Jeff Law I think had a solution
envisioned for this type of problem, but I don't recall now what it
was, or if it applied in this situation.

Sorry.

On a side not, if you bootstrap and install gcc (LANGUAGES=C), then
forever after only bootstrap with gcc, then it will work.  Quite a few
of us do that.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: autoconf between stages. was: java fails to build
@ 1999-01-31 12:28 Kaveh R. Ghazi
  1999-01-31 21:28 ` Robert Lipe
  0 siblings, 1 reply; 25+ messages in thread
From: Kaveh R. Ghazi @ 1999-01-31 12:28 UTC (permalink / raw)
  To: law; +Cc: egcs-patches, egcs, robertlipe

 > 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

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: autoconf between stages. was: java fails to build
@ 1999-01-30 11:12 Kaveh R. Ghazi
  1999-01-31 23:58 ` Kaveh R. Ghazi
  0 siblings, 1 reply; 25+ messages in thread
From: Kaveh R. Ghazi @ 1999-01-30 11:12 UTC (permalink / raw)
  To: jbuck; +Cc: egcs, law, mrs, robertlipe

 > From: Joe Buck <jbuck@Synopsys.COM>
 > 
 > > 	The general solution is _not_ to use autoconf tests for compiler
 > > characteristics.  E.g. prototypes, `const', gcc __attributes__, etc. 
 > > Instead we test compiler macros in {g}ansidecl.h so as the compiler
 > > changes, the test result changes with it.
 > ...
 > > 	The other way is to assume the autoconf test is only valid for
 > > the stage1 compiler and that stage2 gcc has the feature.  This is how
 > > STRINGIFY works. 
 > 
 > Actually, it would be safe to use autoconf to determine compiler
 > characteristics, but only to pay attention to its results when the
 > compiler is not gcc.  That is, include the autoconf-generated ones,
 > but then append something like
 > 
 > #ifdef __GNUC__
 > ... undef certain autoconf-symbols
 > ... define them to the a value appropriate for gcc
 > #endif


	I think that is in essence similar to the STRINGIFY example in
system.h:

 > /* Define a STRINGIFY macro that's right for ANSI or traditional C.
 >    HAVE_CPP_STRINGIFY only refers to the stage1 compiler.  Assume that
 >    (non-traditional) gcc used in stage2 or later has this feature.
 >  */
 > # if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__))
 > #  define STRINGIFY(STRING) #STRING
 > # else
 > #  define STRINGIFY(STRING) "STRING"
 > # endif


	Something like this is what I intend to do for `inline'.  We
also need to clean up scattered places where attempts where made to
handle inline.  (I.e.  the top level gcc dir in several places as well
as cp/ and java/ dirs each try to handle is separately now.)

	Here is my current thinking.  Assume we use `INLINE' as a proxy
everywhere, some files already do so.  We insert the following code into
system.h:

 > #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
 > # define INLINE inline /* Accept autoconf's handling of `inline'. */
 > #'else
 > # define INLINE __inline__  /* We are gcc, use `__inline__' freely. */
 > #endif /* GCC < 2.7 */

	Then we patch everywhere to use "static INLINE" and it all
magically works for all stages of the bootstrap and all stage1 compilers
(or so I hope...)  I'm going to create a patch and see if it works.
Stay tuned...

		--Kaveh

--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: autoconf between stages. was: java fails to build
@ 1999-01-30 10:41 Kaveh R. Ghazi
  1999-01-30 18:37 ` Jeffrey A Law
  0 siblings, 1 reply; 25+ messages in thread
From: Kaveh R. Ghazi @ 1999-01-30 10:41 UTC (permalink / raw)
  To: egcs, law, robertlipe

 > From: Robert Lipe <robertlipe@usa.net>
 > 
 > This implements Jeff's suggestion.  It is, of course, not really meant
 > to be applied.  It's meant as an existence proof that removing this line
 > of code solves problems.  Armed with this (and Joerne's loop.c fix that
 > was just committed) I'm now back in bootstrapsville.  Building Java no
 > longer croaks with duplicate defs when stage1 is built with a non-gcc
 > compiler.
 > 
 > If someone approves deleting this line and associated comment, I'll do
 > the commit.  I'm not at all sure that autoconf works as described in the
 > comment anyway...
 > 
 > >   > > bootstrapping on hosts that don't support 'inline' is now broken.
 > >   > > Point me in the right direction and I'll try to implement it.
 > >   >
 > >   > One possibility that comes to my mind is to grep -v '^#define
 > >   > inline' away from auto-host.h in the `stage1:' Makefile rule.
 > >
 > > Or remove it completely.  I'm not sure why Kenner added it.  Don't we
 > > already have code somewhere to conditionally define "inline" away?


	I don't think kenner added it explicitly.  I believe the
`inline' test is a by-product of the intl stuff.  In aclocal.m4, the
AM_GNU_GETTEXT macro does AC_REQUIRE([AC_C_INLINE]) which calls the test
for the inline keyword, iff it hasn't been run already. 

	Forgive me for saying so, but the approach below is completely
wrong.  The file config.in is a generated file.  If you remove the line
handling `inline' from config.in, it'll be reinserted the next time
someone patches configure.in and runs autoheader. 

	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.

		--Kaveh


 > 
 > Index: config.in
 > ===================================================================
 > RCS file: /egcs/carton/cvsfiles/egcs/gcc/config.in,v
 > retrieving revision 1.43
 > diff -u -p -r1.43 config.in
 > --- config.in   1999/01/27 01:41:58     1.43
 > +++ config.in   1999/01/30 05:57:55
 > @@ -146,8 +146,10 @@
 >  /* Define if you have the vprintf function.  */
 >  #undef HAVE_VPRINTF
 >  
 > +#if 0
 >  /* Define as __inline if that's what the C compiler calls it.  */
 >  #undef inline
 > +#endif
 >  
 >  /* Define to `long' if <sys/types.h> doesn't define.  */
 >  #undef off_t
 > 
 > 
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: autoconf between stages. was: java fails to build
@ 1999-01-29 13:55 Kaveh R. Ghazi
  1999-01-29 14:13 ` Joe Buck
  0 siblings, 1 reply; 25+ messages in thread
From: Kaveh R. Ghazi @ 1999-01-29 13:55 UTC (permalink / raw)
  To: mrs, robertlipe; +Cc: egcs, law

 > From: mrs@wrs.com (Mike Stump)
 >  
 > > Date: Wed, 27 Jan 1999 14:52:05 -0600
 > > From: Robert Lipe <robertlipe@usa.net>
 >  
 > > > Do you autoconf with something other than gcc for stage1, and then use
 > > > gcc, but don't reautoconf, bad!



	No, configure + "make bootstrap" with cc for stage1 is
supported.  If it doesn't work, we need to fix it. 




 > > Exactly what part of the Makefile is supposed to rerun autoconf to
 > > regenerate this between passes?
 >  
 > Someone submitted patches to do this, they were rejected as I recall.
 > So we don't rerun autocont.  Jeff Law I think had a solution
 > envisioned for this type of problem, but I don't recall now what it
 > was, or if it applied in this situation.


	That someone was me.  As you said, Jeff had some objection to
doing that so we ended up solving the specific problem another way, but
the issue of compiler characteristics changing between stage1 and stage2
still remains. 

	The general solution is _not_ to use autoconf tests for compiler
characteristics.  E.g. prototypes, `const', gcc __attributes__, etc. 
Instead we test compiler macros in {g}ansidecl.h so as the compiler
changes, the test result changes with it.

	The other way is to assume the autoconf test is only valid for
the stage1 compiler and that stage2 gcc has the feature.  This is how
STRINGIFY works. 

	I suspect we should do one of these for `inline'. 

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: java fails to build
@ 1999-01-27 11:33 Mike Stump
  1999-01-27 12:52 ` autoconf between stages. was: " Robert Lipe
  0 siblings, 1 reply; 25+ messages in thread
From: Mike Stump @ 1999-01-27 11:33 UTC (permalink / raw)
  To: robertlipe; +Cc: egcs

> The Linux linker seems to see the two symbols and not complain:

> $ nm class.o parse.o | grep WORDS_TO_D
> 0000002c t WORDS_TO_DOUBLE
> 0000002c t WORDS_TO_DOUBLE


> The SCO linkers see duplicate global definitions for the two symbols and
> fusses.

> $ nm class.o parse.o | grep WORDS_TO   
> [198]   |       124|      28|FUNC |GLOB |0    |1      |WORDS_TO_DOUBLE
> [199]   |        92|      31|FUNC |GLOB |0    |1      |WORDS_TO_LONG
> [493]   |       124|      28|FUNC |GLOB |0    |1      |WORDS_TO_DOUBLE
> [494]   |        92|      31|FUNC |GLOB |0    |1      |WORDS_TO_LONG

Ah, do:

make class.o CFLAGS=-E | more

in java, and look at the source:

static  double 
WORDS_TO_DOUBLE(uint32  hi, uint32  lo)
{ union DWord wu;
  wu.l = WORDS_TO_LONG(hi, lo);
  return wu.d;
} 

In the javaop.h file, I see:

inline jdouble
WORDS_TO_DOUBLE(jword hi, jword lo)
{ union DWord wu;
  wu.l = WORDS_TO_LONG(hi, lo);
  return wu.d;
} 

Do you -Dinline ?  Bad.  Do you compile with something other than gcc,
bad!  Do you autoconf with something other than gcc for stage1, and
then use gcc, but don't reautoconf, bad!

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~1999-01-31 23:58 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-27 14:30 autoconf between stages. was: java fails to build Mike Stump
1999-01-27 15:06 ` Robert Lipe
1999-01-28 10:41   ` Alexandre Oliva
1999-01-28 10:56     ` Jeffrey A Law
1999-01-29 22:20       ` Robert Lipe
1999-01-31 23:58       ` Jeffrey A Law
1999-01-31 23:58     ` Alexandre Oliva
1999-01-31 23:58   ` Robert Lipe
1999-01-31 23:58 ` Mike Stump
  -- strict thread matches above, loose matches on Subject: below --
1999-01-31 12:28 Kaveh R. Ghazi
1999-01-31 21:28 ` Robert Lipe
1999-01-30 11:12 Kaveh R. Ghazi
1999-01-31 23:58 ` Kaveh R. Ghazi
1999-01-30 10:41 Kaveh R. Ghazi
1999-01-30 18:37 ` Jeffrey A Law
1999-01-30 19:58   ` Robert Lipe
1999-01-31 23:58     ` Robert Lipe
1999-01-31 23:58   ` Jeffrey A Law
1999-01-29 13:55 Kaveh R. Ghazi
1999-01-29 14:13 ` Joe Buck
1999-01-29 19:08   ` Joern Rennecke
1999-01-29 19:11     ` Joe Buck
1999-01-29 19:34       ` Joern Rennecke
1999-01-27 11:33 Mike Stump
1999-01-27 12:52 ` autoconf between stages. was: " Robert Lipe
1999-01-31 23:58   ` Robert Lipe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).