From: hno <> Date: Mon, 8 Nov 2004 06:29:50 +0000 (+0000) Subject: Bug #1085: Compiler errors compiling with GCC 3.4 series X-Git-Tag: SQUID_3_0_PRE4~993 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e6b941f670628fe1cf221acbb62f21fcbad8358;p=thirdparty%2Fsquid.git Bug #1085: Compiler errors compiling with GCC 3.4 series --- diff --git a/include/Array.h b/include/Array.h index 94484e4490..e337224f77 100644 --- a/include/Array.h +++ b/include/Array.h @@ -1,5 +1,5 @@ /* - * $Id: Array.h,v 1.16 2003/09/22 08:50:51 robertc Exp $ + * $Id: Array.h,v 1.17 2004/11/07 23:29:50 hno Exp $ * * AUTHOR: Alex Rousskov * @@ -34,6 +34,9 @@ #ifndef SQUID_ARRAY_H #define SQUID_ARRAY_H +#include "fatal.h" +#include "util.h" + /* iterator support */ template @@ -213,7 +216,7 @@ Vector::preAppend(int app_count) } template -Vector::Vector (Vector const &rhs) +Vector::Vector (Vector const &rhs) { items = NULL; capacity = 0; @@ -226,7 +229,7 @@ Vector::Vector (Vector const &rhs) template Vector & -Vector::operator = (Vector const &old) +Vector::operator = (Vector const &old) { clean(); reserve (old.size()); @@ -292,14 +295,14 @@ template VectorIteratorBase::VectorIteratorBase(size_t aPos, C &container) : pos(aPos), theVector(&container) {} template -bool VectorIteratorBase:: operator != (VectorIteratorBase const &rhs) +bool VectorIteratorBase:: operator != (VectorIteratorBase const &rhs) { assert (theVector); return pos != rhs.pos; } template -bool VectorIteratorBase:: operator == (VectorIteratorBase const &rhs) +bool VectorIteratorBase:: operator == (VectorIteratorBase const &rhs) { assert (theVector); return pos == rhs.pos; @@ -336,7 +339,7 @@ VectorIteratorBase VectorIteratorBase:: operator ++(int) template VectorIteratorBase& -VectorIteratorBase::operator =(VectorIteratorBase const &old) +VectorIteratorBase::operator =(VectorIteratorBase const &old) { pos = old.pos; theVector = old.theVector; @@ -345,7 +348,7 @@ VectorIteratorBase::operator =(VectorIteratorBase const &old) template ssize_t -VectorIteratorBase::operator - (VectorIteratorBase const &rhs) const +VectorIteratorBase::operator - (VectorIteratorBase const &rhs) const { assert(theVector == rhs.theVector); return pos - rhs.pos; diff --git a/include/Stack.h b/include/Stack.h index 62da2773ab..85339a3935 100644 --- a/include/Stack.h +++ b/include/Stack.h @@ -1,5 +1,5 @@ /* - * $Id: Stack.h,v 1.15 2003/07/14 10:36:41 robertc Exp $ + * $Id: Stack.h,v 1.16 2004/11/07 23:29:50 hno Exp $ * * AUTHOR: Alex Rousskov * @@ -44,8 +44,9 @@ template class Stack : public Vector { - public: + using Vector::count; + using Vector::items; typedef typename Vector::value_type value_type; typedef typename Vector::pointer pointer; value_type pop() @@ -53,9 +54,9 @@ public: if (!count) return value_type(); - value_type result = items[--count]; + value_type result = items[count]; - items[count] = value_type(); + this->items[count] = value_type(); return result; } diff --git a/include/fatal.h b/include/fatal.h new file mode 100644 index 0000000000..951053a00b --- /dev/null +++ b/include/fatal.h @@ -0,0 +1,15 @@ +#ifndef SQUID_FATAL_H +#define SQUID_FATAL_H + +#include "config.h" + +SQUIDCEXTERN void fatal(const char *message); +#if STDC_HEADERS +SQUIDCEXTERN void +fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; +#else +SQUIDCEXTERN void fatalf(); +#endif +SQUIDCEXTERN void fatal_dump(const char *message); + +#endif diff --git a/src/ACLBrowser.cc b/src/ACLBrowser.cc index e048ec1f38..2a659087d7 100644 --- a/src/ACLBrowser.cc +++ b/src/ACLBrowser.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLBrowser.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $ + * $Id: ACLBrowser.cc,v 1.3 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -35,8 +35,8 @@ */ #include "squid.h" -#include "ACLBrowser.h" #include "ACLChecklist.h" +#include "ACLBrowser.h" #include "ACLRegexData.h" /* explicit template instantiation required for some systems */ diff --git a/src/ACLChecklist.cc b/src/ACLChecklist.cc index 08a69081f4..098302b347 100644 --- a/src/ACLChecklist.cc +++ b/src/ACLChecklist.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.18 2004/10/18 12:12:54 hno Exp $ + * $Id: ACLChecklist.cc,v 1.19 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -280,8 +280,7 @@ ACLChecklist::operator new (size_t size) ACLChecklist *result = cbdataAlloc(ACLChecklist); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void diff --git a/src/ACLDomainData.cc b/src/ACLDomainData.cc index 499a417862..550ddfac64 100644 --- a/src/ACLDomainData.cc +++ b/src/ACLDomainData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLDomainData.cc,v 1.6 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLDomainData.cc,v 1.7 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -69,6 +69,17 @@ splaystrcmp (T&l, T&r) /* general compare functions, these are used for tree search algorithms * so they return <0, 0 or >0 */ +/* compare a host and a domain */ + +static int +aclHostDomainCompare( char *const &a, char * const &b) +{ + const char *h = (const char *)a; + const char *d = (const char *)b; + return matchDomainName(h, d); +} + + /* compare two domains */ template @@ -96,17 +107,6 @@ aclDomainCompare(T const &a, T const &b) return ret; } -/* compare a host and a domain */ - -static int -aclHostDomainCompare( char *const &a, char * const &b) -{ - const char *h = (const char *)a; - const char *d = (const char *)b; - return matchDomainName(h, d); -} - - bool ACLDomainData::match(char const *host) { diff --git a/src/ACLReplyHeaderStrategy.h b/src/ACLReplyHeaderStrategy.h index 9c6d6adebf..4ecc295c71 100644 --- a/src/ACLReplyHeaderStrategy.h +++ b/src/ACLReplyHeaderStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: ACLReplyHeaderStrategy.h,v 1.5 2004/10/20 22:37:56 hno Exp $ + * $Id: ACLReplyHeaderStrategy.h,v 1.6 2004/11/07 23:29:50 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,6 +38,8 @@ #include "ACL.h" #include "ACLData.h" #include "ACLStrategy.h" +#include "ACLChecklist.h" +#include "HttpReply.h" template diff --git a/src/ACLRequestHeaderStrategy.h b/src/ACLRequestHeaderStrategy.h index 1d5ab3666d..7538ed7424 100644 --- a/src/ACLRequestHeaderStrategy.h +++ b/src/ACLRequestHeaderStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: ACLRequestHeaderStrategy.h,v 1.7 2003/08/10 09:53:49 robertc Exp $ + * $Id: ACLRequestHeaderStrategy.h,v 1.8 2004/11/07 23:29:50 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -39,6 +39,7 @@ #include "ACLData.h" #include "ACLStrategy.h" #include "HttpRequest.h" +#include "ACLChecklist.h" template diff --git a/src/clientStream.cc b/src/clientStream.cc index 3dcd0a947d..948579e4c5 100644 --- a/src/clientStream.cc +++ b/src/clientStream.cc @@ -1,6 +1,6 @@ /* - * $Id: clientStream.cc,v 1.8 2003/04/06 08:23:10 robertc Exp $ + * $Id: clientStream.cc,v 1.9 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 87 Client-side Stream routines. * AUTHOR: Robert Collins @@ -134,8 +134,7 @@ clientStreamInit(dlink_list * list, CSR * func, CSD * rdetach, CSS * readstatus, { clientStreamNode *temp = clientStreamNew(func, NULL, rdetach, readstatus, readdata); - dlinkAdd(temp, &temp->node, list); - cbdataReference(temp); + dlinkAdd(cbdataReference(temp), &temp->node, list); temp->head = list; clientStreamInsertHead(list, NULL, callback, cdetach, NULL, callbackdata); temp = (clientStreamNode *)list->tail->data; @@ -164,9 +163,7 @@ clientStreamInsertHead(dlink_list * list, CSR * func, CSCB * callback, if (list->head->next) temp->readBuffer = ((clientStreamNode *)list->head->next->data)->readBuffer; - dlinkAddAfter(temp, &temp->node, list->head, list); - - cbdataReference(temp); + dlinkAddAfter(cbdataReference(temp), &temp->node, list->head, list); } /* diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 2b883d4167..1e7db26d0b 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.39 2004/10/20 22:48:52 hno Exp $ + * $Id: client_side_request.cc,v 1.40 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -93,8 +93,7 @@ ClientRequestContext::operator new (size_t size) ClientRequestContext *result = cbdataAlloc(ClientRequestContext); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void @@ -146,8 +145,7 @@ ClientHttpRequest::operator new (size_t size) ClientHttpRequest *result = cbdataAlloc(ClientHttpRequest); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void diff --git a/src/fs/aufs/store_io_aufs.cc b/src/fs/aufs/store_io_aufs.cc index c5b8c510c5..9ced197ee5 100644 --- a/src/fs/aufs/store_io_aufs.cc +++ b/src/fs/aufs/store_io_aufs.cc @@ -111,8 +111,7 @@ AUFSFile::operator new (size_t) AUFSFile *result = cbdataAlloc(AUFSFile); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void diff --git a/src/fs/diskd/store_io_diskd.cc b/src/fs/diskd/store_io_diskd.cc index 810de5c864..5d09f8fd06 100644 --- a/src/fs/diskd/store_io_diskd.cc +++ b/src/fs/diskd/store_io_diskd.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.cc,v 1.39 2003/09/06 12:47:36 robertc Exp $ + * $Id: store_io_diskd.cc,v 1.40 2004/11/07 23:29:51 hno Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -233,11 +233,10 @@ DiskdFile::operator new (size_t) { CBDATA_INIT_TYPE(DiskdFile); DiskdFile *result = cbdataAlloc(DiskdFile); + debug (79,3)("diskdFile with base %p allocating\n", result); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - debug (79,3)("diskdFile with base %p allocating\n", result); - return result; + return cbdataReference(result); } void diff --git a/src/fs/ufs/StoreFSufs.h b/src/fs/ufs/StoreFSufs.h index 947fad1029..cc80047c67 100644 --- a/src/fs/ufs/StoreFSufs.h +++ b/src/fs/ufs/StoreFSufs.h @@ -1,6 +1,6 @@ /* - * $Id: StoreFSufs.h,v 1.1 2003/07/22 15:23:14 robertc Exp $ + * $Id: StoreFSufs.h,v 1.2 2004/11/07 23:29:51 hno Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -36,7 +36,7 @@ #include "squid.h" -class IOModule; +#include "fs/ufs/IOModule.h" template diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index 67afbe3d18..c400e828e0 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.25 2004/11/07 14:03:18 hno Exp $ + * $Id: store_io_ufs.cc,v 1.26 2004/11/07 23:29:51 hno Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -103,8 +103,7 @@ UFSFile::operator new (size_t) UFSFile *result = cbdataAlloc(UFSFile); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void diff --git a/src/squid.h b/src/squid.h index bfb15660a6..3c1016e8ac 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.238 2004/10/20 22:41:05 hno Exp $ + * $Id: squid.h,v 1.239 2004/11/07 23:29:50 hno Exp $ * * AUTHOR: Duane Wessels * @@ -46,6 +46,7 @@ #else #define assert(EX) ((EX)?((void)0):xassert("EX", __FILE__, __LINE__)) #endif +extern void xassert(const char *, const char *, int); #if HAVE_UNISTD_H #include diff --git a/src/store_client.cc b/src/store_client.cc index e56fc483ce..9781aba748 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.135 2004/08/30 05:12:31 robertc Exp $ + * $Id: store_client.cc,v 1.136 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -322,14 +322,14 @@ storeClientCopy2(StoreEntry * e, store_client * sc) * everything we got before the abort condition occurred. */ /* Warning: doCopy may indirectly free itself in callbacks, - * hence the cbdata reference to keep it active for the duration of + * hence the lock to keep it active for the duration of * this function */ - cbdataReference(sc); + cbdataInternalLock(sc); assert (sc->flags.store_copying == 0); sc->doCopy(e); assert (sc->flags.store_copying == 0); - cbdataReferenceDone(sc); + cbdataInternalUnlock(sc); } void diff --git a/src/structs.h b/src/structs.h index ecf496397c..4b8ab0882c 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.494 2004/11/06 22:20:48 hno Exp $ + * $Id: structs.h,v 1.495 2004/11/07 23:29:50 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -911,7 +911,6 @@ public: /* bah. remove this when HttpHeaderEntry is moved * out */ -extern void xassert(const char *, const char *, int); MEMPROXY_CLASS_INLINE(HttpHeaderEntry) /* http surogate control header field */ diff --git a/src/ufscommon.cc b/src/ufscommon.cc index 7010005ec3..a72677c4a3 100644 --- a/src/ufscommon.cc +++ b/src/ufscommon.cc @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.11 2003/08/04 22:14:42 robertc Exp $ + * $Id: ufscommon.cc,v 1.12 2004/11/07 23:29:50 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Robert Collins @@ -52,8 +52,7 @@ RebuildState::operator new (size_t size) RebuildState *result = cbdataAlloc(RebuildState); /* Mark result as being owned - we want the refcounter to do the delete * call */ - cbdataReference(result); - return result; + return cbdataReference(result); } void