]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Wrap C++ headers. Fixes define clash with libcompat
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 3 May 2009 13:02:50 +0000 (07:02 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 3 May 2009 13:02:50 +0000 (07:02 -0600)
ostream and family were including sys/types.h which causes
FD_SET rediefinition with libcompat at times.
Current autoconf allows these headers to be wrapped and config.h
included before to prevent this and other things.

34 files changed:
configure.in
include/Range.h
include/RefCount.h
lib/libTrie/test/trie.cc
src/Debug.h
src/DiskIO/AIO/async_io.h
src/Generic.h
src/Mem.h
src/SquidString.h
src/Store.h
src/StoreEntryStream.h
src/fs/ufs/store_dir_ufs.cc
src/ip/IpAddress.h
src/ip/testIpAddress.cc
src/mem.cc
src/tests/testACLMaxUserIP.cc
src/tests/testAuth.cc
src/tests/testBoilerplate.cc
src/tests/testCoss.cc
src/tests/testDiskIO.cc
src/tests/testHttpRequestMethod.cc
src/tests/testNull.cc
src/tests/testStoreEntryStream.cc
src/tests/testURL.cc
src/tests/testURLScheme.cc
src/tests/testUfs.cc
src/ufsdump.cc
test-suite/MemPoolTest.cc
test-suite/VirtualDeleteOperator.cc
test-suite/debug.cc
test-suite/mem_hdr_test.cc
test-suite/mem_node_test.cc
test-suite/syntheticoperators.cc
test-suite/test_tools.cc

index 7cf82cf15396132e4422495b273a5fcd8a539bb6..101ceb5e49a0c86f527a7a985fd384584988c97e 100644 (file)
@@ -2250,10 +2250,12 @@ AC_HEADER_DIRENT
 AC_HEADER_STDC
 
 AC_CHECK_HEADERS( \
+       aio.h \
        arpa/inet.h \
        arpa/nameser.h \
        assert.h \
        bstring.h \
+       cassert \
        crypt.h \
        ctype.h \
        errno.h \
@@ -2264,6 +2266,9 @@ AC_CHECK_HEADERS( \
        glob.h \
        gnumalloc.h \
        grp.h \
+       iosfwd \
+       iomanip \
+       iostream \
        ip_compat.h \
        ip_fil_compat.h \
        ip_fil.h \
@@ -2285,6 +2290,7 @@ AC_CHECK_HEADERS( \
        openssl/ssl.h \
        netinet/tcp.h \
        openssl/engine.h \
+       ostream \
        paths.h \
        poll.h \
        pwd.h \
@@ -2292,10 +2298,13 @@ AC_CHECK_HEADERS( \
        regex.h \
        sched.h \
        signal.h \
+       sstream \
        stdarg.h \
        stddef.h \
+       stdexcept \
        stdio.h \
        stdlib.h \
+       string \
        string.h \
        strings.h \
        sys/bitypes.h \
index e23c947d685221e6589fdd3b9298a4937a200ba4..7e89171dd21aec5e2cf2346a0f33149f6460d2ad 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
 #ifndef SQUID_RANGE_H
 #define SQUID_RANGE_H
 
+#include "config.h"
+
+#if HAVE_IOSFWD
 #include <iosfwd>
+#endif
+#if HAVE_OSTREAM
 #include <ostream>
+#endif
 
 /* represents [start, end) */
 
 template <class C>
-
 class Range
 {
 
index 3d83d1ab39580b739975717d95722b7805086660..527ae4ff6b340bbe6167c159d19d45dafff8d3f8 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
 #ifndef _SQUID_REFCOUNT_H_
 #define _SQUID_REFCOUNT_H_
 
+#include "config.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 template <class C>
-
 class RefCount
 {
 
index 8e6924b60012c9c795f4c35938c7d653a9485009..468f6a2897b46df0f8a153adfa7fc18cf5f5ede6 100644 (file)
 
 #include "Trie.h"
 #include "TrieCharTransform.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 bool
 CaseSensitiveCheck()
index a4f1fcf21e915f7020fb7ae433cdce01345852ed..6e4c13c64d4a2d83c46892f8fd1b5aff99b3ddd0 100644 (file)
 #ifndef SQUID_DEBUG_H
 #define SQUID_DEBUG_H
 
+#include "config.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
+
 #undef assert
+#if HAVE_SSTREAM
 #include <sstream>
+#endif
+#if HAVE_IOMANIP
 #include <iomanip>
-#if defined assert
+#endif
+#if defined(assert)
 #undef assert
 #endif
+
 #if PURIFY
 #define assert(EX) ((void)0)
 #elif defined(NODEBUG)
index f2c1f45cfa60ac72c85fbe0a7271bda0869678cc..7bd92fcd9ea4c7a7789cab7ac83e061b1e9e50bb 100644 (file)
@@ -1,11 +1,15 @@
 #ifndef __ASYNC_IO_H__
 #define __ASYNC_IO_H__
 
+#include "config.h"
+
 #ifdef _SQUID_WIN32_
 #include "aio_win32.h"
 #else
+#if HAVE_AIO_H
 #include <aio.h>
 #endif
+#endif
 
 /* for FREE* */
 #include "typedefs.h"
index 18d6801767f1c9a823c62e055b3cf8a533128397..69aefcb06a564fe790fe2fbc89e3084b2b099adb 100644 (file)
 #ifndef SQUID_GENERIC_H
 #define SQUID_GENERIC_H
 
-/** \todo CLEANUP: checks towrap this header properly */
-#include <ostream>
-
 #include "dlink.h"
 
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
+
 template <class _Arg, class _Result>
 struct unary_function {
     typedef _Arg argument_type;
index 89ddcb6760cfbae7214877c146b8ca89fe27377e..d1401f1ae4318b76e8aad62d7a8b35c52ef78006 100644 (file)
--- a/src/Mem.h
+++ b/src/Mem.h
 #ifndef SQUID_MEM
 #define SQUID_MEM
 
+#include "config.h"
+
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
+
 class StoreEntry;
 class MemPoolStats;
 class MemPoolMeter;
 
-/** \todo CLEANUP: protection to wrap this system include */
-#include <ostream>
-
 class Mem
 {
 
index f3aa7d4a3bacae89a15db536bac6947c23a59467..657cd7dfcc079c11911f3400d90c10edfe8059d7 100644 (file)
@@ -37,8 +37,9 @@
 
 #include "config.h"
 
-/** todo checks to wrap this include properly */
+#if HAVE_OSTREAM
 #include <ostream>
+#endif
 
 /* squid string placeholder (for printf) */
 #ifndef SQUIDSTRINGPH
index 833d4cc7f8fd3b2f88e7aaeb9fdbb62763e738ff..fde6afcb3385c02687195cc575b272b40dabb711 100644 (file)
  */
 
 #include "squid.h"
-
-/// \todo protect the 'ostream' file includes via configure file tests as per squid conventions.
-#include <ostream>
-
 #include "StoreIOBuffer.h"
 #include "Range.h"
 #include "RefCount.h"
 #include "esi/Element.h"
 #endif
 
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
+
+
 class AsyncCall;
 class StoreClient;
 class MemObject;
index db929cf736df67de43a444ff4ffe3bff6dcea359..fb9b7157599d26013c020051ed778b02a8b12d3a 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
@@ -36,7 +35,9 @@
 
 #include "Store.h"
 
+#if HAVE_OSTREAM
 #include <ostream>
+#endif
 
 /*
  * This class provides a streambuf interface for writing
index 062a81b00f6e80b4c914d5d31fc384e60c8df88f..3273547d4eed4338d160f9ba31cd150eff4fc7bf 100644 (file)
@@ -43,8 +43,8 @@
 #include "DiskIO/DiskIOModule.h"
 #include "Parsing.h"
 #include "SquidTime.h"
-
 #include "SwapDir.h"
+
 int UFSSwapDir::NumberOfUFSDirs = 0;
 int *UFSSwapDir::UFSDirToGlobalDirMapping = NULL;
 
index 94507c55811f1cb207303f445092b70c23d812c2..54b5fe040fa454614471c8f9c55a2ceab654dc8d 100644 (file)
 #include <netdb.h>
 #endif
 
+#if HAVE_IOSFWD
 #include <iosfwd>
+#endif
+#if HAVE_OSTREAM
 #include <ostream>
-
+#endif
 
 /* FreeBSD hack:
  *   This OS has at least one version that defines these as private
index 8743519541a52810443965d7b29aad08ff19fe87..67c66705488fcb4c7d661b292e26e6396f971693 100644 (file)
@@ -1,14 +1,26 @@
 #include "config.h"
+#include "testIpAddress.h"
+#include "ip/IpAddress.h"
 
-#include <stdexcept>
+#if HAVE_CSTRING
 #include <cstring>
+#endif
+#if HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#if HAVE_STRING
 #include <string>
+#endif
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
 
-#include "testIpAddress.h"
-#include "ip/IpAddress.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testIpAddress );
 
index 34c462c54780cbd867403525ab8c29c9b761ed0b..334304506b1c1c209bf4aef7c454780906714c1f 100644 (file)
  */
 
 #include "squid.h"
-
-#include <iomanip>
-#include <ostream>
-
 #include "event.h"
 #include "CacheManager.h"
 #include "ClientInfo.h"
 #include "MemBuf.h"
 #include "SquidTime.h"
 
+#if HAVE_IOMANIP
+#include <iomanip>
+#endif
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
+
 /* module globals */
 
 /* local prototypes */
index bd286da28d19419cb2938005f3d2e5d156e0a328..97a4c80729aa3d5518ed35ebbca0a4d73077441e 100644 (file)
@@ -1,11 +1,13 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-#include <stdexcept>
-
 #include "testACLMaxUserIP.h"
 #include "auth/AclMaxUserIp.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testACLMaxUserIP );
 
 
index dd20e4a71838c7b4a3b445a47e201483facd1a3f..161bd0aa9d9bcbfc54fd38e1e74f24154635ff08 100644 (file)
@@ -161,7 +161,9 @@ testAuthConfig::create()
     }
 }
 
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 /* AuthUserRequest::scheme returns the correct scheme for all
  * authentication types
index 59559fe0f5bf531e13a63bf16d0d02370afb2e05..8d7d2d39cd20d8517dba99be0ce9dcef7ab27bd7 100644 (file)
@@ -1,10 +1,12 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-#include <stdexcept>
-
 #include "testBoilerplate.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testBoilerplate );
 
 
index 925bb549976650cfdbd0702905dda20bd0ad90f9..4d3adb8e622bb05675e5e7c8ebee89c8195b0962 100644 (file)
@@ -1,6 +1,4 @@
 #include "squid.h"
-#include <stdexcept>
-
 #include "testCoss.h"
 #include "Store.h"
 #include "SwapDir.h"
 #include "StoreFileSystem.h"
 #include "testStoreSupport.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 #define TESTDIR "testCoss__testCossSearch"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testCoss );
index 4e9688f708ca8362c2d194312b27168c7affb317..4c5b4cdceab73248377e4de6dcc7f0d0126b0166 100644 (file)
@@ -1,8 +1,6 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-#include <stdexcept>
-
 #include "testDiskIO.h"
 #include "Store.h"
 #include "SwapDir.h"
 #include "StoreFileSystem.h"
 #include "testStoreSupport.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testDiskIO );
 
 void
index 6c113dabf1b27682b9980af1f223112ea310ca7e..57c4e819c8b43e6d15d1b7796d26d571a611d57a 100644 (file)
@@ -1,13 +1,15 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-#include <sstream>
 #include <cppunit/TestAssert.h>
 
 #include "Mem.h"
 #include "testHttpRequestMethod.h"
 #include "HttpRequestMethod.h"
 
+#if HAVE_SSTREAM
+#include <sstream>
+#endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testHttpRequestMethod );
 
index f2d04a3afd357af8d821268f70823659e7371e8a..b2b4694c995eaed831adb10b1b35d5a8beee4bb4 100644 (file)
@@ -1,6 +1,4 @@
 #include "squid.h"
-#include <stdexcept>
-
 #include "testNull.h"
 #include "Store.h"
 #include "SwapDir.h"
 #include "StoreFileSystem.h"
 #include "testStoreSupport.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 #define TESTDIR "testNull__testNullSearch"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testNull );
index ed07fabc433ff367be452223bb950bdc0b422805..4b0abdc4b23495b8e426ed3484c5bc3217fcaed8 100644 (file)
@@ -8,7 +8,9 @@
 #include "Store.h"
 #include "StoreEntryStream.h"
 
+#if HAVE_IOMANIP
 #include <iomanip>
+#endif
 
 #include <cppunit/TestAssert.h>
 
index eb04c532d19b24ba3eedf1202a08298666aaeb68..fbf7edcd21a42555b437f22c75b61fc16e292280 100644 (file)
@@ -1,12 +1,15 @@
 #include "config.h"
 
-#include <sstream>
 #include <cppunit/TestAssert.h>
 
 #include "testURL.h"
 #include "URL.h"
 #include "Mem.h"
 
+#if HAVE_SSTREAM
+#include <sstream>
+#endif
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testURL );
 
 /* stub functions to link successfully */
index c18bfaad5264afa9588299b99e1a84a8b8d8d3d9..eebcbcd27d6b734ee2e34367534d419c615c5fd3 100644 (file)
@@ -1,13 +1,16 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-#include <sstream>
+
 #include <cppunit/TestAssert.h>
 
 #include "Mem.h"
 #include "testURLScheme.h"
 #include "URLScheme.h"
 
+#if HAVE_SSTREAM
+#include <sstream>
+#endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testURLScheme );
 
index 58ee2e34292b9b815d13519e2346cfad62512ac2..99efc93dc1660118cb2c39302f8b2a28077dee59 100644 (file)
@@ -1,7 +1,4 @@
 #include "config.h"
-
-#include <stdexcept>
-
 #include "testUfs.h"
 #include "Store.h"
 #include "SwapDir.h"
 #include "HttpReply.h"
 #include "testStoreSupport.h"
 
+#if HAVE_STDEXCEPT
+#include <stdexcept>
+#endif
+
 #define TESTDIR "testUfs__testUfsSearch"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testUfs );
index 457dc76e6514bd92f12c675eda1d76ccfd91c97d..e65e93234d6a856e948754c43f8fb384079659d1 100644 (file)
 #include "Generic.h"
 #undef malloc
 #undef free
+
+#if HAVE_STDEXCEPT
 #include <stdexcept>
+#endif
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
+#if HAVE_CASSERT
 #include <cassert>
+#endif
 
 /* stub functions for parts of squid not factored to be dynamic yet */
 void
index 5b42a59fe94971f5d7135b8b351b000c1c0e8b5c..bafb2891de620011cd84de7589bb01ce3a09abda 100644 (file)
 
 #include "squid.h"
 #include "MemPool.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 /* TODO: put this in a libTest */
 void
index 7aa5eb2e035942adec8fb2671616b033e7c0fedb..51db1e6c0fb8d5c1a1d97df76ff7920416155bfb 100644 (file)
  */
 
 #include "squid.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 class CallCounter
 {
index 023d471510029c200b81b532cb81175dd8ff322e..02f5b08a6b1f68c9fab94c8c018cca5048472d0a 100644 (file)
@@ -37,7 +37,6 @@
 #include "squid.h"
 #include "stmem.h"
 #include "mem_node.h"
-#include <iostream>
 
 class StreamTest
 {
index b553329517495f29c899affc4489052b8aae9298..98b8a7f6f70e44f1fad9e01b4a6981d66c48fa56 100644 (file)
 #include "squid.h"
 #include "stmem.h"
 #include "mem_node.h"
-#include <iostream>
 #include "Generic.h"
 
+#if HAVE_IOSTREAM
+#include <iostream>
+#endif
+
 void
 testLowAndHigh()
 {
index 5ad25d253482334724c482b35860ead1bc675fd0..f1d3a5b31b58aa0c7e774cea3debd5eef2477b42 100644 (file)
 
 #include "squid.h"
 #include "mem_node.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 /* TODO: put this in a libTest */
 void
index 3f1baadbc72996b2dd48c83a5c42a3dcf32a3503..dbdebd4e6dd181620a7c925d203775a4161a0492 100644 (file)
 #include "squid.h"
 #include "stmem.h"
 #include "mem_node.h"
+
+#if HAVE_IOSTREAM
 #include <iostream>
+#endif
 
 class HasExplicit
 {
index 50f0e5df5d6f604c8e0364db2267678c73d07f55..4ebcf4b94d64e66de9eca86d15c4bc34f8f67ef0 100644 (file)
@@ -7,12 +7,11 @@
 
 #define _SQUID_EXTERNNEW_
 #include "squid.h"
-#include <iostream>
-#include <sstream>
 
 /* AYJ: the debug stuff here should really be in a stub_debug.cc file for tests to link */
 
 /* for correct pre-definitions of debug objects */
+/* and stream headers */
 #include "Debug.h"
 
 FILE *debug_log = NULL;