libg++ updates

Manfred Hollstein manfredh@redhat.com
Fri Apr 14 05:19:00 GMT 2000


Alexandre Oliva wrote:
> 
> Martin's recent enabling of ISO C++ keywords and, or and xor broke
> some libg++ classes.  They'd already (mostly) refrain from using those
> keywords when compiling in strict ANSI/ISO compliance mode, certainly
> because of this issue, but now they fail.  Here's a quick hack that
> allows libg++ to keep building.  Manfred, feel free to add them to the
> set of standard patches for libg++.

Alexandre, thanks for the patch; I'll check it into my sources and
provide a suitable patch on infrastructure and my webpage as soon
as I'll find some spare time to work on it.

Cheers.

l8er
manfred

> 
>   ------------------------------------------------------------------------
> for ./libg++/src/ChangeLog
> from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
> 
>         * Integer.h, Integer.cc, BitSet.h (and, or, xor): Do not define.
>         * BitString.h, BitString.cc (and, or, xor): Rename.
> 
> --- ./libg++/src/Integer.h~     Tue Apr 11 17:53:20 2000
> +++ ./libg++/src/Integer.h      Tue Apr 11 17:54:30 2000
> @@ -1,7 +1,7 @@
>  // This may look like C code, but it is really -*- C++ -*-
> 
>  /*
> -Copyright (C) 1988 Free Software Foundation
> +Copyright (C) 1988, 2000 Free Software Foundation
>      written by Doug Lea (dl@rocky.oswego.edu)
> 
>  This file is part of the GNU C++ Library.  This library is free
> @@ -59,7 +59,7 @@
>  extern IntRep*  mod(const IntRep*, const IntRep*, IntRep*);
>  extern IntRep*  div(const IntRep*, long, IntRep*);
>  extern IntRep*  mod(const IntRep*, long, IntRep*);
> -extern IntRep*  compl(const IntRep*, IntRep*);
> +extern IntRep*  complem(const IntRep*, IntRep*);
>  extern IntRep*  abs(const IntRep*, IntRep*);
>  extern IntRep*  negate(const IntRep*, IntRep*);
>  extern IntRep*  pow(const IntRep*, long);
> @@ -181,7 +181,7 @@
>    friend void     div(const Integer& x, long y, Integer& dest);
>    friend void     mod(const Integer& x, long y, Integer& dest);
>    friend void     divide(const Integer& x, long y, Integer& q, long& r);
> -#ifndef __STRICT_ANSI__
> +#if 0
>    friend void     and(const Integer& x, long y, Integer& dest);
>    friend void     or(const Integer& x, long y, Integer& dest);
>    friend void     xor(const Integer& x, long y, Integer& dest);
> @@ -195,7 +195,7 @@
>    friend void     add(long x, const Integer& y, Integer& dest);
>    friend void     sub(long x, const Integer& y, Integer& dest);
>    friend void     mul(long x, const Integer& y, Integer& dest);
> -#ifndef __STRICT_ANSI__
> +#if 0
>    friend void     and(long x, const Integer& y, Integer& dest);
>    friend void     or(long x, const Integer& y, Integer& dest);
>    friend void     xor(long x, const Integer& y, Integer& dest);
> @@ -373,7 +373,7 @@
>    dest.rep = mod(x.rep, y.rep, dest.rep);
>  }
> 
> -#ifndef __STRICT_ANSI__
> +#if 0
>  inline void  and(const Integer& x, const Integer& y, Integer& dest)
>  {
>    dest.rep = bitop(x.rep, y.rep, dest.rep, '&');
> @@ -430,7 +430,7 @@
>    dest.rep = mod(x.rep, y, dest.rep);
>  }
> 
> -#ifndef __STRICT_ANSI__
> +#if 0
>  inline void  and(const Integer& x, long y, Integer& dest)
>  {
>    dest.rep = bitop(x.rep, y, dest.rep, '&');
> @@ -474,7 +474,7 @@
> 
>  inline void complement(const Integer& x, Integer& dest)
>  {
> -  dest.rep = compl(x.rep, dest.rep);
> +  dest.rep = complem(x.rep, dest.rep);
>  }
> 
>  inline void  add(long x, const Integer& y, Integer& dest)
> @@ -492,7 +492,7 @@
>    dest.rep = multiply(y.rep, x, dest.rep);
>  }
> 
> -#ifndef __STRICT_ANSI__
> +#if 0
>  inline void  and(long x, const Integer& y, Integer& dest)
>  {
>    dest.rep = bitop(y.rep, x, dest.rep, '&');
> --- ./libg++/src/BitString.h~   Mon Aug 31 07:12:25 1998
> +++ ./libg++/src/BitString.h    Tue Apr 11 18:03:34 2000
> @@ -1,6 +1,6 @@
>  // This may look like C code, but it is really -*- C++ -*-
>  /*
> -Copyright (C) 1988 Free Software Foundation
> +Copyright (C) 1988, 2000 Free Software Foundation
>      written by Doug Lea (dl@rocky.oswego.edu)
> 
>  This file is part of the GNU C++ Library.  This library is free
> @@ -43,9 +43,9 @@
>  extern BitStrRep*  BStr_resize(BitStrRep*, _G_int32_t);
>  extern BitStrRep*  BStr_copy(BitStrRep*, const BitStrRep*);
>  extern BitStrRep*  cmpl(const BitStrRep*, BitStrRep*);
> -extern BitStrRep*  and(const BitStrRep*, const BitStrRep*, BitStrRep*);
> -extern BitStrRep*  or(const BitStrRep*, const BitStrRep*, BitStrRep*);
> -extern BitStrRep*  xor(const BitStrRep*, const BitStrRep*, BitStrRep*);
> +extern BitStrRep*  and_f(const BitStrRep*, const BitStrRep*, BitStrRep*);
> +extern BitStrRep*  or_f(const BitStrRep*, const BitStrRep*, BitStrRep*);
> +extern BitStrRep*  xor_f(const BitStrRep*, const BitStrRep*, BitStrRep*);
>  extern BitStrRep*  diff(const BitStrRep*, const BitStrRep*, BitStrRep*);
>  extern BitStrRep*  cat(const BitStrRep*, const BitStrRep*, BitStrRep*);
>  extern BitStrRep*  cat(const BitStrRep*, unsigned int, BitStrRep*);
> @@ -130,9 +130,9 @@
>  // procedural versions of operators
> 
> 
> -  friend void        and(const BitString&, const BitString&, BitString&);
> -  friend void        or(const BitString&, const BitString&, BitString&);
> -  friend void        xor(const BitString&, const BitString&, BitString&);
> +  friend void        and_f(const BitString&, const BitString&, BitString&);
> +  friend void        or_f(const BitString&, const BitString&, BitString&);
> +  friend void        xor_f(const BitString&, const BitString&, BitString&);
>    friend void        diff(const BitString&, const BitString&, BitString&);
>    friend void        cat(const BitString&, const BitString&, BitString&);
>    friend void        cat(const BitString&, unsigned int, BitString&);
> @@ -397,19 +397,19 @@
> 
>  // procedural versions of operators
> 
> -inline void and(const BitString& x, const BitString& y, BitString& r)
> +inline void and_f(const BitString& x, const BitString& y, BitString& r)
>  {
> -  r.rep = and(x.rep, y.rep, r.rep);
> +  r.rep = and_f(x.rep, y.rep, r.rep);
>  }
> 
> -inline void or(const BitString& x, const BitString& y, BitString& r)
> +inline void or_f(const BitString& x, const BitString& y, BitString& r)
>  {
> -  r.rep = or(x.rep, y.rep, r.rep);
> +  r.rep = or_f(x.rep, y.rep, r.rep);
>  }
> 
> -inline void xor(const BitString& x, const BitString& y, BitString& r)
> +inline void xor_f(const BitString& x, const BitString& y, BitString& r)
>  {
> -  r.rep = xor(x.rep, y.rep, r.rep);
> +  r.rep = xor_f(x.rep, y.rep, r.rep);
>  }
> 
>  inline void diff(const BitString& x, const BitString& y, BitString& r)
> @@ -447,20 +447,20 @@
> 
>  inline BitString& BitString::operator &= (const BitString& y)
>  {
> -  and(*this, y, *this);
> +  and_f(*this, y, *this);
>    return *this;
>  }
> 
> 
>  inline BitString& BitString::operator |= (const BitString& y)
>  {
> -  or(*this, y, *this);
> +  or_f(*this, y, *this);
>    return *this;
>  }
> 
>  inline BitString& BitString::operator ^= (const BitString& y)
>  {
> -  xor(*this, y, *this);
> +  xor_f(*this, y, *this);
>    return *this;
>  }
> 
> @@ -503,17 +503,17 @@
> 
>  inline BitString  operator & (const BitString& x, const BitString& y) return r
>  {
> -  and(x, y, r);
> +  and_f(x, y, r);
>  }
> 
>  inline BitString  operator | (const BitString& x, const BitString& y) return r
>  {
> -  or(x, y, r);
> +  or_f(x, y, r);
>  }
> 
>  inline BitString  operator ^ (const BitString& x, const BitString& y) return r
>  {
> -  xor(x, y, r);
> +  xor_f(x, y, r);
>  }
> 
>  inline BitString  operator << (const BitString& x, _G_int32_t y) return r
> --- ./libg++/src/Integer.cc~    Thu Dec 17 12:34:11 1998
> +++ ./libg++/src/Integer.cc     Tue Apr 11 17:54:42 2000
> @@ -1,5 +1,5 @@
>  /*
> -Copyright (C) 1988 Free Software Foundation
> +Copyright (C) 1988, 2000 Free Software Foundation
>      written by Doug Lea (dl@rocky.oswego.edu)
> 
>  This file is part of the GNU C++ Library.  This library is free
> @@ -1664,7 +1664,7 @@
> 
> 
> 
> -IntRep*  compl(const IntRep* src, IntRep* r)
> +IntRep*  complem(const IntRep* src, IntRep* r)
>  {
>    nonnil(src);
>    r = Icopy(r, src);
> --- ./libg++/src/BitSet.h~      Sun Nov 24 07:16:48 1996
> +++ ./libg++/src/BitSet.h       Tue Apr 11 17:58:35 2000
> @@ -1,6 +1,6 @@
>  // This may look like C code, but it is really -*- C++ -*-
>  /*
> -Copyright (C) 1988 Free Software Foundation
> +Copyright (C) 1988, 2000 Free Software Foundation
>      written by Doug Lea (dl@rocky.oswego.edu)
> 
>  This file is part of the GNU C++ Library.  This library is free
> @@ -168,7 +168,7 @@
>    void              printon(ostream& s,
>                              char f='0', char t='1', char star='*') const;
> 
> -#ifndef __STRICT_ANSI__
> +#if 0
>    // procedural versions of operators
> 
>    // The first three of these are incompatible with ANSI C++ digraphs.
> @@ -219,7 +219,7 @@
> 
>  inline int operator >= (const BitSet& x, const BitSet& y) { return y <= x; }
> 
> -#ifndef __STRICT_ANSI__
> +#if 0
>  inline void and(const BitSet& x, const BitSet& y, BitSet& r)
>  {
>    r.rep =  BitSetop(x.rep, y.rep, r.rep, '&');
> --- ./libg++/src/BitString.cc~  Thu Dec 17 12:34:11 1998
> +++ ./libg++/src/BitString.cc   Tue Apr 11 18:02:56 2000
> @@ -1,5 +1,5 @@
>  /*
> -Copyright (C) 1988 Free Software Foundation
> +Copyright (C) 1988, 2000 Free Software Foundation
>      written by Doug Lea (dl@rocky.oswego.edu)
> 
>  This file is part of the GNU C++ Library.  This library is free
> @@ -333,7 +333,7 @@
>  }
> 
> 
> -BitStrRep* and(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
> +BitStrRep* and_f(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
>  {
>    int xrsame = x == r;
>    int yrsame = y == r;
> @@ -354,7 +354,7 @@
>    return r;
>  }
> 
> -BitStrRep* or(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
> +BitStrRep* or_f(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
>  {
>    _G_uint32_t  xl = x->len;
>    _G_uint32_t  yl = y->len;
> @@ -385,7 +385,7 @@
>  }
> 
> 
> -BitStrRep* xor(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
> +BitStrRep* xor_f(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
>  {
>    _G_uint32_t  xl = x->len;
>    _G_uint32_t  yl = y->len;
> @@ -414,7 +414,6 @@
>    check_last(r);
>    return r;
>  }
> -
> 
>  BitStrRep* diff(const BitStrRep* x, const BitStrRep* y, BitStrRep* r)
>  {
> 
>   ------------------------------------------------------------------------
> 
> --
> Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
> Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
> Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
> oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

-- 
 Manfred Hollstein			  < mailto:manfredh@redhat.com >
 Cygnus Solutions, a Red Hat company	     phone: +49-(0)7044-910079
 Hindenburgstr. 13/1			    mobile: +49-(0)170-3436257
 75446 Wiernsheim, Germany		       fax: +49-(0)7044-910049


More information about the Gcc-patches mailing list