From: Amos Jeffries Date: Wed, 21 Jan 2009 09:46:54 +0000 (+1300) Subject: Remove duplicate code now in libsquid-compat X-Git-Tag: SQUID_3_2_0_1~1190^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cf3b000dd5ed5abbe0b69142b50e06b8b9d324c;p=thirdparty%2Fsquid.git Remove duplicate code now in libsquid-compat --- diff --git a/include/config.h b/include/config.h index a050ff9e8b..e4b401f6f3 100644 --- a/include/config.h +++ b/include/config.h @@ -63,92 +63,9 @@ #endif #endif -/* define the _SQUID_TYPE_ based on a guess of the OS */ -#if defined(__sun__) || defined(__sun) /* SUN */ -#define _SQUID_SUN_ -#if defined(__SVR4) /* SOLARIS */ -#define _SQUID_SOLARIS_ -#else /* SUNOS */ -#define _SQUID_SUNOS_ -#endif - -#elif defined(__hpux) /* HP-UX - SysV-like? */ -#define _SQUID_HPUX_ -#define _SQUID_SYSV_ - -#elif defined(__osf__) /* OSF/1 */ -#define _SQUID_OSF_ - -#elif defined(__ultrix) /* Ultrix */ -#define _SQUID_ULTRIX_ - -#elif defined(_AIX) /* AIX */ -#define _SQUID_AIX_ - -#elif defined(__linux__) /* Linux */ -#define _SQUID_LINUX_ -#if USE_ASYNC_IO -#define _SQUID_LINUX_THREADS_ -#endif - -#elif defined(__FreeBSD__) /* FreeBSD */ -#define _SQUID_FREEBSD_ -#if USE_ASYNC_IO && defined(LINUXTHREADS) -#define _SQUID_LINUX_THREADS_ -#endif - -#elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */ -#define _SQUID_SGI_ -#if !defined(_SVR4_SOURCE) -#define _SVR4_SOURCE /* for tempnam(3) */ -#endif -#if USE_ASYNC_IO -#define _ABI_SOURCE -#endif /* USE_ASYNC_IO */ - -#elif defined(__NeXT__) -#define _SQUID_NEXT_ - -#elif defined(__bsdi__) -#define _SQUID_BSDI_ /* BSD/OS */ - -#elif defined(__NetBSD__) -#define _SQUID_NETBSD_ - -#elif defined(__OpenBSD__) -#define _SQUID_OPENBSD_ - -#elif defined(__DragonFly__) -#define _SQUID_DRAGONFLY_ - -#elif defined(__CYGWIN32__) || defined(__CYGWIN__) -#define _SQUID_CYGWIN_ -#define _SQUID_WIN32_ - -#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32) -#define _SQUID_MSWIN_ -#define _SQUID_WIN32_ -#include "squid_mswin.h" - -#elif defined(__APPLE__) -#define _SQUID_APPLE_ - -#elif defined(sony_news) && defined(__svr4) -#define _SQUID_NEWSOS6_ - -#elif defined(__EMX__) || defined(OS2) || defined(__OS2__) -#define _SQUID_OS2_ -/* -* FIXME: the os2 port of bash seems to have problems checking -* the return codes of programs in if statements. These options -* need to be overridden. -*/ -#endif /* Typedefs for missing entries on a system */ -#include "squid_types.h" - /* int8_t */ #ifndef HAVE_INT8_T #if HAVE_CHAR && SIZEOF_CHAR == 1 @@ -262,40 +179,6 @@ typedef int socklen_t; typedef long mtyp_t; #endif -/* - * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files - * that is incompatible with the updated Solaris header files. - */ -#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386)) -#ifndef HAVE_PAD128_T -typedef union { - long double _q; - int32_t _l[4]; -} pad128_t; -#endif -#ifndef HAVE_UPAD128_T -typedef union { - long double _q; - uint32_t _l[4]; -} upad128_t; -#endif -#endif - -/* - * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD - */ -#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_)) -#undef HAVE_MALLOC_H -#endif - -/* - * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu) - */ -#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init) -#define res_init __res_init -#define HAVE_RES_INIT HAVE___RES_INIT -#endif - #if !defined(CACHEMGR_HOSTNAME) #define CACHEMGR_HOSTNAME "" #else @@ -379,33 +262,6 @@ typedef union { #define LEAK_CHECK_MODE 1 #endif -/* - * valgrind debug support - */ -#if WITH_VALGRIND -#include -/* A little glue for older valgrind version prior to 3.2.0 */ -#ifndef VALGRIND_MAKE_MEM_NOACCESS -#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS -#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE -#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE -#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE -#else -#undef VALGRIND_MAKE_NOACCESS -#undef VALGRIND_MAKE_WRITABLE -#undef VALGRIND_MAKE_READABLE -#endif -#else -#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0) -#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0) -#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0) -#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0) -#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0) -#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d) -#define VALGRIND_FREELIKE_BLOCK(a,b) -#define RUNNING_ON_VALGRIND 0 -#endif /* WITH_VALGRIND */ - /* * strnstr() is needed. The OS may not provide a working copy. diff --git a/libsquid-compat/compat.h b/libsquid-compat/compat.h index d959778bf7..980ef0759d 100644 --- a/libsquid-compat/compat.h +++ b/libsquid-compat/compat.h @@ -7,16 +7,16 @@ /* * From discussions it was chosen to push compat code as far down as possible. - * That means we can eventually have a seperate libcompat for most + * That means we can have a seperate libsquid-compat for most * compatability and portability hacks and resolutions. * * This file is meant to collate all those hacks files together and - * provide a simple include form them in the core squid headers + * provide a simple include for them in the core squid headers * (presently squid.h and config.h) * * It should not be included directly in any of the squid sources. * If your code requires any symbols from here you should be importing - * squid.h at the top line of your .cc or .h file. + * config.h/squid.h at the top line of your .cc or .h file. */ @@ -50,17 +50,21 @@ /*****************************************************/ #include "os/squid_aix.h" +#include "os/squid_dragonfly.h" #include "os/squid_freebsd.h" #include "os/squid_hpux.h" #include "os/squid_linux.h" #include "os/squid_mswin.h" #include "os/squid_next.h" #include "os/squid_openbsd.h" +#include "os/squid_os2.h" #include "os/squid_qnx.h" #include "os/squid_sgi.h" #include "os/squid_solaris.h" +#include "os/squid_sunos.h" #include "os/squid_windows.h" + /*****************************************************/ /* portabilities shared between all platforms and */ /* components as found to be needed */ diff --git a/libsquid-compat/os/squid_dragonfly.h b/libsquid-compat/os/squid_dragonfly.h new file mode 100644 index 0000000000..e7fa90448f --- /dev/null +++ b/libsquid-compat/os/squid_dragonfly.h @@ -0,0 +1,25 @@ +#ifndef SQUID_CONFIG_H +#include "config.h" +#endif + +#ifndef SQUID_OS_DRAGONFLY_H +#define SQUID_OS_DRAGONFLY_H + +#ifdef _SQUID_DRAGONFLY_ + +/**************************************************************************** + *--------------------------------------------------------------------------* + * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...* + *--------------------------------------------------------------------------* + ****************************************************************************/ + +/* + * Don't allow inclusion of malloc.h + */ +#if defined(HAVE_MALLOC_H) +#undef HAVE_MALLOC_H +#endif + + +#endif /* _SQUID_DRAGONFLY_ */ +#endif /* SQUID_OS_DRAGONFLY_H */ diff --git a/libsquid-compat/os/squid_os2.h b/libsquid-compat/os/squid_os2.h new file mode 100644 index 0000000000..92f99f1004 --- /dev/null +++ b/libsquid-compat/os/squid_os2.h @@ -0,0 +1,24 @@ +#ifndef SQUID_CONFIG_H +#include "config.h" +#endif + +#ifndef SQUID_OS_OS2_H +#define SQUID_OS_OS2_H + +#ifdef _SQUID_OS2_ + +/**************************************************************************** + *--------------------------------------------------------------------------* + * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...* + *--------------------------------------------------------------------------* + ****************************************************************************/ + +/* +* FIXME: the os2 port of bash seems to have problems checking +* the return codes of programs in if statements. These options +* need to be overridden. +*/ + + +#endif /* _SQUID_OS2_ */ +#endif /* SQUID_OS_OS2_H */ diff --git a/libsquid-compat/osdetect.h b/libsquid-compat/osdetect.h index e32b6295b4..fb1eb9acad 100644 --- a/libsquid-compat/osdetect.h +++ b/libsquid-compat/osdetect.h @@ -16,12 +16,12 @@ */ #if defined(__sun__) || defined(__sun) /* SUN */ -#define _SQUID_SUN_ -#if defined(__SVR4) /* SOLARIS */ -#define _SQUID_SOLARIS_ -#else /* SUNOS */ -#define _SQUID_SUNOS_ -#endif +# define _SQUID_SUN_ +# if defined(__SVR4) /* SOLARIS */ +# define _SQUID_SOLARIS_ +# else /* SUNOS */ +# define _SQUID_SUNOS_ +# endif #elif defined(__hpux) /* HP-UX - SysV-like? */ #define _SQUID_HPUX_ @@ -79,11 +79,6 @@ #elif defined(__EMX__) || defined(OS2) || defined(__OS2__) #define _SQUID_OS2_ -/* - * FIXME: the os2 port of bash seems to have problems checking - * the return codes of programs in if statements. These options - * need to be overridden. - */ #endif /* OS automatic detection */ diff --git a/libsquid-compat/squid_valgrind.h b/libsquid-compat/squid_valgrind.h index 7c3bc46e9f..737ee8f128 100644 --- a/libsquid-compat/squid_valgrind.h +++ b/libsquid-compat/squid_valgrind.h @@ -15,26 +15,27 @@ * valgrind debug support */ #if WITH_VALGRIND -#include -#undef VALGRIND_MAKE_NOACCESS -#undef VALGRIND_MAKE_WRITABLE -#undef VALGRIND_MAKE_READABLE +# include /* A little glue for older valgrind version prior to 3.2.0 */ -#ifndef VALGRIND_MAKE_MEM_NOACCESS -#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS -#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE -#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE -#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE -#endif +# ifndef VALGRIND_MAKE_MEM_NOACCESS +# define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS +# define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE +# define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE +# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE +# else +# undef VALGRIND_MAKE_NOACCESS +# undef VALGRIND_MAKE_WRITABLE +# undef VALGRIND_MAKE_READABLE +# endif #else -#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0) -#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0) -#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0) -#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0) -#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0) -#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d) -#define VALGRIND_FREELIKE_BLOCK(a,b) -#define RUNNING_ON_VALGRIND 0 +# define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0) +# define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0) +# define VALGRIND_MAKE_MEM_DEFINED(a,b) (0) +# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0) +# define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0) +# define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d) +# define VALGRIND_FREELIKE_BLOCK(a,b) +# define RUNNING_ON_VALGRIND 0 #endif /* WITH_VALGRIND */ #endif /* SQUID_CONFIG_H */