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]

Re: Segmentation fault building libg++ without named returns


The enclosed patch works around the previous problem.  However, the are still
problems which appear unrelated to this patch.

The tFix test fails.  Not sure what is going on here but for most of the
other classes there seems to be weak definitions for the class constructors,
etc.  Here is the log:

spawn /home/dave/gnu/gcc-2.96/objdir/gcc/xgcc -B/home/dave/gnu/gcc-2.96/objdir/gcc/ ../../../../libg++/testsuite/libg++.tests/../../tests/tFix.cc libtest.a -L/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu//libg++ -I.. -I../../../../libg++ -I. -I/home/dave/gnu/gcc-2.96/libg++ -I/home/dave/gnu/gcc-2.96/libg++/src -I/home/dave/gnu/gcc-2.96/libstdc++ -I/home/dave/gnu/gcc-2.96/libstdc++/stl -I/home/dave/gnu/gcc-2.96/libio -I/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu/libio -L/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu//libg++ -L/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu//libstdc++ -L/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu//libiberty -L/home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu/libio -lg++ -lstdc++ -lm -o /home/dave/gnu/gcc-2.96/objdir/i686-pc-linux-gnu/libg++/testsuite/tFix 
/tmp/ccPgMFw1.o: In function `check(char const *, Fix)':
/tmp/ccPgMFw1.o(.text+0x3e): undefined reference to `operator<<(ostream &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x59): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x6b): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o: In function `checkb(char const *, Fix)':
/tmp/ccPgMFw1.o(.text+0x1f0): undefined reference to `length(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x232): undefined reference to `operator<<(ostream &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x26e): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x280): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o: In function `main':
/tmp/ccPgMFw1.o(.text+0x2f8): undefined reference to `Fix::Fix(void)'
/tmp/ccPgMFw1.o(.text+0x30b): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x335): undefined reference to `Fix::Fix(double)'
/tmp/ccPgMFw1.o(.text+0x348): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x371): undefined reference to `Fix::Fix(int, double)'
/tmp/ccPgMFw1.o(.text+0x384): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x3b0): undefined reference to `Fix::Fix(int, double)'
/tmp/ccPgMFw1.o(.text+0x3c3): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x3ea): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x3fd): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x42b): undefined reference to `Fix::operator=(double)'
/tmp/ccPgMFw1.o(.text+0x456): undefined reference to `Fix::operator=(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x481): undefined reference to `Fix::operator=(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x4ac): undefined reference to `Fix::operator=(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x4da): undefined reference to `Fix::operator=(double)'
/tmp/ccPgMFw1.o(.text+0x501): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x528): undefined reference to `operator==(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x550): undefined reference to `Fix::operator=(double)'
/tmp/ccPgMFw1.o(.text+0x561): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x574): undefined reference to `operator==(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x595): undefined reference to `operator!=(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x5b6): undefined reference to `operator>(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x5d7): undefined reference to `operator<=(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x5fc): undefined reference to `Fix::operator=(double)'
/tmp/ccPgMFw1.o(.text+0x60d): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x68f): undefined reference to `Fix::operator+(void)'
/tmp/ccPgMFw1.o(.text+0x69c): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x6c3): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0x6ee): undefined reference to `operator+(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x719): undefined reference to `operator-(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x744): undefined reference to `operator*(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x76d): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x796): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x7c8): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0x7da): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x7ff): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x81d): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0x82f): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x854): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x869): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x892): undefined reference to `operator%(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x8bb): undefined reference to `operator%(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x8e6): undefined reference to `operator/(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0x90f): undefined reference to `operator<<(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x941): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0x953): undefined reference to `operator>>(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0x978): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0x994): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0x9a9): undefined reference to `abs(Fix)'
/tmp/ccPgMFw1.o(.text+0x9d9): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0x9ee): undefined reference to `abs(Fix)'
/tmp/ccPgMFw1.o(.text+0xa14): undefined reference to `sgn(Fix const &)'
/tmp/ccPgMFw1.o(.text+0xa3b): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0xa47): undefined reference to `sgn(Fix const &)'
/tmp/ccPgMFw1.o(.text+0xa66): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xaa3): undefined reference to `Fix::Fix(double)'
/tmp/ccPgMFw1.o(.text+0xad1): undefined reference to `Fix::Fix(double)'
/tmp/ccPgMFw1.o(.text+0xae7): undefined reference to `Fix::Fix(Fix const &)'
/tmp/ccPgMFw1.o(.text+0xb18): undefined reference to `operator/(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xb51): undefined reference to `Fix::Fix(double)'
/tmp/ccPgMFw1.o(.text+0xb6a): undefined reference to `operator/(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xb95): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xbb0): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0xc06): undefined reference to `operator+(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xc43): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0xc58): undefined reference to `operator-(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xc83): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xc9b): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0xcf1): undefined reference to `operator+(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xd2e): undefined reference to `Fix::operator-(void)'
/tmp/ccPgMFw1.o(.text+0xd43): undefined reference to `operator-(Fix const &, Fix const &)'
/tmp/ccPgMFw1.o(.text+0xd6e): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xd86): undefined reference to `operator*(Fix const &, int)'
/tmp/ccPgMFw1.o(.text+0xdae): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xdbf): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xdd0): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xde1): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xdf2): undefined reference to `Fix::~Fix(void)'
/tmp/ccPgMFw1.o(.text+0xe03): more undefined references to `Fix::~Fix(void)' follow
collect2: ld returned 1 exit status
compiler exited with status 1
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-09-08  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* BitSet.cc, BitString.cc, BitString.h, Integer.cc, Integer.h,
	Rational.cc, Rational.h, String.cc, String.h: Don't use named returns.

--- libg++-2.8.1.3-20000816/libg++/src/BitSet.cc	Thu Dec 17 09:34:11 1998
+++ libg++-2.8.1.3-20000908/libg++/src/BitSet.cc	Fri Sep  8 16:17:10 2000
@@ -924,62 +924,6 @@
   return r;
 }
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-BitSet atoBitSet(const char* s, char f, char t, char star) return r
-{
-  unsigned int sl = strlen(s);
-  if (sl != 0)
-  {
-    r.rep = BitSetresize(r.rep, sl / BITSETBITS + 1);
-    _BS_word* rs = r.rep->s;
-    _BS_word a = 0;
-    _BS_word m = 1;
-    char lastch = 0;
-    unsigned int i = 0;
-    unsigned int l = 1;
-    for(;;)
-    {
-      char ch = s[i];
-      if (ch == t)
-        a |= m;
-      else if (ch == star)
-      {
-        if ((r.rep->virt = (lastch == t)))
-          *rs = a | ~(m - 1);
-        else
-          *rs = a;
-        break;
-      }
-      else if (ch != f)
-      {
-        *rs = a;
-        break;
-      }
-      lastch = ch;
-      if (++i == sl)
-      {
-        *rs = a;
-        break;
-      }
-      else if (i % BITSETBITS == 0)
-      {
-        *rs++ = a;
-        a = 0;
-        m = 1;
-        ++l;
-      }
-      else
-        m <<= 1;
-    }
-    r.rep->len = l;
-    trim(r.rep);
-  }
-  return;
-}
-
-#else
-
 BitSet atoBitSet(const char* s, char f, char t, char star) 
 {
   BitSet r;
@@ -1033,8 +977,6 @@
   return r;
 }
 
-#endif
-
 ostream& operator << (ostream& s, const BitSet& x)
 {
   if (s.opfx())
--- libg++-2.8.1.3-20000816/libg++/src/BitString.cc	Thu May 25 00:31:32 2000
+++ libg++-2.8.1.3-20000908/libg++/src/BitString.cc	Fri Sep  8 16:30:11 2000
@@ -1258,23 +1258,10 @@
   return _substr(first, rep->len - first);
 }
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-#define RETURN(r) return
-#define RETURNS(r) return r;
-#define RETURN_OBJECT(TYPE, NAME) /* nothing */
-#define USE_UNSIGNED 1 /* probably correct */
-#else /* _G_NO_NRV */
-#define RETURN(r) return r
-#define RETURNS(r) /* nothing */
-#define RETURN_OBJECT(TYPE, NAME) TYPE NAME;
-#define USE_UNSIGNED 0 /* probably old bug */
-#endif
-
 BitString
 common_prefix (const BitString& x, const BitString& y, _G_int32_t startpos)
-     RETURNS(r)
 {
-  RETURN_OBJECT(BitString, r);
+  BitString r;
   _G_uint32_t  xl = x.rep->len;
   _G_uint32_t  yl = y.rep->len;
 
@@ -1288,7 +1275,7 @@
     startx = starty = startpos;
 
   if (startx >= xl || starty >= yl)
-    RETURN(r);
+    return r;
 
   const _BS_word* xs = &(x.rep->s[BitStr_index(startx)]);
   _BS_word a = *xs++;
@@ -1310,15 +1297,14 @@
       b = *ys++;
   }
   r.rep = BStr_alloc(0, x.rep->s, startx, xp, xp - startx);
-  RETURN(r);
+  return r;
 }
 
 
 BitString
 common_suffix (const BitString& x, const BitString& y, _G_int32_t startpos)
-     RETURNS(r)
 {
-  RETURN_OBJECT(BitString, r);
+  BitString r;
   _G_uint32_t  xl = x.rep->len;
   _G_uint32_t  yl = y.rep->len;
 
@@ -1332,7 +1318,7 @@
     startx = starty = startpos;
 
   if (startx >= xl || starty >= yl)
-    RETURN(r);
+    return r;
 
   const _BS_word* xs = &(x.rep->s[BitStr_index(startx)]);
   _BS_word a = *xs--;
@@ -1354,13 +1340,12 @@
       b = *ys--;
   }
   r.rep = BStr_alloc(0, x.rep->s, xp+1, startx+1, startx - xp);
-  RETURN(r);
+  return r;
 }
 
 BitString reverse (const BitString& x)
-     RETURNS(r)
 {
-  RETURN_OBJECT(BitString, r);
+  BitString r;
   _G_uint32_t yl = x.rep->len;
   BitStrRep* y = BStr_resize(0, yl);
   if (yl > 0)
@@ -1390,14 +1375,13 @@
     }
   }
   r.rep = y;
-  RETURN(r);
+  return r;
 }
 
 BitString
 atoBitString (const char* s, char f, char t)
-     RETURNS(res)
 {
-  RETURN_OBJECT(BitString, res);
+  BitString res;
   _G_uint32_t sl = strlen(s);
   BitStrRep* r = BStr_resize(0, sl);
   if (sl != 0)
@@ -1435,14 +1419,13 @@
     r = BStr_resize(r, rl);
   }
   res.rep = r;
-  RETURN(res);
+  return res;
 }
 
 BitPattern
 atoBitPattern (const char* s, char f,char t,char x)
-     RETURNS(r)
 {
-  RETURN_OBJECT(BitPattern, r);
+  BitPattern r;
   _G_uint32_t sl = strlen(s);
   if (sl != 0)
   {
@@ -1494,7 +1477,7 @@
     r.pattern.rep = BStr_resize(r.pattern.rep, rl);
     r.mask.rep = BStr_resize(r.mask.rep, rl);
   }
-  RETURN(r);
+  return r;
 }
 
 extern AllocRing _libgxx_fmtq;
--- libg++-2.8.1.3-20000816/libg++/src/Integer.cc	Thu May 25 00:31:32 2000
+++ libg++-2.8.1.3-20000908/libg++/src/Integer.cc	Fri Sep  8 16:32:53 2000
@@ -1907,41 +1907,6 @@
   return dest;
 }
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-Integer sqrt(const Integer& x) return r(x)
-{
-  int s = sign(x);
-  if (s < 0) x.error("Attempted square root of negative Integer");
-  if (s != 0)
-  {
-    r >>= (lg(x) / 2); // get close
-    Integer q;
-    div(x, r, q);
-    while (q < r)
-    {
-      r += q;
-      r >>= 1;
-      div(x, r, q);
-    }
-  }
-  return;
-}
-
-Integer lcm(const Integer& x, const Integer& y) return r
-{
-  if (!x.initialized() || !y.initialized())
-    x.error("operation on uninitialized Integer");
-  Integer g;
-  if (sign(x) == 0 || sign(y) == 0)
-    g = 1;
-  else 
-    g = gcd(x, y);
-  div(x, g, r);
-  mul(r, y, r);
-}
-
-#else 
 Integer sqrt(const Integer& x) 
 {
   Integer r(x);
@@ -1977,10 +1942,6 @@
   return r;
 }
 
-#endif
-
-
-
 IntRep* atoIntRep(const char* s, int base)
 {
   int sl = strlen(s);
--- libg++-2.8.1.3-20000816/libg++/src/Rational.cc	Sat Jun 24 12:45:36 1995
+++ libg++-2.8.1.3-20000908/libg++/src/Rational.cc	Fri Sep  8 16:35:23 2000
@@ -193,78 +193,6 @@
   return pow(x, yy);
 }               
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-Rational operator - (const Rational& x) return r(x)
-{
-  r.negate();
-}
-
-Rational abs(const Rational& x) return r(x)
-{
-  if (sign(r.num) < 0) r.negate();
-}
-
-
-Rational sqr(const Rational& x) return r
-{
-  mul(x.num, x.num, r.num);
-  mul(x.den, x.den, r.den);
-  r.normalize();
-}
-
-Integer floor(const Rational& x) return q
-{
-  Integer r;
-  divide(x.num, x.den, q, r);
-  if (sign(x.num) < 0 && sign(r) != 0) --q;
-}
-
-Integer ceil(const Rational& x) return q
-{
-  Integer  r;
-  divide(x.num, x.den, q, r);
-  if (sign(x.num) >= 0 && sign(r) != 0) ++q;
-}
-
-Integer round(const Rational& x) return q
-{
-  Integer r;
-  divide(x.num, x.den, q, r);
-  r <<= 1;
-  if (ucompare(r, x.den) >= 0)
-  {
-    if (sign(x.num) >= 0)
-      ++q;
-    else
-      --q;
-  }
-}
-
-// power: no need to normalize since num & den already relatively prime
-
-Rational pow(const Rational& x, long y) return r
-{
-  if (y >= 0)
-  {
-    pow(x.num, y, r.num);
-    pow(x.den, y, r.den);
-  }
-  else
-  {
-    y = -y;
-    pow(x.num, y, r.den);
-    pow(x.den, y, r.num);
-    if (sign(r.den) < 0)
-    {
-      r.num.negate();
-      r.den.negate();
-    }
-  }
-}
-
-#else
-
 Rational operator - (const Rational& x) 
 {
   Rational r(x); r.negate(); return r;
@@ -343,8 +271,6 @@
   return r;
 }
 
-#endif
-
 ostream& operator << (ostream& s, const Rational& y)
 {
   if (y.denominator() == 1L)
--- libg++-2.8.1.3-20000816/libg++/src/Rational.h	Sat Jun 24 12:45:37 1995
+++ libg++-2.8.1.3-20000908/libg++/src/Rational.h	Fri Sep  8 16:11:56 2000
@@ -242,30 +242,6 @@
 }
 #endif
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-inline Rational operator + (const Rational& x, const Rational& y) return r
-{
-  add(x, y, r);
-}
-
-inline Rational operator - (const Rational& x, const Rational& y) return r
-{
-  sub(x, y, r);
-}
-
-inline Rational operator * (const Rational& x, const Rational& y) return r
-{
-  mul(x, y, r);
-}
-
-inline Rational operator / (const Rational& x, const Rational& y) return r
-{
-  div(x, y, r);
-}
-
-#else /* NO_NRV */
-
 inline Rational operator + (const Rational& x, const Rational& y) 
 {
   Rational r; add(x, y, r); return r;
@@ -285,6 +261,5 @@
 {
   Rational r; div(x, y, r); return r;
 }
-#endif
 
 #endif
--- libg++-2.8.1.3-20000816/libg++/src/String.cc	Thu Dec 17 09:34:11 1998
+++ libg++-2.8.1.3-20000908/libg++/src/String.cc	Fri Sep  8 16:38:56 2000
@@ -966,19 +966,9 @@
 }
 
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-#define RETURN(r) return
-#define RETURNS(r) return r;
-#define RETURN_OBJECT(TYPE, NAME) /* nothing */
-#else /* _G_NO_NRV */
-#define RETURN(r) return r
-#define RETURNS(r) /* nothing */
-#define RETURN_OBJECT(TYPE, NAME) TYPE NAME;
-#endif
-
-String join(String src[], int n, const String& separator) RETURNS(x)
+String join(String src[], int n, const String& separator)
 {
-  RETURN_OBJECT(String,x)
+  String x;
   String sep = separator;
   int xlen = 0;
   int i;
@@ -998,7 +988,7 @@
     j += sep.length();
   }
   ncopy0(src[i].chars(), &(x.rep->s[j]), src[i].length());
-  RETURN(x);
+  return x;
 }
   
 /*
@@ -1078,58 +1068,6 @@
   return dest;
 }
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-String replicate(char c, int n) return w;
-{
-  w.rep = Sresize(w.rep, n);
-  char* p = w.rep->s;
-  while (n-- > 0) *p++ = c;
-  *p = 0;
-}
-
-String replicate(const String& y, int n) return w
-{
-  int len = y.length();
-  w.rep = Sresize(w.rep, n * len);
-  char* p = w.rep->s;
-  while (n-- > 0)
-  {
-    ncopy(y.chars(), p, len);
-    p += len;
-  }
-  *p = 0;
-}
-
-String common_prefix(const String& x, const String& y, int startpos) return r;
-{
-  const char* xchars = x.chars();
-  const char* ychars = y.chars();
-  const char* xs = &(xchars[startpos]);
-  const char* ss = xs;
-  const char* topx = &(xchars[x.length()]);
-  const char* ys = &(ychars[startpos]);
-  const char* topy = &(ychars[y.length()]);
-  int l;
-  for (l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l);
-  r.rep = Salloc(r.rep, ss, l, l);
-}
-
-String common_suffix(const String& x, const String& y, int startpos) return r;
-{
-  const char* xchars = x.chars();
-  const char* ychars = y.chars();
-  const char* xs = &(xchars[x.length() + startpos]);
-  const char* botx = xchars;
-  const char* ys = &(ychars[y.length() + startpos]);
-  const char* boty = ychars;
-  int l;
-  for (l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l);
-  r.rep = Salloc(r.rep, ++xs, l, l);
-}
-
-#else
-
 String replicate(char c, int n)
 {
   String w;
@@ -1186,8 +1124,6 @@
   return r;
 }
 
-#endif
-
 // IO
 
 istream& operator>>(istream& s, String& x)
--- libg++-2.8.1.3-20000816/libg++/src/String.h	Sat Jun 24 12:45:38 1995
+++ libg++-2.8.1.3-20000908/libg++/src/String.h	Fri Sep  8 16:15:43 2000
@@ -696,80 +696,6 @@
 
 // constructive concatenation
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-inline String operator + (const String& x, const String& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const String& x, const SubString& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const String& x, const char* y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const String& x, char y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const SubString& x, const String& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const SubString& x, const SubString& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const SubString& x, const char* y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const SubString& x, char y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const char* x, const String& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String operator + (const char* x, const SubString& y) return r;
-{
-  cat(x, y, r);
-}
-
-inline String reverse(const String& x) return r;
-{
-  r.rep = Sreverse(x.rep, r.rep);
-}
-
-inline String upcase(const String& x) return r;
-{
-  r.rep = Supcase(x.rep, r.rep);
-}
-
-inline String downcase(const String& x) return r;
-{
-  r.rep = Sdowncase(x.rep, r.rep);
-}
-
-inline String capitalize(const String& x) return r;
-{
-  r.rep = Scapitalize(x.rep, r.rep);
-}
-
-#else /* NO_NRV */
-
 inline String operator + (const String& x, const String& y)
 {
   String r;  cat(x, y, r);  return r;
@@ -840,8 +766,6 @@
   String r; r.rep = Scapitalize(x.rep, r.rep); return r;
 }
 
-#endif
-
 // prepend
 
 inline void String::prepend(const String& y)
--- libg++-2.8.1.3-20000816/libg++/src/BitString.h	Thu May 25 00:31:32 2000
+++ libg++-2.8.1.3-20000908/libg++/src/BitString.h	Fri Sep  8 18:26:14 2000
@@ -499,68 +499,19 @@
   ::complement(*this, *this);
 }
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-inline BitString  operator & (const BitString& x, const BitString& y) return r
-{
-  and_f(x, y, r);
-}
-
-inline BitString  operator | (const BitString& x, const BitString& y) return r
-{
-  or_f(x, y, r);
-}
-
-inline BitString  operator ^ (const BitString& x, const BitString& y) return r
-{
-  xor_f(x, y, r);
-}
-
-inline BitString  operator << (const BitString& x, _G_int32_t y) return r
-{
-  lshift(x, y, r);
-}
-
-inline BitString  operator >> (const BitString& x, _G_int32_t y) return r
-{
-  rshift(x, y, r);
-}
-
-inline BitString  operator - (const BitString& x, const BitString& y) return r
-{
-  diff(x, y, r);
-}
-
-inline BitString  operator + (const BitString& x, const BitString& y) return r
-{
-  cat(x, y, r);
-}
-
-inline BitString  operator + (const BitString& x, _G_uint32_t y) return r
-{
-  cat(x, y, r);
-}
-
-inline BitString  operator ~ (const BitString& x) return r
-{
-  complement(x, r);
-}
-
-#else /* NO_NRV */
-
 inline BitString  operator & (const BitString& x, const BitString& y) 
 {
-  BitString r; and(x, y, r); return r;
+  BitString r; and_f(x, y, r); return r;
 }
 
 inline BitString  operator | (const BitString& x, const BitString& y) 
 {
-  BitString r; or(x, y, r); return r;
+  BitString r; or_f(x, y, r); return r;
 }
 
 inline BitString  operator ^ (const BitString& x, const BitString& y) 
 {
-  BitString r; xor(x, y, r); return r;
+  BitString r; xor_f(x, y, r); return r;
 }
 
 inline BitString  operator << (const BitString& x, _G_int32_t y) 
@@ -593,8 +544,6 @@
   BitString r; complement(x, r); return r;
 }
 
-#endif
-
 // status, matching
 
 inline _G_int32_t BitString::length() const
--- libg++-2.8.1.3-20000816/libg++/src/Integer.h	Thu May 25 00:31:32 2000
+++ libg++-2.8.1.3-20000908/libg++/src/Integer.h	Fri Sep  8 18:18:53 2000
@@ -761,187 +761,6 @@
 
 // constructive operations 
 
-#if defined(__GNUG__) && !defined(_G_NO_NRV)
-
-inline Integer  operator +  (const Integer& x, const Integer& y) return r
-{
-  add(x, y, r);
-}
-
-inline Integer  operator +  (const Integer& x, long y) return r
-{
-  add(x, y, r);
-}
-
-inline Integer  operator +  (long  x, const Integer& y) return r
-{
-  add(x, y, r);
-}
-
-inline Integer  operator -  (const Integer& x, const Integer& y) return r
-{
-  sub(x, y, r);
-}
-
-inline Integer  operator -  (const Integer& x, long y) return r
-{
-  sub(x, y, r);
-}
-
-inline Integer  operator -  (long  x, const Integer& y) return r
-{
-  sub(x, y, r);
-}
-
-inline Integer  operator *  (const Integer& x, const Integer& y) return r
-{
-  mul(x, y, r);
-}
-
-inline Integer  operator *  (const Integer& x, long y) return r
-{
-  mul(x, y, r);
-}
-
-inline Integer  operator *  (long  x, const Integer& y) return r
-{
-  mul(x, y, r);
-}
-
-inline Integer sqr(const Integer& x) return r
-{
-  mul(x, x, r);
-}
-
-inline Integer  operator &  (const Integer& x, const Integer& y) return r
-{
-  r.rep = bitop(x.rep, y.rep, r.rep, '&');
-}
-
-inline Integer  operator &  (const Integer& x, long y) return r
-{
-  r.rep = bitop(x.rep, y, r.rep, '&');
-}
-
-inline Integer  operator &  (long  x, const Integer& y) return r
-{
-  r.rep = bitop(y.rep, x, r.rep, '&');
-}
-
-inline Integer  operator |  (const Integer& x, const Integer& y) return r
-{
-  r.rep = bitop(x.rep, y.rep, r.rep, '|');
-}
-
-inline Integer  operator |  (const Integer& x, long y) return r
-{
-  r.rep = bitop(x.rep, y, r.rep, '|');
-}
-
-inline Integer  operator |  (long  x, const Integer& y) return r
-{
-  r.rep = bitop(y.rep, x, r.rep, '|');
-}
-
-inline Integer  operator ^  (const Integer& x, const Integer& y) return r
-{
-  r.rep = bitop(x.rep, y.rep, r.rep, '^');
-}
-
-inline Integer  operator ^  (const Integer& x, long y) return r
-{
-  r.rep = bitop (x.rep, y, r.rep, '^');
-}
-
-inline Integer  operator ^  (long  x, const Integer& y) return r
-{
-  r.rep = bitop (y.rep, x, r.rep, '^');
-}
-
-inline Integer  operator /  (const Integer& x, const Integer& y) return r
-{
-  div(x, y, r);
-}
-
-inline Integer operator /  (const Integer& x, long y) return r
-{
-  div(x, y, r);
-}
-
-inline Integer operator %  (const Integer& x, const Integer& y) return r
-{
-  mod(x, y, r);
-}
-
-inline Integer operator %  (const Integer& x, long y) return r
-{
-  mod(x, y, r);
-}
-
-inline Integer operator <<  (const Integer& x, const Integer& y) return r
-{
-  lshift(x, y, r);
-}
-
-inline Integer operator <<  (const Integer& x, long y) return r
-{
-  lshift(x, y, r);
-}
-
-inline Integer operator >>  (const Integer& x, const Integer& y) return r;
-{
-  rshift(x, y, r);
-}
-
-inline Integer operator >>  (const Integer& x, long y) return r
-{
-  rshift(x, y, r);
-}
-
-inline Integer pow(const Integer& x, long y) return r
-{
-  pow(x, y, r);
-}
-
-inline Integer Ipow(long x, long y) return r(x)
-{
-  pow(r, y, r);
-}
-
-inline Integer pow(const Integer& x, const Integer& y) return r
-{
-  pow(x, y, r);
-}
-
-
-
-inline Integer abs(const Integer& x) return r
-{
-  abs(x, r);
-}
-
-inline Integer operator - (const Integer& x) return r
-{
-  negate(x, r);
-}
-
-inline Integer operator ~ (const Integer& x) return r
-{
-  complement(x, r);
-}
-
-inline Integer  atoI(const char* s, int base) return r
-{
-  r.rep = atoIntRep(s, base);
-}
-
-inline Integer  gcd(const Integer& x, const Integer& y) return r
-{
-  r.rep = gcd(x.rep, y.rep);
-}
-
-#else /* NO_NRV */
-
 inline Integer  operator +  (const Integer& x, const Integer& y) 
 {
   Integer r; add(x, y, r); return r;
@@ -994,32 +813,32 @@
 
 inline Integer  operator &  (const Integer& x, const Integer& y) 
 {
-  Integer r; and(x, y, r); return r;
+  Integer r; r.rep = bitop(x.rep, y.rep, r.rep, '&'); return r;
 }
 
 inline Integer  operator &  (const Integer& x, long y) 
 {
-  Integer r; and(x, y, r); return r;
+  Integer r; r.rep = bitop(x.rep, y, r.rep, '&'); return r;
 }
 
 inline Integer  operator &  (long  x, const Integer& y) 
 {
-  Integer r; and(x, y, r); return r;
+  Integer r; r.rep = bitop(y.rep, x, r.rep, '&'); return r;
 }
 
 inline Integer  operator |  (const Integer& x, const Integer& y) 
 {
-  Integer r; or(x, y, r); return r;
+  Integer r; r.rep = bitop(x.rep, y.rep, r.rep, '|'); return r;
 }
 
 inline Integer  operator |  (const Integer& x, long y) 
 {
-  Integer r; or(x, y, r); return r;
+  Integer r; r.rep = bitop(x.rep, y, r.rep, '|'); return r;
 }
 
 inline Integer  operator |  (long  x, const Integer& y) 
 {
-  Integer r; or(x, y, r); return r;
+  Integer r; r.rep = bitop(y.rep, x, r.rep, '|'); return r;
 }
 
 inline Integer  operator ^  (const Integer& x, const Integer& y) 
@@ -1119,8 +938,6 @@
   Integer r; r.rep = gcd(x.rep, y.rep); return r;
 }
 
-#endif  /* NO_NRV */
-
 inline Integer& Integer::operator %= (const Integer& y)
 {
   *this = *this % y; // mod(*this, y, *this) doesn't work.

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