mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
added "fixed some header guards and added a script to fix them all!" by Choupom
This commit is contained in:
parent
aeec62266b
commit
e6f0318bdf
35
scripts/check_header_guards.py
Normal file
35
scripts/check_header_guards.py
Normal file
|
@ -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)
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue