From: serassio <> Date: Mon, 26 Dec 2005 18:35:22 +0000 (+0000) Subject: Cannot build using gcc 4.1 with the error: X-Git-Tag: SQUID_3_0_PRE4~427 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8abf232cfd03c435ad04540df01c90e66ad12e02;p=thirdparty%2Fsquid.git Cannot build using gcc 4.1 with the error: warning: dereferencing type-punned pointer will break strict-aliasing rules This patch should fix the offending type casts. --- diff --git a/src/DiskIO/AIO/AIODiskIOStrategy.cc b/src/DiskIO/AIO/AIODiskIOStrategy.cc index c9d37ff1b9..e4be536f7c 100644 --- a/src/DiskIO/AIO/AIODiskIOStrategy.cc +++ b/src/DiskIO/AIO/AIODiskIOStrategy.cc @@ -1,6 +1,6 @@ /* - * $Id: AIODiskIOStrategy.cc,v 1.2 2005/03/10 21:49:20 serassio Exp $ + * $Id: AIODiskIOStrategy.cc,v 1.3 2005/12/26 11:35:22 serassio Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -153,7 +153,8 @@ AIODiskIOStrategy::callback() callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata); AIODiskFile * theFile = NULL; void *theFileVoid = NULL; - bool fileOk = cbdataReferenceValidDone(aqe->theFile, &theFileVoid); + void *theTmpFile = aqe->theFile; + bool fileOk = cbdataReferenceValidDone(theTmpFile, &theFileVoid); if (fileOk) { theFile = static_cast(theFileVoid); diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 4cd325007e..58f8ec77ef 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.109 2005/12/13 21:41:57 wessels Exp $ + * $Id: HttpHeader.cc,v 1.110 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -278,23 +278,23 @@ httpHeaderInitModule(void) /* create masks */ httpHeaderMaskInit(&ListHeadersMask, 0); - httpHeaderCalcMask(&ListHeadersMask, (const int *) ListHeadersArr, countof(ListHeadersArr)); + httpHeaderCalcMask(&ListHeadersMask, ListHeadersArr, countof(ListHeadersArr)); httpHeaderMaskInit(&ReplyHeadersMask, 0); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) ReplyHeadersArr, countof(ReplyHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, ReplyHeadersArr, countof(ReplyHeadersArr)); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) GeneralHeadersArr, countof(GeneralHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, GeneralHeadersArr, countof(GeneralHeadersArr)); - httpHeaderCalcMask(&ReplyHeadersMask, (const int *) EntityHeadersArr, countof(EntityHeadersArr)); + httpHeaderCalcMask(&ReplyHeadersMask, EntityHeadersArr, countof(EntityHeadersArr)); httpHeaderMaskInit(&RequestHeadersMask, 0); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) RequestHeadersArr, countof(RequestHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, RequestHeadersArr, countof(RequestHeadersArr)); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) GeneralHeadersArr, countof(GeneralHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, GeneralHeadersArr, countof(GeneralHeadersArr)); - httpHeaderCalcMask(&RequestHeadersMask, (const int *) EntityHeadersArr, countof(EntityHeadersArr)); + httpHeaderCalcMask(&RequestHeadersMask, EntityHeadersArr, countof(EntityHeadersArr)); /* init header stats */ assert(HttpHeaderStatCount == hoReply + 1); diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index a90c22838f..6942fac767 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.52 2005/11/04 20:27:31 wessels Exp $ + * $Id: HttpHeaderTools.cc,v 1.53 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -91,9 +91,10 @@ httpHeaderMaskInit(HttpHeaderMask * mask, int value) /* calculates a bit mask of a given array; does not reset mask! */ void -httpHeaderCalcMask(HttpHeaderMask * mask, const int *enums, size_t count) +httpHeaderCalcMask(HttpHeaderMask * mask, http_hdr_type http_hdr_type_enums[], size_t count) { size_t i; + const int * enums = (const int *) http_hdr_type_enums; assert(mask && enums); assert(count < sizeof(*mask) * 8); /* check for overflow */ diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 40c3895edf..6b44915c35 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.80 2005/11/21 22:49:04 wessels Exp $ + * $Id: HttpReply.cc,v 1.81 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -57,7 +57,7 @@ httpReplyInitModule(void) { assert(HTTP_STATUS_NONE == 0); // HttpReply::parse() interface assumes that httpHeaderMaskInit(&Denied304HeadersMask, 0); - httpHeaderCalcMask(&Denied304HeadersMask, (const int *) Denied304HeadersArr, countof(Denied304HeadersArr)); + httpHeaderCalcMask(&Denied304HeadersMask, Denied304HeadersArr, countof(Denied304HeadersArr)); } HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0), expires (0), surrogate_control (NULL), content_range (NULL), keep_alive (0), protoPrefix("HTTP/") diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 2a982de1ef..27c190fc57 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.486 2005/11/21 23:10:22 wessels Exp $ + * $Id: cache_cf.cc,v 1.487 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -3004,8 +3004,10 @@ parse_https_port_list(https_port_list ** head) } } - while (*head) - head = (https_port_list **)&(*head)->http.next; + while (*head) { + http_port_list ** headTmp = &(*head)->http.next; + head = (https_port_list **)headTmp; + } *head = s; } diff --git a/src/peer_digest.cc b/src/peer_digest.cc index f154549ea5..3a2976b7d3 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.cc,v 1.105 2005/11/05 00:08:32 wessels Exp $ + * $Id: peer_digest.cc,v 1.106 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -140,13 +140,14 @@ peerDigestCreate(peer * p) static void peerDigestDestroy(PeerDigest * pd) { - peer *p; + void *p; assert(pd); + void * peerTmp = pd->peer; /* inform peer (if any) that we are gone */ - if (cbdataReferenceValidDone(pd->peer, (void **) &p)) - peerNoteDigestGone(p); + if (cbdataReferenceValidDone(peerTmp, &p)) + peerNoteDigestGone((peer *)p); peerDigestClean(pd); diff --git a/src/protos.h b/src/protos.h index 2e5e0c3c51..1a0285874f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.515 2005/12/06 23:03:34 wessels Exp $ + * $Id: protos.h,v 1.516 2005/12/26 11:35:22 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -360,7 +360,7 @@ SQUIDCEXTERN http_hdr_type httpHeaderIdByName(const char *name, int name_len, co SQUIDCEXTERN http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len); SQUIDCEXTERN const char *httpHeaderNameById(int id); SQUIDCEXTERN void httpHeaderMaskInit(HttpHeaderMask * mask, int value); -SQUIDCEXTERN void httpHeaderCalcMask(HttpHeaderMask * mask, const int *enums, size_t count); +SQUIDCEXTERN void httpHeaderCalcMask(HttpHeaderMask * mask, http_hdr_type http_hdr_type_enums[], size_t count); SQUIDCEXTERN int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); SQUIDCEXTERN void strListAdd(String * str, const char *item, char del); SQUIDCEXTERN int strListIsMember(const String * str, const char *item, char del); diff --git a/src/snmp_core.cc b/src/snmp_core.cc index c1ea229153..4870fb3d26 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.72 2005/12/09 01:02:24 wessels Exp $ + * $Id: snmp_core.cc,v 1.73 2005/12/26 11:35:22 serassio Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -632,7 +632,9 @@ static struct snmp_pdu * xfree(NextOidName); } - VarNew = (*ParseFn) (VarPtr, (snint *) & (Answer->errstat)); + int * errstatTmp = &(Answer->errstat); + + VarNew = (*ParseFn) (VarPtr, (snint *) errstatTmp); if (get_next) snmp_var_free(VarPtr);