summaryrefslogtreecommitdiff
path: root/hacks
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-12-05 15:35:44 +0000
committerCarl Hetherington <cth@carlh.net>2014-12-05 15:35:44 +0000
commit8596e31595c9aba128078ba4a3950543ea291f98 (patch)
treece6397e2ba0382d34883ed48e5444e6fa6a1d1bf /hacks
parentcf8e0e9e26dbaefab768000ebc1655b34ad11105 (diff)
Include rearrangement.
Diffstat (limited to 'hacks')
-rwxr-xr-xhacks/check_includes40
1 files changed, 40 insertions, 0 deletions
diff --git a/hacks/check_includes b/hacks/check_includes
new file mode 100755
index 000000000..bd0ea636f
--- /dev/null
+++ b/hacks/check_includes
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import sys
+
+for a in sys.argv[1:]:
+ includes = []
+ for line in open(a, 'r'):
+ if line.startswith('#include'):
+ includes.append(line.strip()[9:])
+
+ std = ['<cstdio>', '<unistd.h>', '<stdexcept>', '<iostream>', '<algorithm>', '<fstream>', '<cstdlib>', '<iomanip>', '<stdint.h>', '<cmath>', '<cassert>', '<cstring>', '<mntent.h>', '<windows.h>', '<shlwapi.h>', '<sys/sysctl.h>', '<mach-o/dyld.h>', '<IOKit/pwr_mgt/IOPMLib.h>', '<sys/types.h>', '<ifaddrs.h>', '<netinet/in.h>', '<arpa/inet.h>']
+
+ current_group = 0
+ for i in includes:
+ if i == '"i18n.h"':
+ continue
+
+ if i in std:
+ group = 5
+ elif i.find("<boost/") != -1:
+ group = 4
+ elif i.find("<libxml++/") != -1 or i == '<glib.h>':
+ group = 3
+ elif i.find("<libcxml/") != -1 or i.find("<dcp/") != -1:
+ group = 2
+ elif i.find("\"wx/") != -1:
+ group = 1
+ else:
+ group = 0
+
+ print '%s: %d' % (i, group)
+
+ if group < current_group:
+ print '%s: first wrong order is %s' % (a, i)
+ sys.exit(1)
+
+ current_group = group
+
+
+