]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prep work for automatic sorting of include directives.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 24 Aug 2012 09:57:00 +0000 (11:57 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 24 Aug 2012 09:57:00 +0000 (11:57 +0200)
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.

26 files changed:
include/snmp_msg.h
scripts/sort-includes.pl [new file with mode: 0644]
snmplib/parse.c
src/DescriptorSet.h
src/DiskIO/DiskDaemon/DiskdFile.cc
src/LeakFinder.cc
src/acl/HttpStatus.cc
src/adaptation/AccessRule.cc
src/adaptation/ecap/Config.cc
src/adaptation/icap/Config.cc
src/client_side_request.cci
src/comm/IoCallback.h
src/esi/Module.cc
src/fs/diskd/StoreFSdiskd.cc
src/ipc/ReadWriteLock.cc
src/ipc/SharedListen.cc
src/ipc/StoreMap.cc
src/ipc/TypedMsgHdr.cc
src/log/access_log.cc
src/ssl/ErrorDetailManager.h
src/tests/testCacheManager.cc
src/tests/testConfigParser.cc
src/tests/testDiskIO.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc
src/tests/testString.cc

index 414d18f5227b37207d701e4bc3faf7a56bf01f58..b4fbe23ba587b5b4d84dd7cff676d50414017ba6 100644 (file)
@@ -30,6 +30,8 @@
  *
  **********************************************************************/
 
+#include "snmp_pdu.h"
+
 #define SNMP_VERSION_1     0   /* RFC 1157 */
 #define SNMP_VERSION_2     1   /* RFC 1901 */
 
diff --git a/scripts/sort-includes.pl b/scripts/sort-includes.pl
new file mode 100644 (file)
index 0000000..35c0d98
--- /dev/null
@@ -0,0 +1,44 @@
+#!/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=();
+}
index a9316d1490ead3135b5256f80e8a693c7f09cf01..b1792ff163f084fe22fb4fc4a9d38048e0553ab3 100644 (file)
@@ -24,6 +24,13 @@ SOFTWARE.
  * 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>
 
@@ -78,14 +85,7 @@ SOFTWARE.
 #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.
index 302529b3f9d5834317348156e9b3b41a012d43c3..c1e710d94530332744d29ada7fafc366f41e83d7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef SQUID_DESCRIPTOR_SET_H
 #define SQUID_DESCRIPTOR_SET_H
 
+#include <iosfwd>
 
 /** \ingroup Comm
 
index 22bccd176fe98ed50d1657e53d0f73ab3b95ee6f..be11f34f2f0e0da23fdbe3342af120d934fbf401 100644 (file)
  */
 
 #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 *
index b889e88d1e0f0269c909db3a377715cb3c22b716..e245430bf36b69e3ced71a08a65e11df6990558a 100644 (file)
  */
 
 #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) :
index 05fc730fc70c869420c560ed792cb4b640ce8058..03cb5d76b800e11fb7e5479fdd363b1452b42a67 100644 (file)
@@ -35,7 +35,6 @@
  */
 
 #include "squid.h"
-
 #include "acl/HttpStatus.h"
 #include "acl/FilledChecklist.h"
 #include "Debug.h"
index 5dc18611445e6c74d0d2ca1c0b33f47eb49b824b..8c9b53e8168833369b3d1fcc8d1f40fe8a7e965f 100644 (file)
@@ -1,6 +1,5 @@
 #include "squid.h"
 #include "structs.h"
-
 #include "ConfigParser.h"
 #include "acl/Gadgets.h"
 #include "adaptation/AccessRule.h"
index e6cd269caeda422925846f25dd4d8c1d25c09bce..d8b6bf77c709a8c69e24acd796bf6f3a145897f6 100644 (file)
@@ -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"
index 8555301653bb0afd4550033e63fc99aadfd2cb05..6bed0457435cc336b4f19af5dcb43b06b41cc3d9 100644 (file)
@@ -33,7 +33,6 @@
  */
 
 #include "squid.h"
-
 #include "ConfigParser.h"
 #include "Store.h"
 #include "Array.h"
