From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GCC-REQUEST" 27-FEB-1992 01:44:30.18
To:	ARISIA::EVERHART
CC:	
Subj:	Re: GCC 2 & Pragma once in stream.h (for example)

From:	help-gcc-request@prep.ai.mit.edu@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.123)
	 id AA00970; Thu, 27 Feb 92 01:17:20 EST
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA13222; Tue, 25 Feb 92 16:29:29 EST
Return-Path: <help-gcc-request@prep.ai.mit.edu>
Received: from news.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA13118; Tue, 25 Feb 92 16:27:02 EST
Received: by news.cis.ohio-state.edu (5.61-kk/5.911008)
	id AA08963; Tue, 25 Feb 92 16:14:02 -0500
Received: from USENET by news.cis.ohio-state.edu with netnews
	for help-gcc@prep.ai.mit.edu (help-gcc@prep.ai.mit.edu);
	contact usenet@news.cis.ohio-state.edu if you have questions.
To: help-gcc@prep.ai.mit.edu
Date: 25 Feb 92 20:34:07 GMT
Message-Id: <JOOST.92Feb25213407@ori.cadlab.de>
Organization: CADLAB, Paderborn, FRG
From: joost@cadlab.de (Michael Joosten)
Sender: help-gcc-request@prep.ai.mit.edu
References: <9202232146.PN01084@LL.MIT.EDU>h
Reply-To: joost@cadlab.uni-paderborn.de
Subject: Re: GCC 2 & Pragma once in stream.h (for example)


In article <1992Feb24.043615.20786@leland.Stanford.EDU> schemers@jessica.stanford.edu (Roland Schemers) writes:

   In article <9202232146.PN01084@LL.MIT.EDU> marshall@ll.mit.edu (Hunter Marshall) writes:
   >I built gcc 2 on a sparc, sunos 4.1.1. Now it objects (vociferously)
   >to libg++-1.39's use of "#pragma once" (in the headers) , and it seems 
   >unable to resolve some symbols (it got worse after I recompiled libg++).

Ok, g++ fans, today I've just compiled libg++-1.40 and all the tests. But that
took a lot of time, especially because I had to fiddle around with the
sources..  But, alas, not everything worked - tMap failed, but only for
Skiptest, all the rest seems OK.

(hi Roland, thanks for your great lib!!)

0) Configure g++2.0 with using collect2 or link the old ld++ from 1.40 at the
proper place . The Makefile target 'install-collect2' makes it right. Thus you
use Sun's ld with dynamic linking !

1) Change the Makefile of libg++. I use 1.40. I beleive you MUST set
-DNO_GNULIB3 since __main is now in libgcc.a


2) Uncomment or remove all '#pragma once' in g++-include, g++-include/sys and
g++-include/gen like this for csh (sh : for i in ..... do ... od , I believe..)
 
