From 59a09b98f631cb154487ce5cd65b09fafd4a07a3 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Tue, 24 Aug 2010 12:35:03 +0200 Subject: [PATCH] Solaris compatiblity enhancements. --- acinclude/compiler-flags.m4 | 6 +++++- configure.in | 3 ++- helpers/ntlm_auth/fake/ntlm_fake_auth.cc | 8 +++---- helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc | 3 ++- src/DiskIO/DiskThreads/aiops.cc | 4 ++-- src/HttpHeader.cc | 2 +- src/disk.cc | 8 ++++++- src/esi/Include.cc | 8 +++---- src/esi/Include.h | 2 +- src/icmp/net_db.h | 2 +- src/ipcache.cc | 3 +++ src/mem.cc | 8 ++++++- src/protos.h | 17 +++++++-------- src/tests/stub_HttpReply.cc | 2 +- tools/purge/conffile.hh | 6 ++++-- tools/purge/convert.hh | 8 ++++--- tools/purge/copyout.hh | 6 ++++-- tools/purge/purge.cc | 22 ++++++++++---------- tools/purge/signal.hh | 6 ++++-- tools/purge/socket.hh | 6 ++++-- tools/purge/squid-tlv.hh | 8 ++++--- 21 files changed, 85 insertions(+), 53 deletions(-) diff --git a/acinclude/compiler-flags.m4 b/acinclude/compiler-flags.m4 index 6f806169ea..65221c7e4b 100644 --- a/acinclude/compiler-flags.m4 +++ b/acinclude/compiler-flags.m4 @@ -100,6 +100,7 @@ AC_DEFUN([SQUID_CC_GUESS_VARIANT], [ # options # They are (with their GCC equivalent): # squid_cv_cc_option_werror (-Werror) +# squid_cv_cxx_option_werror (-Werror) # squid_cv_cc_option_wall (-Wall) # squid_cv_cc_option_optimize (-O3) # @@ -109,17 +110,20 @@ AC_DEFUN([SQUID_CC_GUESS_OPTIONS], [ case "$squid_cv_compiler" in gcc) squid_cv_cc_option_werror="-Werror" + squid_cv_cxx_option_werror="-Werror" squid_cv_cc_option_wall="-Wall" squid_cv_cc_option_optimize="-O3" squid_cv_cc_arg_pipe="-pipe" ;; sunstudio) - squid_cv_cc_option_werror="-errwarn=%all" + squid_cv_cc_option_werror="-errwarn=%all -errtags" + squid_cv_cxx_option_werror="-errwarn=%all,no%badargtype2w,no%wbadinit,no%wbadasg -errtags" squid_cv_cc_option_wall="+w" squid_cv_cc_option_optimize="-fast" squid_cv_cc_arg_pipe="" ;; *) + squid_cv_cxx_option_werror="" squid_cv_cc_option_werror="" squid_cv_cc_option_wall="" squid_cv_cc_option_optimize="-O" diff --git a/configure.in b/configure.in index 61500805ef..81ef1b73e6 100644 --- a/configure.in +++ b/configure.in @@ -281,7 +281,7 @@ fi if test "x$enable_strict_error_checking" != "xno"; then SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror" - SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_option_werror" + SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror" fi AC_SUBST(SQUID_CFLAGS) @@ -2281,6 +2281,7 @@ AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_OFF_T AC_TYPE_UID_T +AC_CHECK_TYPE([bool]) #need the defines for PRId64 AC_CHECK_SIZEOF(int64_t) AC_CHECK_SIZEOF(long) diff --git a/helpers/ntlm_auth/fake/ntlm_fake_auth.cc b/helpers/ntlm_auth/fake/ntlm_fake_auth.cc index 3943228bb4..73b8a35cc7 100644 --- a/helpers/ntlm_auth/fake/ntlm_fake_auth.cc +++ b/helpers/ntlm_auth/fake/ntlm_fake_auth.cc @@ -79,11 +79,11 @@ #define SEND(X) debug("sending '%s' to squid\n",X); printf(X "\n"); #ifdef __GNUC__ #define SEND2(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y); -#define SEND3(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y); +#define SEND4(X,Y...) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y); #else /* no gcc, no debugging. varargs macros are a gcc extension */ #define SEND2(X,Y) debug("sending '" X "' to squid\n",Y); printf(X "\n",Y); -#define SEND3(X,Y,Z) debug("sending '" X "' to squid\n",Y,Z); printf(X "\n",Y,Z); +#define SEND4(X,Y,Z,W) debug("sending '" X "' to squid\n",Y,Z); printf(X "\n",Y,Z); #endif const char *authenticate_ntlm_domain = "WORKGROUP"; @@ -213,12 +213,12 @@ main(int argc, char *argv[]) if (strip_domain_enabled) { SEND2("AF %s", user); } else { - SEND3("AF %s%s%s", domain, (*domain?"\\":""), user); + SEND4("AF %s%s%s", domain, (*domain?"\\":""), user); } } else { lc(user); lc(domain); - SEND3("NA invalid credentials, user=%s%s%s", domain, (*domain?"\\":""), user); + SEND4("NA invalid credentials, user=%s%s%s", domain, (*domain?"\\":""), user); } } else { SEND("BH wrong packet type! user="); diff --git a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc index 2bd9a0d316..bef750d266 100644 --- a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc +++ b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc @@ -15,6 +15,7 @@ */ #define SQUID_NO_ALLOC_PROTECT 1 #include "config.h" +#include "compat/debug.h" #include "libntlmauth/ntlmauth.h" #include "libntlmauth/smb.h" #include "libntlmauth/rfcnb.h" @@ -401,7 +402,7 @@ usage() my_program_name, my_program_name); } -int debug_enabled=0; +/* int debug_enabled=0; defined in libcompat */ void process_options(int argc, char *argv[]) diff --git a/src/DiskIO/DiskThreads/aiops.cc b/src/DiskIO/DiskThreads/aiops.cc index ca753f7e32..dadcfed3ed 100644 --- a/src/DiskIO/DiskThreads/aiops.cc +++ b/src/DiskIO/DiskThreads/aiops.cc @@ -108,7 +108,7 @@ struct squidaio_thread_t { static void squidaio_queue_request(squidaio_request_t *); static void squidaio_cleanup_request(squidaio_request_t *); -static void *squidaio_thread_loop(void *); +SQUIDCEXTERN void *squidaio_thread_loop(void *); static void squidaio_do_open(squidaio_request_t *); static void squidaio_do_read(squidaio_request_t *); static void squidaio_do_write(squidaio_request_t *); @@ -360,7 +360,7 @@ squidaio_shutdown(void) squidaio_initialised = 0; } -static void * +void * squidaio_thread_loop(void *ptr) { squidaio_thread_t *threadp = (squidaio_thread_t *)ptr; diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 38807f4d8b..d93f2f032f 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1607,7 +1607,7 @@ httpHeaderNoteParsedEntry(http_hdr_type id, String const &context, int error) extern const HttpHeaderStat *dump_stat; /* argh! */ const HttpHeaderStat *dump_stat = NULL; -static void +void httpHeaderFieldStatDumper(StoreEntry * sentry, int idx, double val, double size, int count) { const int id = (int) val; diff --git a/src/disk.cc b/src/disk.cc index a2ff08dabe..29303dffe4 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -54,6 +54,12 @@ disk_init(void) (void) 0; } +/* hack needed on SunStudio to avoid linkage convention mismatch */ +static void cxx_xfree(void *ptr) +{ + xfree(ptr); +} + /* * opens a disk file specified by 'path'. This function always * blocks! There is no callback. @@ -188,7 +194,7 @@ diskCombineWrites(struct _fde_disk *fdd) wq->next = NULL; - wq->free_func = xfree; + wq->free_func = cxx_xfree; do { q = fdd->write_q; diff --git a/src/esi/Include.cc b/src/esi/Include.cc index d869b82204..797fbd3fdb 100644 --- a/src/esi/Include.cc +++ b/src/esi/Include.cc @@ -116,7 +116,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * if (rep) { if (rep->sline.status != HTTP_OK) { rep = NULL; - esiStream->include->fail (esiStream); + esiStream->include->includeFail (esiStream); esiStream->finished = 1; httpRequestFree (http); return; @@ -168,7 +168,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * /* XXX when reviewing ESI this is the first place to look */ node->data = NULL; esiStream->finished = 1; - esiStream->include->fail (esiStream); + esiStream->include->includeFail (esiStream); return; }; @@ -185,7 +185,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * case STREAM_FAILED: debugs(86, 1, "ESI subrequest failed transfer"); - esiStream->include->fail (esiStream); + esiStream->include->includeFail (esiStream); esiStream->finished = 1; httpRequestFree (http); return; @@ -472,7 +472,7 @@ ESIInclude::process (int dovars) } void -ESIInclude::fail (ESIStreamContext::Pointer stream) +ESIInclude::includeFail (ESIStreamContext::Pointer stream) { subRequestDone (stream, false); } diff --git a/src/esi/Include.h b/src/esi/Include.h index d8b836cf74..a364d5ebd1 100644 --- a/src/esi/Include.h +++ b/src/esi/Include.h @@ -90,7 +90,7 @@ public: ESISegment::Pointer altcontent; ESIVarState *varState; char *srcurl, *alturl; - void fail(ESIStreamContext::Pointer); + void includeFail(ESIStreamContext::Pointer); void finish(); private: diff --git a/src/icmp/net_db.h b/src/icmp/net_db.h index 68794d4509..97e1343b63 100644 --- a/src/icmp/net_db.h +++ b/src/icmp/net_db.h @@ -19,7 +19,7 @@ SQUIDCEXTERN void netdbInit(void); SQUIDCEXTERN void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt); SQUIDCEXTERN void netdbPingSite(const char *hostname); -SQUIDCEXTERN void netdbDump(StoreEntry *); +void netdbDump(StoreEntry *); SQUIDCEXTERN void netdbFreeMemory(void); SQUIDCEXTERN int netdbHostHops(const char *host); diff --git a/src/ipcache.cc b/src/ipcache.cc index 3210065853..20f1b3d3c5 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -126,6 +126,9 @@ static struct _ipcache_stats { /// \ingroup IPCacheInternal static dlink_list lru_list; +// forward-decls +static void stat_ipcache_get(StoreEntry *); + static FREE ipcacheFreeEntry; #if USE_DNSSERVERS static HLPCB ipcacheHandleReply; diff --git a/src/mem.cc b/src/mem.cc index a94cf5545c..eb7f554abd 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -543,6 +543,12 @@ memFree64K(void *p) memFree(p, MEM_64K_BUF); } +static void +cxx_xfree(void * ptr) +{ + xfree(ptr); +} + FREE * memFreeBufFunc(size_t size) { @@ -569,7 +575,7 @@ memFreeBufFunc(size_t size) default: memMeterDec(HugeBufCountMeter); memMeterDel(HugeBufVolumeMeter, size); - return xfree; + return cxx_xfree; } } diff --git a/src/protos.h b/src/protos.h index a71cb5a4df..572eba10ca 100644 --- a/src/protos.h +++ b/src/protos.h @@ -157,14 +157,14 @@ SQUIDCEXTERN void fqdncache_nbgethostbyaddr(const Ip::Address &, FQDNH *, void * SQUIDCEXTERN const char *fqdncache_gethostbyaddr(const Ip::Address &, int flags); SQUIDCEXTERN void fqdncache_init(void); -SQUIDCEXTERN void fqdnStats(StoreEntry *); +void fqdnStats(StoreEntry *); SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *); SQUIDCEXTERN const char *fqdnFromAddr(const Ip::Address &); SQUIDCEXTERN int fqdncacheQueueDrain(void); SQUIDCEXTERN void fqdncacheFreeMemory(void); SQUIDCEXTERN void fqdncache_restart(void); -SQUIDCEXTERN void fqdncache_purgelru(void *); +void fqdncache_purgelru(void *); SQUIDCEXTERN void fqdncacheAddEntryFromHosts(char *addr, wordlist * hostnames); class FwdState; @@ -250,7 +250,7 @@ SQUIDCEXTERN void httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p); SQUIDCEXTERN void httpHdrCcSetMaxAge(HttpHdrCc * cc, int max_age); SQUIDCEXTERN void httpHdrCcSetSMaxAge(HttpHdrCc * cc, int s_maxage); SQUIDCEXTERN void httpHdrCcUpdateStats(const HttpHdrCc * cc, StatHist * hist); -SQUIDCEXTERN void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); +void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); /* Http Header Tools */ class HttpHeaderFieldInfo; @@ -276,7 +276,7 @@ SQUIDCEXTERN void httpHeaderInitModule(void); SQUIDCEXTERN void httpHeaderCleanModule(void); /* store report about current header usage and other stats */ -SQUIDCEXTERN void httpHeaderStoreReport(StoreEntry * e); +void httpHeaderStoreReport(StoreEntry * e); SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *, int req_or_rep); SQUIDCEXTERN int httpReqHdrManglersConfigured(); @@ -321,15 +321,14 @@ extern void wccp2ConnectionOpen(void); extern void wccp2ConnectionClose(void); #endif /* USE_WCCPv2 */ +void ipcache_purgelru(void *); SQUIDCEXTERN void ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData); -SQUIDCEXTERN void ipcache_purgelru(void *); SQUIDCEXTERN const ipcache_addrs *ipcache_gethostbyname(const char *, int flags); SQUIDCEXTERN void ipcacheInvalidate(const char *); SQUIDCEXTERN void ipcacheInvalidateNegative(const char *); SQUIDCEXTERN void ipcache_init(void); -SQUIDCEXTERN void stat_ipcache_get(StoreEntry *); SQUIDCEXTERN void ipcacheCycleAddr(const char *name, ipcache_addrs *); SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, const Ip::Address &); SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, const Ip::Address &); @@ -556,12 +555,12 @@ SQUIDCEXTERN int storeClientIsThisAClient(store_client * sc, void *someClient); SQUIDCEXTERN const char *getMyHostname(void); SQUIDCEXTERN const char *uniqueHostname(void); SQUIDCEXTERN void safeunlink(const char *path, int quiet); -SQUIDCEXTERN void death(int sig); +void death(int sig); SQUIDCEXTERN void fatal(const char *message); SQUIDCEXTERN void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; SQUIDCEXTERN void fatal_dump(const char *message); -SQUIDCEXTERN void sigusr2_handle(int sig); -SQUIDCEXTERN void sig_child(int sig); +void sigusr2_handle(int sig); +void sig_child(int sig); SQUIDCEXTERN void leave_suid(void); SQUIDCEXTERN void enter_suid(void); SQUIDCEXTERN void no_suid(void); diff --git a/src/tests/stub_HttpReply.cc b/src/tests/stub_HttpReply.cc index 1e7a59953c..87a048ffb6 100644 --- a/src/tests/stub_HttpReply.cc +++ b/src/tests/stub_HttpReply.cc @@ -47,7 +47,7 @@ HttpReply::~HttpReply() void HttpReply::setHeaders(http_status status, const char *reason, - const char *ctype, int64_t clen, time_t lmt, time_t expires) + const char *ctype, int64_t clen, time_t lmt, time_t expires_) { fatal ("Not implemented"); } diff --git a/tools/purge/conffile.hh b/tools/purge/conffile.hh index e2fc9cc58b..ffb87c4e62 100644 --- a/tools/purge/conffile.hh +++ b/tools/purge/conffile.hh @@ -41,16 +41,18 @@ #ifndef _CONFFILE_HH #define _CONFFILE_HH +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL +#ifndef HAVE_BOOL +#define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ #ifndef DEFAULT_SQUID_CONF diff --git a/tools/purge/convert.hh b/tools/purge/convert.hh index 164f135a71..a2d9d40fa7 100644 --- a/tools/purge/convert.hh +++ b/tools/purge/convert.hh @@ -41,16 +41,18 @@ #ifndef _CONVERT_HH #define _CONVERT_HH +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL -typedef int bool; +#ifndef HAVE_BOOL +#define HAVE_BOOL 1 +typedef char bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ #include #include diff --git a/tools/purge/copyout.hh b/tools/purge/copyout.hh index f9fe80a499..2b4b6011f6 100644 --- a/tools/purge/copyout.hh +++ b/tools/purge/copyout.hh @@ -37,16 +37,18 @@ #ifndef _COPYOUT_HH #define _COPYOUT_HH +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL +#ifndef HAVE_BOOL +#define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ int assert_copydir( const char* copydir ); diff --git a/tools/purge/purge.cc b/tools/purge/purge.cc index c18909a0ec..9535ea2cda 100644 --- a/tools/purge/purge.cc +++ b/tools/purge/purge.cc @@ -146,7 +146,7 @@ volatile sig_atomic_t term_flag = 0; // 'terminate' is a gcc 2.8.x internal... char* linebuffer = 0; size_t buffersize = 16834; static char* copydir = 0; -static unsigned debug = 0; +static unsigned debugFlag = 0; static unsigned purgeMode = 0; static bool iamalive = false; static bool reminder = false; @@ -333,7 +333,7 @@ action( int fd, size_t metasize, // if we want to copy out the file, do that first of all. if ( ::copydir && *copydir && size > 0 ) - copy_out( st.st_size, metasize, ::debug, + copy_out( st.st_size, metasize, ::debugFlag, fn, url, ::copydir, ::envelope ); // do we need to PURGE the file, yes, if purgemode bit#0 was set. @@ -398,7 +398,7 @@ match( const char* fn, const REList* list ) static const size_t addon = sizeof(unsigned char) + sizeof(unsigned int); bool flag = true; - if ( debug & 0x01 ) fprintf( stderr, "# [3] %s\n", fn ); + if ( debugFlag & 0x01 ) fprintf( stderr, "# [3] %s\n", fn ); int fd = open( fn, O_RDONLY ); if ( fd != -1 ) { if ( read(fd,::linebuffer,::buffersize-1) > 60 ) { @@ -481,7 +481,7 @@ filelevel( const char* directory, const REList* list ) // returns: true, if every subdir && action was successful. { struct dirent* entry; - if ( debug & 0x01 ) + if ( debugFlag & 0x01 ) fprintf( stderr, "# [2] %s\n", directory ); DIR* dir = opendir( directory ); @@ -523,7 +523,7 @@ dirlevel( const char* dirname, const REList* list, bool level=false ) // warning: this function is once-recursive, no deeper. { struct dirent* entry; - if ( debug & 0x01 ) + if ( debugFlag & 0x01 ) fprintf( stderr, "# [%d] %s\n", (level ? 1 : 0), dirname ); DIR* dir = opendir( dirname ); @@ -642,7 +642,7 @@ parseCommandline( int argc, char* argv[], REList*& head, break; case 'd': - ::debug = strtoul( optarg, 0, 0 ); + ::debugFlag = strtoul( optarg, 0, 0 ); break; case 'E': @@ -738,7 +738,7 @@ parseCommandline( int argc, char* argv[], REList*& head, } // adjust - if ( ! isatty(fileno(stdout)) || (::debug & 0x01) ) ::iamalive = false; + if ( ! isatty(fileno(stdout)) || (::debugFlag & 0x01) ) ::iamalive = false; if ( head == 0 ) { fputs( "There was no regular expression defined. If you intend\n", stderr ); fputs( "to match all possible URLs, use \"-e .\" instead.\n", stderr ); @@ -757,7 +757,7 @@ parseCommandline( int argc, char* argv[], REList*& head, printf( "#\n# Currently active values for %s:\n# %s\n", ::programname, ::RCS_ID ); printf( "# Debug level : " ); - if ( ::debug ) printf( "%#6.4hx", ::debug ); + if ( ::debugFlag ) printf( "%#6.4hx", ::debugFlag ); else printf( "production level" ); // printf omits 0x prefix for 0! printf( " + %s mode", ::no_fork ? "linear" : "parallel" ); puts( ::verbose ? " + extra verbosity" : "" ); @@ -869,7 +869,7 @@ main( int argc, char* argv[] ) // try to read squid.conf file to determine all cache_dir locations CacheDirVector cdv(0); - if ( readConfigFile( cdv, conffile, debug ? stderr : 0 ) > 0 ) { + if ( readConfigFile( cdv, conffile, debugFlag ? stderr : 0 ) > 0 ) { // there are some valid cache_dir entries. // unless forking was forbidden by cmdline option, // for a process for each cache_dir entry to remove files. @@ -921,7 +921,7 @@ main( int argc, char* argv[] ) return 0; } else { // parent mode - if ( ::debug ) printf( "forked child %d\n", (int) child[i] ); + if ( ::debugFlag ) printf( "forked child %d\n", (int) child[i] ); } } } @@ -932,7 +932,7 @@ main( int argc, char* argv[] ) for ( size_t i=0; i < cdv.size(); ++i ) { while ( (temp=waitpid( (pid_t)-1, &status, 0 )) == -1 ) if ( errno == EINTR ) continue; - if ( ::debug ) printf( "collected child %d\n", (int) temp ); + if ( ::debugFlag ) printf( "collected child %d\n", (int) temp ); } delete[] child; } diff --git a/tools/purge/signal.hh b/tools/purge/signal.hh index 73d1cdfadf..8760624b4c 100644 --- a/tools/purge/signal.hh +++ b/tools/purge/signal.hh @@ -57,16 +57,18 @@ #include #endif +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL +#ifndef HAVE_BOOL +#define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ #if 1 // so far, all systems I know use void # define SIGRETTYPE void diff --git a/tools/purge/socket.hh b/tools/purge/socket.hh index e2bec356b8..e6ef40c0b9 100644 --- a/tools/purge/socket.hh +++ b/tools/purge/socket.hh @@ -47,16 +47,18 @@ #ifndef _SOCKET_HH #define _SOCKET_HH +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL +#ifndef HAVE_BOOL +#define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ #include #include // SOMAXCONN diff --git a/tools/purge/squid-tlv.hh b/tools/purge/squid-tlv.hh index 08765ccccf..a8531d2c19 100644 --- a/tools/purge/squid-tlv.hh +++ b/tools/purge/squid-tlv.hh @@ -37,16 +37,18 @@ #ifndef _SQUID_TLV_HH #define _SQUID_TLV_HH +#if !defined(__cplusplus) #if defined(__GNUC__) || defined(__GNUG__) #pragma interface #else -#ifndef HAS_BOOL -#define HAS_BOOL +#ifndef HAVE_BOOL +#define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif #endif +#endif /* __cplusplus */ #include #include @@ -66,7 +68,7 @@ enum SquidMetaType { STORE_META_VALID, STORE_META_VARY_HEADERS, // Stores Vary request headers STORE_META_STD_LFS, // standard metadata in lfs format - STORE_META_OBJSIZE, // object size, if its known + STORE_META_OBJSIZE // object size, if its known }; // taken from Squid-2.x -- 2.47.2