------------------------------------------------------------ revno: 12297 revision-id: kinkie@squid-cache.org-20120824095700-ifbshhz725hev1py parent: squid3@treenet.co.nz-20120823013316-auo4k66d7kc8nrtt committer: Francesco Chemolli branch nick: trunk timestamp: Fri 2012-08-24 11:57:00 +0200 message: Prep work for automatic sorting of include directives. Automatic sorting of include files reveals some indirect inclusions, which would break the build. scripts/sort-includes.pl is the tool to do the automatic header include order sorting. The other changes in this set fix the issues which that be introduced by running the sorting. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: kinkie@squid-cache.org-20120824095700-ifbshhz725hev1py # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: e3345bf320a6f14d4f127e705c1d1317bd7c33f6 # timestamp: 2012-08-24 10:52:20 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20120823013316-\ # auo4k66d7kc8nrtt # # Begin patch === modified file 'include/snmp_msg.h' --- include/snmp_msg.h 2010-11-21 04:40:05 +0000 +++ include/snmp_msg.h 2012-08-24 09:57:00 +0000 @@ -30,6 +30,8 @@ * **********************************************************************/ +#include "snmp_pdu.h" + #define SNMP_VERSION_1 0 /* RFC 1157 */ #define SNMP_VERSION_2 1 /* RFC 1901 */ === added file 'scripts/sort-includes.pl' --- scripts/sort-includes.pl 1970-01-01 00:00:00 +0000 +++ scripts/sort-includes.pl 2012-08-24 09:57:00 +0000 @@ -0,0 +1,44 @@ +#!/usr/bin/perl +# +# AUTHOR: Francesco Chemolli +# +# Part of the Squid Web Cache project, licensed for use and distribution +# under the terms of the Squid Web Cache; please refer to the files COPYING +# and COPYRIGHT. +# +# +# USAGE: sort-includes.pl filename.cc >filename.cc.sorted +# +# This tool helps to sort the #include directives in a c or c++ source file +# according to the Squid Coding guidelines. +# +# The output of the tool is a source file where each block of consecutive +# include directives for project-specific files (#include "header.h") +# is sorted with this specification: squid.h (if present) is alwasy first, +# then the other directives are sorted in case-insensitive alphabetical order. +# +# Suggested usage: +# for file in $(find . -name \*.cc); do /full/path/to/sort-includes.pl $file >$file.sorted; mv $file.sorted $file; done + +use strict; +use warnings; +my @acc=(); #if empty, we're not accumulating +while (<>) { + if (m!^#include "!) { + if (m!squid.h!) { + print; + } else { + push @acc,$_; + } + } else { + &dump_acc; + print; + } +} +&dump_acc; + +sub dump_acc { + return unless @acc; + print sort {lc($a) cmp lc($b)} @acc; + @acc=(); +} === modified file 'snmplib/parse.c' --- snmplib/parse.c 2012-01-20 18:55:04 +0000 +++ snmplib/parse.c 2012-08-24 09:57:00 +0000 @@ -24,6 +24,13 @@ * parse.c */ #include "squid.h" +#include "asn1.h" +#include "cache_snmp.h" +#include "parse.h" +#include "snmp_debug.h" +#include "snmp_pdu.h" +#include "snmp_vars.h" +#include "util.h" #include @@ -78,14 +85,7 @@ #include #endif -#include "asn1.h" -#include "snmp_vars.h" -#include "parse.h" -#include "snmp_debug.h" - -#include "util.h" - -#include "cache_snmp.h" + /* * This is one element of an object identifier with either an integer subidentifier, * or a textual string label, or both. === modified file 'src/DescriptorSet.h' --- src/DescriptorSet.h 2012-08-14 11:53:07 +0000 +++ src/DescriptorSet.h 2012-08-24 09:57:00 +0000 @@ -1,6 +1,7 @@ #ifndef SQUID_DESCRIPTOR_SET_H #define SQUID_DESCRIPTOR_SET_H +#include /** \ingroup Comm === modified file 'src/DiskIO/DiskDaemon/DiskdFile.cc' --- src/DiskIO/DiskDaemon/DiskdFile.cc 2012-08-14 11:53:07 +0000 +++ src/DiskIO/DiskDaemon/DiskdFile.cc 2012-08-24 09:57:00 +0000 @@ -34,20 +34,19 @@ */ #include "squid.h" - -#include -#include -#include - #include "DiskdFile.h" #include "ConfigOption.h" #include "diomsg.h" - #include "DiskdIOStrategy.h" #include "DiskIO/IORequestor.h" #include "DiskIO/ReadRequest.h" #include "DiskIO/WriteRequest.h" #include "StatCounters.h" + +#include +#include +#include + CBDATA_CLASS_INIT(DiskdFile); void * === modified file 'src/LeakFinder.cc' --- src/LeakFinder.cc 2012-08-14 11:53:07 +0000 +++ src/LeakFinder.cc 2012-08-24 09:57:00 +0000 @@ -37,11 +37,13 @@ */ #include "squid.h" + +#if USE_LEAKFINDER + #include "LeakFinder.h" #include "Store.h" #include "SquidTime.h" -#if USE_LEAKFINDER /* ========================================================================= */ LeakFinderPtr::LeakFinderPtr(void *p , const char *f, const int l) : === modified file 'src/acl/HttpStatus.cc' --- src/acl/HttpStatus.cc 2012-08-14 11:53:07 +0000 +++ src/acl/HttpStatus.cc 2012-08-24 09:57:00 +0000 @@ -35,7 +35,6 @@ */ #include "squid.h" - #include "acl/HttpStatus.h" #include "acl/FilledChecklist.h" #include "Debug.h" === modified file 'src/adaptation/AccessRule.cc' --- src/adaptation/AccessRule.cc 2012-08-14 11:53:07 +0000 +++ src/adaptation/AccessRule.cc 2012-08-24 09:57:00 +0000 @@ -1,6 +1,5 @@ #include "squid.h" #include "structs.h" - #include "ConfigParser.h" #include "acl/Gadgets.h" #include "adaptation/AccessRule.h" === modified file 'src/adaptation/ecap/Config.cc' --- src/adaptation/ecap/Config.cc 2012-08-14 11:53:07 +0000 +++ src/adaptation/ecap/Config.cc 2012-08-24 09:57:00 +0000 @@ -3,7 +3,6 @@ * DEBUG: section 93 eCAP Interface */ #include "squid.h" - #include "adaptation/ecap/Host.h" #include "adaptation/ecap/ServiceRep.h" #include "adaptation/ecap/Config.h" === modified file 'src/adaptation/icap/Config.cc' --- src/adaptation/icap/Config.cc 2012-08-14 11:53:07 +0000 +++ src/adaptation/icap/Config.cc 2012-08-24 09:57:00 +0000 @@ -33,7 +33,6 @@ */ #include "squid.h" - #include "ConfigParser.h" #include "Store.h" #include "Array.h" === modified file 'src/client_side_request.cci' --- src/client_side_request.cci 2011-03-12 01:16:37 +0000 +++ src/client_side_request.cci 2012-08-24 09:57:00 +0000 @@ -34,6 +34,8 @@ * Copyright (c) 2003, Robert Collins */ +#include "Store.h" + StoreEntry * ClientHttpRequest::storeEntry() const { === modified file 'src/comm/IoCallback.h' --- src/comm/IoCallback.h 2011-01-31 11:50:28 +0000 +++ src/comm/IoCallback.h 2012-08-24 09:57:00 +0000 @@ -2,8 +2,9 @@ #define _SQUID_COMM_IOCALLBACK_H #include "base/AsyncCall.h" +#include "comm/forward.h" #include "comm_err_t.h" -#include "comm/forward.h" +#include "typedefs.h" namespace Comm { === modified file 'src/esi/Module.cc' --- src/esi/Module.cc 2012-08-14 11:53:07 +0000 +++ src/esi/Module.cc 2012-08-24 09:57:00 +0000 @@ -2,7 +2,9 @@ #include "esi/Module.h" #include "esi/CustomParser.h" #include "esi/Libxml2Parser.h" -#include "esi/ExpatParser.h" /* must follow esi/Libxml2Parser.h */ +/* include for esi/ExpatParser.h must follow esi/Libxml2Parser.h */ +/* do not remove this comment, as it acts as barrier for the autmatic sorting */ +#include "esi/ExpatParser.h" static ESIParser::Register *prCustom = 0; #if HAVE_LIBXML2 === modified file 'src/fs/diskd/StoreFSdiskd.cc' --- src/fs/diskd/StoreFSdiskd.cc 2012-08-10 06:56:49 +0000 +++ src/fs/diskd/StoreFSdiskd.cc 2012-08-24 09:57:00 +0000 @@ -36,11 +36,6 @@ /* TODO: remove this file as unused */ #include "squid.h" -#if 0 -#include "StoreFileSystem.h" -#include "DiskIO/DiskIOModule.h" -#endif - #include "fs/ufs/StoreFSufs.h" #include "fs/ufs/UFSSwapDir.h" === modified file 'src/ipc/ReadWriteLock.cc' --- src/ipc/ReadWriteLock.cc 2012-08-14 11:53:07 +0000 +++ src/ipc/ReadWriteLock.cc 2012-08-24 09:57:00 +0000 @@ -5,7 +5,6 @@ */ #include "squid.h" - #include "Store.h" #include "ipc/ReadWriteLock.h" === modified file 'src/ipc/SharedListen.cc' --- src/ipc/SharedListen.cc 2012-08-14 11:53:07 +0000 +++ src/ipc/SharedListen.cc 2012-08-24 09:57:00 +0000 @@ -6,7 +6,6 @@ */ #include "squid.h" -#include #include "comm.h" #include "base/TextException.h" #include "comm/Connection.h" @@ -19,6 +18,8 @@ #include "ipc/SharedListen.h" #include "protos.h" +#include + /// holds information necessary to handle JoinListen response class PendingOpenRequest { === modified file 'src/ipc/StoreMap.cc' --- src/ipc/StoreMap.cc 2012-08-14 11:53:07 +0000 +++ src/ipc/StoreMap.cc 2012-08-24 09:57:00 +0000 @@ -5,7 +5,6 @@ */ #include "squid.h" - #include "protos.h" #include "Store.h" #include "ipc/StoreMap.h" === modified file 'src/ipc/TypedMsgHdr.cc' --- src/ipc/TypedMsgHdr.cc 2012-01-20 18:55:04 +0000 +++ src/ipc/TypedMsgHdr.cc 2012-08-24 09:57:00 +0000 @@ -7,11 +7,12 @@ #include "squid.h" -#include #include "protos.h" #include "base/TextException.h" #include "ipc/TypedMsgHdr.h" +#include + Ipc::TypedMsgHdr::TypedMsgHdr() { xmemset(this, 0, sizeof(*this)); === modified file 'src/log/access_log.cc' --- src/log/access_log.cc 2012-08-14 11:53:07 +0000 +++ src/log/access_log.cc 2012-08-24 09:57:00 +0000 @@ -35,18 +35,11 @@ #include "squid.h" #include "AccessLogEntry.h" - -// Store.h Required by configuration directives parsing/dumping only #include "Store.h" - #include "errorpage.h" #include "err_detail_type.h" #include "acl/Checklist.h" #include "errorpage.h" -#if USE_SQUID_EUI -#include "eui/Eui48.h" -#include "eui/Eui64.h" -#endif #include "format/Token.h" #include "globals.h" #include "hier_code.h" @@ -60,6 +53,11 @@ #include "rfc1738.h" #include "SquidTime.h" +#if USE_SQUID_EUI +#include "eui/Eui48.h" +#include "eui/Eui64.h" +#endif + #if HEADERS_LOG static Logfile *headerslog = NULL; #endif === modified file 'src/ssl/ErrorDetailManager.h' --- src/ssl/ErrorDetailManager.h 2011-06-18 00:12:51 +0000 +++ src/ssl/ErrorDetailManager.h 2012-08-24 09:57:00 +0000 @@ -1,8 +1,11 @@ #ifndef _SQUID_SSL_ERRORDETAILMANAGER_H #define _SQUID_SSL_ERRORDETAILMANAGER_H +#include "ssl/gadgets.h" #include "ssl/support.h" -#include "ssl/gadgets.h" +#include "RefCount.h" +#include "SquidString.h" + #if HAVE_MAP #include #endif @@ -10,6 +13,8 @@ #include #endif +class HttpRequest; + namespace Ssl { === modified file 'src/tests/testCacheManager.cc' --- src/tests/testCacheManager.cc 2012-08-14 11:53:07 +0000 +++ src/tests/testCacheManager.cc 2012-08-24 09:57:00 +0000 @@ -1,14 +1,13 @@ #define SQUID_UNIT_TEST 1 #include "squid.h" -#include #include "mgr/Action.h" - #include "Mem.h" #include "testCacheManager.h" #include "CacheManager.h" #include "Store.h" +#include CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager ); === modified file 'src/tests/testConfigParser.cc' --- src/tests/testConfigParser.cc 2012-01-20 18:55:04 +0000 +++ src/tests/testConfigParser.cc 2012-08-24 09:57:00 +0000 @@ -1,6 +1,5 @@ #define SQUID_UNIT_TEST 1 #include "squid.h" - #include "testConfigParser.h" #include "SquidString.h" #include "Mem.h" === modified file 'src/tests/testDiskIO.cc' --- src/tests/testDiskIO.cc 2012-08-14 11:53:07 +0000 +++ src/tests/testDiskIO.cc 2012-08-24 09:57:00 +0000 @@ -5,9 +5,6 @@ #include "Store.h" #include "SwapDir.h" #include "DiskIO/DiskIOModule.h" -#if 0 // AYJ: COSS in Squid-3 is disabled. -#include "fs/coss/CossSwapDir.h" -#endif #include "Mem.h" #include "MemObject.h" #include "HttpHeader.h" @@ -15,6 +12,11 @@ #include "StoreFileSystem.h" #include "testStoreSupport.h" +#if 0 +// AYJ: COSS in Squid-3 is disabled. +#include "fs/coss/CossSwapDir.h" +#endif + #if HAVE_STDEXCEPT #include #endif === modified file 'src/tests/testStoreController.cc' --- src/tests/testStoreController.cc 2012-08-14 11:53:07 +0000 +++ src/tests/testStoreController.cc 2012-08-24 09:57:00 +0000 @@ -1,7 +1,6 @@ #define SQUID_UNIT_TEST 1 #include "squid.h" - #include "testStoreController.h" #include "Store.h" #include "SwapDir.h" === modified file 'src/tests/testStoreHashIndex.cc' --- src/tests/testStoreHashIndex.cc 2012-08-14 11:53:07 +0000 +++ src/tests/testStoreHashIndex.cc 2012-08-24 09:57:00 +0000 @@ -1,7 +1,6 @@ #define SQUID_UNIT_TEST 1 #include "squid.h" - #include "testStoreHashIndex.h" #include "Store.h" #include "SwapDir.h" === modified file 'src/tests/testString.cc' --- src/tests/testString.cc 2012-01-20 18:55:04 +0000 +++ src/tests/testString.cc 2012-08-24 09:57:00 +0000 @@ -1,6 +1,6 @@ #define SQUID_UNIT_TEST 1 + #include "squid.h" - #include "testString.h" #include "SquidString.h" #include "Mem.h"