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.
*
**********************************************************************/
+#include "snmp_pdu.h"
+
#define SNMP_VERSION_1 0 /* RFC 1157 */
#define SNMP_VERSION_2 1 /* RFC 1901 */
--- /dev/null
+#!/usr/bin/perl
+#
+# AUTHOR: Francesco Chemolli <kinkie@squid-cache.org>
+#
+# 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=();
+}
* 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 <stdio.h>
#include <errno.h>
#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.
#ifndef SQUID_DESCRIPTOR_SET_H
#define SQUID_DESCRIPTOR_SET_H
+#include <iosfwd>
/** \ingroup Comm
*/
#include "squid.h"
-
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <sys/shm.h>
-
#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 <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/shm.h>
+
CBDATA_CLASS_INIT(DiskdFile);
void *
*/
#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) :
*/
#include "squid.h"
-
#include "acl/HttpStatus.h"
#include "acl/FilledChecklist.h"
#include "Debug.h"
#include "squid.h"
#include "structs.h"
-
#include "ConfigParser.h"
#include "acl/Gadgets.h"
#include "adaptation/AccessRule.h"
* DEBUG: section 93 eCAP Interface
*/
#include "squid.h"
-
#include "adaptation/ecap/Host.h"
#include "adaptation/ecap/ServiceRep.h"
#include "adaptation/ecap/Config.h"
*/
#include "squid.h"
-
#include "ConfigParser.h"
#include "Store.h"
#include "Array.h"
* Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
*/
+#include "Store.h"
+
StoreEntry *
ClientHttpRequest::storeEntry() const
{
#define _SQUID_COMM_IOCALLBACK_H
#include "base/AsyncCall.h"
-#include "comm_err_t.h"
#include "comm/forward.h"
+#include "comm_err_t.h"
+#include "typedefs.h"
namespace Comm
{
#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
/* 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"
*/
#include "squid.h"
-
#include "Store.h"
#include "ipc/ReadWriteLock.h"
*/
#include "squid.h"
-#include <map>
#include "comm.h"
#include "base/TextException.h"
#include "comm/Connection.h"
#include "ipc/SharedListen.h"
#include "protos.h"
+#include <map>
+
/// holds information necessary to handle JoinListen response
class PendingOpenRequest
{
*/
#include "squid.h"
-
#include "protos.h"
#include "Store.h"
#include "ipc/StoreMap.h"
#include "squid.h"
-#include <string.h>
#include "protos.h"
#include "base/TextException.h"
#include "ipc/TypedMsgHdr.h"
+#include <string.h>
+
Ipc::TypedMsgHdr::TypedMsgHdr()
{
xmemset(this, 0, sizeof(*this));
#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"
#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
#ifndef _SQUID_SSL_ERRORDETAILMANAGER_H
#define _SQUID_SSL_ERRORDETAILMANAGER_H
-#include "ssl/support.h"
#include "ssl/gadgets.h"
+#include "ssl/support.h"
+#include "RefCount.h"
+#include "SquidString.h"
+
#if HAVE_MAP
#include <map>
#endif
#include <string>
#endif
+class HttpRequest;
+
namespace Ssl
{
#define SQUID_UNIT_TEST 1
#include "squid.h"
-#include <cppunit/TestAssert.h>
#include "mgr/Action.h"
-
#include "Mem.h"
#include "testCacheManager.h"
#include "CacheManager.h"
#include "Store.h"
+#include <cppunit/TestAssert.h>
CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager );
#define SQUID_UNIT_TEST 1
#include "squid.h"
-
#include "testConfigParser.h"
#include "SquidString.h"
#include "Mem.h"
#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"
#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 <stdexcept>
#endif
#define SQUID_UNIT_TEST 1
#include "squid.h"
-
#include "testStoreController.h"
#include "Store.h"
#include "SwapDir.h"
#define SQUID_UNIT_TEST 1
#include "squid.h"
-
#include "testStoreHashIndex.h"
#include "Store.h"
#include "SwapDir.h"
#define SQUID_UNIT_TEST 1
-#include "squid.h"
+#include "squid.h"
#include "testString.h"
#include "SquidString.h"
#include "Mem.h"