foreach i (g++-include/* g++-include/sys/* g++-include/gen* )
sed 's/\#pragma once//' $i > temp
mv tmp $i
end

No, no patches - it's too simple and the patches would be endless...

3) There are indeed errors in GetOpt.cc, RNG.cc, gen/SkipSet.ccP,
gen/SkipMap.ccP and gen/SkipMap.ccP: 'Someone' forgot to initialize and define
some static member variables of these classes. I wonder if this ever worked
with cfront 2.0/2.1... Anyway, here a the patches:


*** /sun4_dh5/thomas/C++/libg++-1.40/src/RNG.cc Sun Jul  7 12:36:16 1991
--- src/RNG.cc  Tue Feb 25 17:45:04 1992
***************
*** 32,37 ****
--- 32,41 ----

  static char initialized = 0;

+ PrivateRNGSingleType RNG::singleMantissa; // mantissa bit vector
+ PrivateRNGDoubleType RNG::doubleMantissa; // mantissa bit vector
+
+
  RNG::RNG()
  {
    if (!initialized)


*** /sun4_dh5/thomas/C++/libg++-1.40/g++-include/GetOpt.h       Sun Jul  7 12:46
:24 1991
--- g++-include/GetOpt.h        Tue Feb 25 17:54:39 1992
***************
*** 79,85 ****
      of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
      `--' can cause `getopt' to return EOF with `optind' != ARGC.  */

!   static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering;

    /* Handle permutation of arguments.  */

--- 79,85 ----
      of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
      `--' can cause `getopt' to return EOF with `optind' != ARGC.  */

!   static enum Order { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering;

    /* Handle permutation of arguments.  */


*** /sun4_dh5/thomas/C++/libg++-1.40/src/GetOpt.cc      Sun Jul  7 12:46:28 1991
--- src/GetOpt.cc       Tue Feb 25 18:04:46 1992
***************
*** 19,24 ****
--- 19,29 ----
  #endif
  #include <GetOpt.h>

+ char *GetOpt::nextchar = (char*)0;
+ int   GetOpt::last_nonopt = 0;
+ int   GetOpt::first_nonopt = 0;
+ GetOpt::Order GetOpt::ordering = REQUIRE_ORDER;
+
  GetOpt::GetOpt (int argc, char **argv, char *optstring): opterr (1)
  {
    /* Initialize the internal data when the first call is made.

*** /sun4_dh5/thomas/C++/libg++-1.40/g++-include/gen/SkipSet.ccP        Sat Jul
13 16:20:40 1991
--- g++-include/gen/SkipSet.ccP Tue Feb 25 19:20:30 1992
***************
*** 26,31 ****
--- 26,34 ----

  #include "<T>.SkipSet.h"

+ int <T>SkipSetinit::count = 0;
+ MLCG * <T>SkipSet::gen = (MLCG *)0;
+
  static int countbits(long bits)
  {
     int n = 0;

*** /sun4_dh5/thomas/C++/libg++-1.40/g++-include/gen/SkipMap.ccP        Sat Jul
13 16:20:38 1991
--- g++-include/gen/SkipMap.ccP Tue Feb 25 18:55:42 1992
***************
*** 29,34 ****
--- 29,38 ----
   *
   */

+ int <T><C>SkipMapinit::count = 0;
+ MLCG * <T><C>SkipMap::gen = (MLCG*)0;
+
+
  static int countbits(long bits)
  {
    int n = 0;

*** /sun4_dh5/thomas/C++/libg++-1.40/g++-include/gen/SkipBag.ccP        Sat Jul
13 16:20:40 1991
--- g++-include/gen/SkipBag.ccP Tue Feb 25 18:40:41 1992
***************
*** 26,31 ****
--- 26,34 ----
  #include <assert.h>
  #include "<T>.SkipBag.h"

+ int <T>SkipBaginit::count = 0;
+ MLCG * <T>SkipBag::gen = (MLCG*)0;
+
  static int countbits(long bits)
  {
     int n = 0;

And now hit 'make src' (should work now, I hope - on SunOS 4.1.1 it does).
It will spit out a lot of warnings due to conversion/assignments/comparisions
between signed and unsigned values and so on. Time: 20-30 min

And then 'make tests'. The best is to do that not on your machine since it
just took something around a full hour on my comrade's SLC (hah!)...

Well, and on a SPARC the final diff bails out since tMap has failed.
Splaytest is fine, Skiptest not so quite and then an assertion bites:

*** expected.out	Sat Jul 13 16:29:56 1991
--- my.out	Tue Feb 25 21:03:23 1992
***************
*** 960,983 ****
  a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...]
  b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...]
  c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...]
! d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...]
! VHtest
! a: [(36, 25) (20, 22) (89, 56) (13, 61) (64, 49) (3, 96) (26, 63) (91, 55) (16, 84) (39, 54) (62, 5) (29, 50) (85, 92) (87, 7) (42, 94) (65, 47) (98, 8) (19, 26) (78, 91) (37, 33) ...]
! b: [(36, 4) (20, 83) (34, 18) (85, 38) (68, 84) (3, 2) (26, 19) (14, 76) (16, 57) (39, 23) (62, 90) (29, 53) (52, 14) (46, 34) (42, 21) (65, 1) (37, 73) (19, 15) (78, 95) (80, 86) ...]
! c: [(36, 161) (20, 93) (34, 185) (85, 45) (68, 7) (3, 197) (26, 101) (14, 137) (16, 35) (39, 77) (62, 177) (29, 83) (52, 117) (46, 143) (42, 121) (65, 3) (37, 157) (19, 173) (78, 97) (80, 139) ...]
! d: [(72, 72) (77, 77) (13, 13) (3, 3) (26, 26) (16, 16) (39, 39) (29, 29) (52, 52) (42, 42) (65, 65) (55, 55) (78, 78) (91, 91) (9, 9) (22, 22) (35, 35) (48, 48) (61, 61) (74, 74) ...]
! CHtest
! a: [(72, 66) (36, 25) (85, 92) (49, 10) (13, 61) (3, 96) (98, 8) (62, 5) (26, 63) (16, 84) (75, 51) (39, 54) (29, 50) (88, 81) (52, 32) (42, 94) (6, 9) (65, 47) (55, 45) (19, 26) ...]
! b: [(72, 41) (36, 4) (49, 64) (13, 50) (85, 38) (3, 2) (62, 90) (98, 82) (26, 19) (16, 57) (75, 80) (39, 23) (29, 53) (88, 100) (52, 14) (6, 30) (42, 21) (65, 1) (55, 91) (19, 15) ...]
! c: [(72, 53) (36, 161) (49, 67) (13, 171) (85, 45) (3, 197) (62, 177) (98, 95) (26, 101) (16, 35) (75, 25) (39, 77) (29, 83) (88, 47) (52, 117) (6, 135) (42, 121) (65, 3) (55, 89) (19, 173) ...]
! d: [(36, 36) (72, 72) (13, 13) (49, 49) (85, 85) (3, 3) (26, 26) (62, 62) (98, 98) (16, 16) (39, 39) (75, 75) (29, 29) (52, 52) (88, 88) (6, 6) (42, 42) (65, 65) (19, 19) (55, 55) ...]
! AVLtest
! a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...]
! b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...]
! c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...]
! d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...]
! RAVLtest
! a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...]
! b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...]
! c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...]
! d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...]
--- 960,966 ----
  a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...]
  b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...]
  c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...]
! d: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...]
! Failed assertion `b[a[j]] == j' at line 144 of `tMap.cc'.
! /bin/sh: 18821 Abort - core dumped
! gmake[2]: *** [runtests] Error 134


So far for today... Now it's 9 pm and I'm as hungry as the proverbial wolf..

Michael
--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Michael Joosten   |       Tel.  : (+49) (+) 5251-284 120                 |
| CADLAB            |       Fax   : (+49) (+) 5251-284 140                 |
| Bahnhofstr. 32    |       E-Mail: joost@cadlab.de                        |
| D-4790 Paderborn  |        	    ...!uunet!unido!cadlab!joost           | 
| FRG               | Mass mail to: joost@pbinfo.uni-paderborn.de          |
|--------------------------------------------------------------------------|
| CADLAB is a cooperation between Uni-GH Paderborn & SNI AG                |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~