1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

Fix code so it is favored by both GCCs (2.x and 3.x), and unbreak the build.

Approved by:	fjoe (mentor, implicit)
		maintainer timeout
This commit is contained in:
Alexey Dokuchaev 2004-10-20 12:33:37 +00:00
parent 9c152ae646
commit 62872b88bd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119851
12 changed files with 454 additions and 4 deletions

View File

@ -20,6 +20,7 @@ PLIST_SUB= SFS_VERSION=${PORTVERSION}
INFO= sfs
USE_GMAKE= yes
USE_REINPLACE= yes
USE_INC_LIBTOOL_VER=13
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--with-sfsuser=sfs \
@ -34,10 +35,6 @@ CONFIGURE_ARGS+=--with-sfsuser=sfs \
BROKEN= "Does not compile on !i386"
.endif
.if ${OSVERSION} >= 502126
BROKEN= "Does not compile on FreeBSD >= 5.x"
.endif
.if ${OSVERSION} > 500000
LIB_DEPENDS+= gmp.6:${PORTSDIR}/math/libgmp4
CONFIGURE_ARGS+=--with-gmp=${LOCALBASE}
@ -76,6 +73,8 @@ MAN8= \
post-extract:
@${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${FILESDIR}/sfscd.sh > ${WRKSRC}/sfscd.sh
@${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${FILESDIR}/sfssd.sh > ${WRKSRC}/sfssd.sh
@${FIND} -E ${WRKDIR} -type f -iregex ".*\.(C|h)" -print0 | \
${XARGS} -0 ${REINPLACE_CMD} -e 's/template get/get/'
pre-install:
PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL

View File

@ -0,0 +1,44 @@
--- arpc/rpctypes.h.orig Mon Oct 11 16:43:34 2004
+++ arpc/rpctypes.h Mon Oct 11 16:39:35 2004
@@ -129,7 +129,7 @@
if (&v != this) \
assign (v)
- void init () { mode = NOFREE; nelm = 0; vec = NULL; }
+ void init () { mode = freemode::NOFREE; nelm = 0; vec = NULL; }
void del () {
switch (mode) {
case NOFREE:
@@ -266,6 +266,8 @@
a.swap (b);
}
+extern const str rpc_emptystr;
+
template<size_t max = RPC_INFINITY> struct rpc_str : str
{
enum { maxsize = max };
@@ -301,12 +303,12 @@
};
template<size_t n = RPC_INFINITY> struct rpc_opaque : array<char, n> {
- rpc_opaque () { bzero (base (), size ()); }
+ rpc_opaque () { bzero (this->base (), this->size ()); }
};
template<size_t n = RPC_INFINITY> struct rpc_bytes : rpc_vec<char, n> {
- void setstrmem (const str &s) { set (s.cstr (), s.len (), NOFREE); }
+ void setstrmem (const str &s) { set (s.cstr (), s.len (), freemode::NOFREE); }
rpc_bytes &operator= (const str &s)
- { setsize (s.len ()); memcpy (base (), s.cstr (), size ()); return *this; }
+ { setsize (s.len ()); memcpy (this->base (), s.cstr (), this->size ()); return *this; }
template<size_t m> rpc_bytes &operator= (const rpc_vec<char, m> &v)
{ rpc_vec<char, n>::operator= (v); return *this; }
template<size_t m> rpc_bytes &operator= (const array<char, m> &v)
@@ -519,7 +521,6 @@
struct rpc_clear_t {};
extern struct rpc_clear_t _rpcclear;
-extern const str rpc_emptystr;
inline bool
rpc_traverse (rpc_clear_t &, u_int32_t &obj)

View File

@ -0,0 +1,10 @@
--- arpc/xdrmisc.h.orig Mon Oct 11 16:43:34 2004
+++ arpc/xdrmisc.h Mon Oct 11 16:39:35 2004
@@ -26,6 +26,7 @@
#ifndef _ARPC_XDRMISC_H_
#define _ARPC_XDRMISC_H_ 1
+#include "wmstr.h"
#include "sysconf.h"
extern "C" {

View File

@ -0,0 +1,11 @@
--- async/ihash.h.orig Mon Oct 11 16:43:34 2004
+++ async/ihash.h Mon Oct 11 16:39:35 2004
@@ -213,7 +213,7 @@
const H hash;
public:
- ihash () {}
+ ihash () : eq (E ()), hash (H ()) {}
ihash (const E &e, const H &h) : eq (e), hash (h) {}
void insert (V *elm) { insert_val (elm, hash (elm->*key)); }

View File

@ -0,0 +1,41 @@
--- async/init.h.orig Mon Oct 11 16:43:34 2004
+++ async/init.h Mon Oct 11 16:39:35 2004
@@ -25,6 +25,12 @@
#ifndef _ASYNC_INIT_H_
#define _ASYNC_INIT_H_ 1
+#if __GNUC__ >= 3
+# define __init_attribute__(x)
+#else /* gcc < 3 */
+# define __init_attribute__(x) __attribute__ (x)
+#endif /* gcc < 3 */
+
#define INIT(name) \
static class name { \
static int count; \
@@ -34,7 +40,7 @@
public: \
name () {if (!cnt ()++) start ();} \
~name () {if (!--cnt ()) stop ();} \
-} init_ ## name __attribute__ ((unused))
+} init_ ## name __init_attribute__ ((unused))
class initfn {
initfn ();
@@ -43,7 +49,7 @@
};
#define INITFN(fn) \
static void fn (); \
-static initfn init_ ## fn (fn) __attribute__ ((unused))
+static initfn init_ ## fn (fn) __init_attribute__ ((unused))
class exitfn {
void (*const fn) ();
@@ -53,6 +59,6 @@
};
#define EXITFN(fn) \
static void fn (); \
-static exitfn exit_ ## fn (fn) __attribute__ ((unused))
+static exitfn exit_ ## fn (fn) __init_attribute__ ((unused))
#endif /* !_ASYNC_INIT_H_ */

View File

@ -0,0 +1,11 @@
--- async/qhash.h.orig Mon Oct 11 16:43:34 2004
+++ async/qhash.h Mon Oct 11 16:39:35 2004
@@ -166,7 +166,7 @@
public:
bhash () {}
- void clear () { deleteall (); }
+ void clear () { this->deleteall (); }
~bhash () { clear (); }
bool insert (const K &k) {

View File

@ -0,0 +1,118 @@
--- async/refcnt.h.orig Mon Oct 11 16:43:34 2004
+++ async/refcnt.h Mon Oct 11 16:39:35 2004
@@ -409,7 +409,7 @@
friend class refpriv;
friend ref<T> mkref<T> (T *);
- ref (T *pp, refcount *cc) : refpriv (cc) { p = pp; inc (); }
+ ref (T *pp, refcount *cc) : refpriv (cc) { this->p = pp; inc (); }
void inc () const { rinc (c); }
void dec () const { rdec (c); }
@@ -420,32 +420,32 @@
template<class U, reftype v>
ref (refcounted<U, v> *pp)
- : refpriv (rc (pp)) { p = refpriv::rp (pp); inc (); }
+ : refpriv (rc (pp)) { this->p = refpriv::rp (pp); inc (); }
/* At least with gcc, the copy constructor must be explicitly
* defined (though it would appear to be redundant given the
* template constructor bellow). */
- ref (const ref<T> &r) : refpriv (r.c) { p = r.p; inc (); }
+ ref (const ref<T> &r) : refpriv (r.c) { this->p = r.p; inc (); }
template<class U>
ref (const ref<U> &r)
- : refpriv (rc (r)) { p = refpriv::rp (r); inc (); }
+ : refpriv (rc (r)) { this->p = refpriv::rp (r); inc (); }
template<class U>
ref (const ::ptr<U> &r)
- : refpriv (rc (r)) { p = refpriv::rp (r); inc (); }
+ : refpriv (rc (r)) { this->p = refpriv::rp (r); inc (); }
~ref () { dec (); }
template<class U, reftype v> ref<T> &operator= (refcounted<U, v> *pp)
- { rinc (pp); dec (); p = refpriv::rp (pp); c = rc (pp); return *this; }
+ { rinc (pp); dec (); this->p = refpriv::rp (pp); c = rc (pp); return *this; }
/* The copy assignment operator must also explicitly be defined,
* despite a redundant template. */
ref<T> &operator= (const ref<T> &r)
- { r.inc (); dec (); p = r.p; c = r.c; return *this; }
+ { r.inc (); dec (); this->p = r.p; c = r.c; return *this; }
template<class U> ref<T> &operator= (const ref<U> &r)
- { rinc (r); dec (); p = refpriv::rp (r); c = rc (r); return *this; }
+ { rinc (r); dec (); this->p = refpriv::rp (r); c = rc (r); return *this; }
/* Self asignment not possible. Use ref::inc to cause segfauls on NULL. */
template<class U> ref<T> &operator= (const ::ptr<U> &r)
- { dec (); p = refpriv::rp (r); c = rc (r); inc (); return *this; }
+ { dec (); this->p = refpriv::rp (r); c = rc (r); inc (); return *this; }
};
/* To skip initialization of ptr's in BSS */
@@ -464,13 +464,13 @@
rinc (pp);
if (decme)
dec ();
- p = refpriv::rp (pp);
+ this->p = refpriv::rp (pp);
c = rc (pp);
}
else {
if (decme)
dec ();
- p = NULL;
+ this->p = NULL;
c = NULL;
}
}
@@ -480,31 +480,31 @@
typedef ref<T> ref;
explicit ptr (__bss_init) {}
- ptr () : refpriv (NULL) { p = NULL; }
- ptr (privtype *) : refpriv (NULL) { p = NULL; }
+ ptr () : refpriv (NULL) { this->p = NULL; }
+ ptr (privtype *) : refpriv (NULL) { this->p = NULL; }
template<class U, reftype v>
ptr (refcounted<U, v> *pp) { set (pp, false); }
- ptr (const ptr<T> &r) : refpriv (r.c) { p = r.p; inc (); }
+ ptr (const ptr<T> &r) : refpriv (r.c) { this->p = r.p; inc (); }
template<class U>
ptr (const ptr<U> &r)
- : refpriv (rc (r)) { p = refpriv::rp (r); inc (); }
+ : refpriv (rc (r)) { this->p = refpriv::rp (r); inc (); }
template<class U>
ptr (const ::ref<U> &r)
- : refpriv (rc (r)) { p = refpriv::rp (r); inc (); }
+ : refpriv (rc (r)) { this->p = refpriv::rp (r); inc (); }
~ptr () { dec (); }
ptr<T> &operator= (privtype *)
- { dec (); p = NULL; c = NULL; return *this; }
+ { dec (); this->p = NULL; c = NULL; return *this; }
template<class U, reftype v> ptr<T> &operator= (refcounted<U, v> *pp)
{ set (pp, true); return *this; }
ptr<T> &operator= (const ptr<T> &r)
- { r.inc (); dec (); p = r.p; c = r.c; return *this; }
+ { r.inc (); dec (); this->p = r.p; c = r.c; return *this; }
template<class U> ptr<T> &operator= (const ptr<U> &r)
- { rinc (r); dec (); p = refpriv::rp (r); c = rc (r); return *this; }
+ { rinc (r); dec (); this->p = refpriv::rp (r); c = rc (r); return *this; }
template<class U> ptr<T> &operator= (const ::ref<U> &r)
- { rinc (r); dec (); p = refpriv::rp (r); c = rc (r); return *this; }
+ { rinc (r); dec (); this->p = refpriv::rp (r); c = rc (r); return *this; }
};
template<class T>
@@ -512,7 +512,7 @@
// Don't initialize (assume we were 0 initialized in the BSS)
bssptr () : ptr<T> (__bss_init ()) {}
// Override the effects of destruction
- ~bssptr () { assert (globaldestruction); if (*this != NULL) Xleak (); }
+ ~bssptr () { assert (globaldestruction); if (*this != NULL) this->Xleak (); }
ptr<T> &operator= (refpriv::privtype *p) { return ptr<T>::operator= (p); }
template<class U> ptr<T> &operator= (const ptr<U> &r)
{ return ptr<T>::operator= (r); }

View File

@ -0,0 +1,143 @@
--- async/vec.h.orig Mon Oct 11 16:43:34 2004
+++ async/vec.h Mon Oct 11 16:39:35 2004
@@ -74,16 +74,16 @@
template<class T, size_t N = 0> class vec : public vec_base<T, N> {
typedef typename vec_base<T, N>::elm_t elm_t;
void move (elm_t *dst) {
- if (dst == firstp)
+ if (dst == this->firstp)
return;
- assert (dst < firstp || dst >= lastp);
- basep = dst;
- for (elm_t *src = firstp; src < lastp; src++) {
+ assert (dst < this->firstp || dst >= this->lastp);
+ this->basep = dst;
+ for (elm_t *src = this->firstp; src < this->lastp; src++) {
new ((void *) (dst++)) elm_t (*src);
src->~elm_t ();
}
- lastp += basep - firstp;
- firstp = basep;
+ this->lastp += this->basep - this->firstp;
+ this->firstp = this->basep;
}
static elm_t &construct (elm_t &e)
@@ -92,14 +92,14 @@
{ return *new (implicit_cast<void *> (&e)) elm_t (v); }
static void destroy (elm_t &e) { e.~elm_t (); }
- void init () { lastp = firstp = basep = def_basep (); limp = def_limp (); }
- void del () { while (firstp < lastp) firstp++->~elm_t (); bfree (basep); }
+ void init () { this->lastp = this->firstp = this->basep = this->def_basep (); this->limp = this->def_limp (); }
+ void del () { while (this->firstp < this->lastp) (this->firstp)++->~elm_t (); bfree (this->basep); }
#define append(v) \
do { \
reserve (v.size ()); \
for (const elm_t *s = v.base (), *e = v.lim (); s < e; s++) \
- cconstruct (*lastp++, *s); \
+ cconstruct (*(this->lastp)++, *s); \
} while (0)
#ifdef CHECK_BOUNDS
@@ -125,19 +125,19 @@
{ clear (); append (v); return *this; }
void reserve (size_t n) {
- if (lastp + n <= limp)
+ if (this->lastp + n <= this->limp)
return;
- size_t nalloc = limp - basep;
- size_t nwanted = lastp - firstp + n;
+ size_t nalloc = this->limp - this->basep;
+ size_t nwanted = this->lastp - this->firstp + n;
if (nwanted > nalloc / 2) {
nalloc = 1 << fls (max (nalloc, nwanted));
- elm_t *obasep = basep;
+ elm_t *obasep = this->basep;
move (static_cast<elm_t *> (txmalloc (nalloc * sizeof (elm_t))));
- limp = basep + nalloc;
+ this->limp = this->basep + nalloc;
bfree (obasep);
}
else
- move (basep);
+ move (this->basep);
}
void setsize (size_t n) {
size_t s = size ();
@@ -145,47 +145,47 @@
popn_back (s - n);
else if ((n -= s)) {
reserve (n);
- elm_t *sp = lastp;
- lastp += n;
- while (sp < lastp)
+ elm_t *sp = this->lastp;
+ this->lastp += n;
+ while (sp < this->lastp)
construct (*sp++);
}
}
- elm_t *base () { return firstp; }
- const elm_t *base () const { return firstp; }
- elm_t *lim () { return lastp; }
- const elm_t *lim () const { return lastp; }
- size_t size () const { return lastp - firstp; }
- bool empty () const { return lastp == firstp; }
-
- elm_t &front () { zcheck (); return *firstp; }
- const elm_t &front () const { zcheck (); return *firstp; }
- elm_t &back () { zcheck (); return lastp[-1]; }
- const elm_t &back () const { zcheck (); return lastp[-1]; }
+ elm_t *base () { return this->firstp; }
+ const elm_t *base () const { return this->firstp; }
+ elm_t *lim () { return this->lastp; }
+ const elm_t *lim () const { return this->lastp; }
+ size_t size () const { return this->lastp - this->firstp; }
+ bool empty () const { return this->lastp == this->firstp; }
+
+ elm_t &front () { zcheck (); return *(this->firstp); }
+ const elm_t &front () const { zcheck (); return *(this->firstp); }
+ elm_t &back () { zcheck (); return this->lastp[-1]; }
+ const elm_t &back () const { zcheck (); return this->lastp[-1]; }
- elm_t &operator[] (ptrdiff_t i) { bcheck (i); return firstp[i]; }
- const elm_t &operator[] (ptrdiff_t i) const { bcheck (i); return firstp[i]; }
+ elm_t &operator[] (ptrdiff_t i) { bcheck (i); return this->firstp[i]; }
+ const elm_t &operator[] (ptrdiff_t i) const { bcheck (i); return this->firstp[i]; }
- elm_t &push_back () { reserve (1); return construct (*lastp++); }
+ elm_t &push_back () { reserve (1); return construct (*(this->lastp)++); }
elm_t &push_back (const elm_t &e)
- { reserve (1); return cconstruct (*lastp++, e); }
+ { reserve (1); return cconstruct (*(this->lastp)++, e); }
- elm_t pop_back () { zcheck (); return destroy_return (*--lastp); }
+ elm_t pop_back () { zcheck (); return destroy_return (*--(this->lastp)); }
void popn_back (size_t n) {
pcheck (n);
- elm_t *sp = lastp;
- lastp -= n;
- while (sp > lastp)
+ elm_t *sp = this->lastp;
+ this->lastp -= n;
+ while (sp > this->lastp)
destroy (*--sp);
}
- elm_t pop_front () { zcheck (); return destroy_return (*firstp++); }
+ elm_t pop_front () { zcheck (); return destroy_return (*(this->firstp)++); }
void popn_front (size_t n) {
pcheck (n);
- elm_t *sp = firstp;
- firstp += n;
- while (sp < firstp)
+ elm_t *sp = this->firstp;
+ this->firstp += n;
+ while (sp < this->firstp)
destroy (*sp++);
}

View File

@ -0,0 +1,11 @@
--- sfsmisc/afsnode.h.orig Mon Oct 11 16:43:34 2004
+++ sfsmisc/afsnode.h Mon Oct 11 16:39:35 2004
@@ -168,7 +168,7 @@
void mkfattr3 (fattr3 *, sfs_aid aid);
void setres (nfsstat err);
void setres (nfspath path);
- str readlink () const { return res.status ? str (NULL) : *res.data; }
+ str readlink () const { return res.status ? str (NULL) : str (*res.data); }
bool resset () { return resok; }
void nfs_readlink (svccb *sbp);

View File

@ -0,0 +1,42 @@
--- sfsmisc/nfsserv.h.orig Mon Oct 11 16:43:34 2004
+++ sfsmisc/nfsserv.h Mon Oct 11 16:39:35 2004
@@ -110,6 +110,19 @@
template<class T> T *getres () { return static_cast<T *> (getvoidres ()); }
};
+struct nfsserv : public virtual refcount {
+ typedef callback<void, nfscall *>::ref cb_t;
+ static const cb_t stalecb;
+ cb_t cb;
+ const ptr<nfsserv> nextserv;
+ explicit nfsserv (ptr<nfsserv> n = NULL);
+ void setcb (const cb_t &c) { cb = c; }
+ void mkcb (nfscall *nc) { nc->curserv = this; (*cb) (nc); }
+ virtual void getcall (nfscall *nc) { mkcb (nc); }
+ virtual void getreply (nfscall *nc) { nc->sendreply (); }
+ virtual bool encodefh (nfs_fh3 &fh);
+};
+
template<int N> class nfscall_cb : public nfscall {
typedef typename nfs3proc<N>::arg_type *arg_type;
typedef typename nfs3proc<N>::res_type *res_type;
@@ -134,19 +147,6 @@
svccb *sbp;
nfscall_rpc (svccb *sbp);
~nfscall_rpc ();
-};
-
-struct nfsserv : public virtual refcount {
- typedef callback<void, nfscall *>::ref cb_t;
- static const cb_t stalecb;
- cb_t cb;
- const ptr<nfsserv> nextserv;
- explicit nfsserv (ptr<nfsserv> n = NULL);
- void setcb (const cb_t &c) { cb = c; }
- void mkcb (nfscall *nc) { nc->curserv = this; (*cb) (nc); }
- virtual void getcall (nfscall *nc) { mkcb (nc); }
- virtual void getreply (nfscall *nc) { nc->sendreply (); }
- virtual bool encodefh (nfs_fh3 &fh);
};
class nfsserv_udp : public nfsserv {

View File

@ -0,0 +1,10 @@
--- sfsmisc/sfsclient.h.orig Mon Oct 11 16:43:34 2004
+++ sfsmisc/sfsclient.h Mon Oct 11 16:39:35 2004
@@ -31,6 +31,7 @@
#include "qhash.h"
#include "axprt_crypt.h"
#include "sfscrypt.h"
+#include "sfscd_prot.h"
struct sfscd_mountarg;
class rabin_priv;

View File

@ -0,0 +1,10 @@
--- sfsmisc/sfscrypt.h.orig Mon Oct 11 16:43:34 2004
+++ sfsmisc/sfscrypt.h Mon Oct 11 16:39:35 2004
@@ -89,7 +89,6 @@
virtual u_char get_bad_opts () const { return (SFS_DECRYPT | SFS_SIGN); }
bool get_opt (u_char o) const { return (opts & o); }
const sfs_keytype ktype;
- const int eksb_id;
const u_char opts;
};