index ddbbc078ff666b926f8e4dface42aa997321d552..5e0a69f4c0796a08e466de35fbb3657dbec1bbb4 100644 (file)
@@ -34,6 +34,8 @@
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
+#include "Store.h"
+
 StoreEntry *
 ClientHttpRequest::storeEntry() const
 {
index ab210661543ab74ab11a32775fd49d93b7ea5a43..116d3497cd7a3519f43bf58fa859403eb92d3e12 100644 (file)
@@ -2,8 +2,9 @@
 #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
 {
index 71b9be035eaa2bf8b6b2c313f6d6bb83bbb6dcc7..b8269342a37db439fb4ac4d52dfc9cd80f6bc317 100644 (file)
@@ -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
index 01d20c87c8cc3c12191ce279046ada1886f2f930..16ce6df6dee43e70491f10befce849a0ed22243f 100644 (file)
 /* 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"
 
index f319264f88af4303724ec03ab3bedbf75b7b858f..981a85447dadd00a1a2c4986752b555ed04a8154 100644 (file)
@@ -5,7 +5,6 @@
  */
 
 #include "squid.h"
-
 #include "Store.h"
 #include "ipc/ReadWriteLock.h"
 
index eaedc02dc0c2d38b1bf88a232514b766d066f878..a90e02f14357068e2dad4decdd933e8624f853a6 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "squid.h"
-#include <map>
 #include "comm.h"
 #include "base/TextException.h"
 #include "comm/Connection.h"
@@ -19,6 +18,8 @@
 #include "ipc/SharedListen.h"
 #include "protos.h"
 
+#include <map>
+
 /// holds information necessary to handle JoinListen response
 class PendingOpenRequest
 {
index 22185ed0f9cea200b1bc41c2fb4c8f04e89987a8..a0b999af49b94058d0e8a14d73d4b7b20396ef25 100644 (file)
@@ -5,7 +5,6 @@
  */
 
 #include "squid.h"
-
 #include "protos.h"
 #include "Store.h"
 #include "ipc/StoreMap.h"
index bb653742cd48326746b1adf03d3cb02b3b5c9ec8..74e71817680aa76905723c42848b90d86166f9e7 100644 (file)
@@ -7,11 +7,12 @@
 
 
 #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));
index b30d9eefd4cc02710a696deba80af6a04ee2f119..997dc477d1e9678c5308405a0868d81e507ab181 100644 (file)
 
 #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
index 1a0be5926198d53bf8edbd682f60a63a88a90ec5..334c80f46cf9740a1822d68cc288c082848e2ee9 100644 (file)
@@ -1,8 +1,11 @@
 #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
@@ -10,6 +13,8 @@
 #include <string>
 #endif
 
+class HttpRequest;
+
 namespace Ssl
 {
 
index 702a88fb693b2334352f31d9fd8e5a26281624ca..308ba3543194e07ff1975295b12ae056e3e4e618 100644 (file)
@@ -1,14 +1,13 @@
 #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 );
 
index b17fd7a4d8927402ac1b3453c7af054c368ec115..a3a58fe251516a07a4e5f164252bab240980a4a9 100644 (file)
@@ -1,6 +1,5 @@
 #define SQUID_UNIT_TEST 1
 #include "squid.h"
-
 #include "testConfigParser.h"
 #include "SquidString.h"
 #include "Mem.h"
index b06b5a1aa8d2e7a789cf728ba8993616d0e4e560..32ed5cdccf4abbe44f20db6a3b2df4d402e12ddf 100644 (file)
@@ -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"
 #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
index d1e7bd411e62ef3ac62bf999d7292912489cf16d..5ee8b6d54d733dae0e4c1091b63e1a129f97857e 100644 (file)
@@ -1,7 +1,6 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-
 #include "testStoreController.h"
 #include "Store.h"
 #include "SwapDir.h"
index 3a2169ff4faba945cc44bb1a484157a557bd2a74..a6ed69f848399e3e20b6377c4db6a6f1a937afce 100644 (file)
@@ -1,7 +1,6 @@
 #define SQUID_UNIT_TEST 1
 
 #include "squid.h"
-
 #include "testStoreHashIndex.h"
 #include "Store.h"
 #include "SwapDir.h"
index 32d3e9a6c61f906315baa4de1018fb8c23976858..0ca8cb01b475e4cf684a84dce58441a582c3a2a6 100644 (file)
@@ -1,6 +1,6 @@
 #define SQUID_UNIT_TEST 1
-#include "squid.h"
 
+#include "squid.h"
 #include "testString.h"
 #include "SquidString.h"
 #include "Mem.h"