about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/check_header_guards.py35
-rw-r--r--src/base/detect.h4
-rw-r--r--src/base/tl/algorithm.h4
-rw-r--r--src/base/tl/allocator.h4
-rw-r--r--src/base/tl/array.h4
-rw-r--r--src/base/tl/base.h4
-rw-r--r--src/base/tl/range.h4
-rw-r--r--src/base/tl/sorted_array.h4
-rw-r--r--src/base/tl/string.h4
-rw-r--r--src/engine/shared/config.h4
-rw-r--r--src/engine/shared/config_variables.h6
11 files changed, 56 insertions, 21 deletions
diff --git a/scripts/check_header_guards.py b/scripts/check_header_guards.py
new file mode 100644
index 00000000..bece10e9
--- /dev/null
+++ b/scripts/check_header_guards.py
@@ -0,0 +1,35 @@
+import os
+
+
+PATH = "../src/"
+
+
+def check_file(filename):
+	file = open(filename)
+	while 1:
+		line = file.readline()
+		if len(line) == 0:
+			break
+		if line[0] == "/" or line[0] == "*" or line[0] == "\r" or line[0] == "\n" or line[0] == "\t":
+			continue
+		if line[:7] == "#ifndef":
+			hg = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
+			if line[:-1] != hg:
+				print "Wrong header guard in " + filename
+		else:
+			print "Missing header guard in " + filename
+		break
+	file.close()
+
+
+
+def check_dir(dir):
+	list = os.listdir(dir)
+	for file in list:
+		if os.path.isdir(dir+file):
+			if file != "external" and file != "generated":
+				check_dir(dir+file+"/")
+		elif file[-2:] == ".h" and file != "keynames.h":
+			check_file(dir+file)
+
+check_dir(PATH)
diff --git a/src/base/detect.h b/src/base/detect.h
index ca2efb9c..534339dd 100644
--- a/src/base/detect.h
+++ b/src/base/detect.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef BASELIB_FILE_CONFIG_H
-#define BASELIB_FILE_CONFIG_H
+#ifndef BASE_DETECT_H
+#define BASE_DETECT_H
 
 /*
   this file detected the family, platform and architecture
diff --git a/src/base/tl/algorithm.h b/src/base/tl/algorithm.h
index 4a165db0..c5cd74c3 100644
--- a/src/base/tl/algorithm.h
+++ b/src/base/tl/algorithm.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_ALGORITHM_HPP
-#define TL_FILE_ALGORITHM_HPP
+#ifndef BASE_TL_ALGORITHM_H
+#define BASE_TL_ALGORITHM_H
 
 #include "range.h"
 
diff --git a/src/base/tl/allocator.h b/src/base/tl/allocator.h
index f6d8fc34..d12347e3 100644
--- a/src/base/tl/allocator.h
+++ b/src/base/tl/allocator.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_ALLOCATOR_HPP
-#define TL_FILE_ALLOCATOR_HPP
+#ifndef BASE_TL_ALLOCATOR_H
+#define BASE_TL_ALLOCATOR_H
 
 template <class T>
 class allocator_default
diff --git a/src/base/tl/array.h b/src/base/tl/array.h
index 6aff3c71..0cee2afc 100644
--- a/src/base/tl/array.h
+++ b/src/base/tl/array.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_ARRAY_HPP
-#define TL_FILE_ARRAY_HPP
+#ifndef BASE_TL_ARRAY_H
+#define BASE_TL_ARRAY_H
 
 #include "range.h"
 #include "allocator.h"
diff --git a/src/base/tl/base.h b/src/base/tl/base.h
index 59951c68..2fcb14eb 100644
--- a/src/base/tl/base.h
+++ b/src/base/tl/base.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_BASE_HPP
-#define TL_FILE_BASE_HPP
+#ifndef BASE_TL_BASE_H
+#define BASE_TL_BASE_H
 
 #include <base/system.h>
 
diff --git a/src/base/tl/range.h b/src/base/tl/range.h
index 3c1c89f3..25047d31 100644
--- a/src/base/tl/range.h
+++ b/src/base/tl/range.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_RANGE_HPP
-#define TL_FILE_RANGE_HPP
+#ifndef BASE_TL_RANGE_H
+#define BASE_TL_RANGE_H
 
 #include "base.h"
 
diff --git a/src/base/tl/sorted_array.h b/src/base/tl/sorted_array.h
index 7c45cf28..94ccd543 100644
--- a/src/base/tl/sorted_array.h
+++ b/src/base/tl/sorted_array.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_SORTED_ARRAY_HPP
-#define TL_FILE_SORTED_ARRAY_HPP
+#ifndef BASE_TL_SORTED_ARRAY_H
+#define BASE_TL_SORTED_ARRAY_H
 
 #include "algorithm.h"
 #include "array.h"
diff --git a/src/base/tl/string.h b/src/base/tl/string.h
index 96c2dc66..18fab4d4 100644
--- a/src/base/tl/string.h
+++ b/src/base/tl/string.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef TL_FILE_STRING_HPP
-#define TL_FILE_STRING_HPP
+#ifndef BASE_TL_STRING_H
+#define BASE_TL_STRING_H
 
 #include "base.h"
 #include "allocator.h"
diff --git a/src/engine/shared/config.h b/src/engine/shared/config.h
index 4720ddb3..9a524d22 100644
--- a/src/engine/shared/config.h
+++ b/src/engine/shared/config.h
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef ENGINE_SHARED_E_CONFIG_H
-#define ENGINE_SHARED_E_CONFIG_H
+#ifndef ENGINE_SHARED_CONFIG_H
+#define ENGINE_SHARED_CONFIG_H
 
 struct CConfiguration
 { 
diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h
index 85749405..8dec2102 100644
--- a/src/engine/shared/config_variables.h
+++ b/src/engine/shared/config_variables.h
@@ -1,8 +1,8 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
-#ifndef ENGINE_SHARED_E_CONFIG_VARIABLES_H
-#define ENGINE_SHARED_E_CONFIG_VARIABLES_H
-#undef ENGINE_SHARED_E_CONFIG_VARIABLES_H // this file will be included several times
+#ifndef ENGINE_SHARED_CONFIG_VARIABLES_H
+#define ENGINE_SHARED_CONFIG_VARIABLES_H
+#undef ENGINE_SHARED_CONFIG_VARIABLES_H // this file will be included several times
 
 // TODO: remove this
 #include "././game/variables.h"