CARBON_ header guards (#1261)

This modifies scripts/check_header_guards.py to add the CARBON_ prefix; everything else is pre-commit.
This commit is contained in:
Jon Meow
2022-05-12 17:25:43 -07:00
committed by GitHub
parent 3825f97e43
commit 20728dbd3a
81 changed files with 242 additions and 241 deletions
+2 -1
View File
@@ -56,7 +56,8 @@ def check_path(path: Path) -> bool:
with path.open() as f:
lines = f.readlines()
guard = str(path).upper().replace("/", "_").replace(".", "_") + "_"
guard_path = str(path).upper().replace("/", "_").replace(".", "_")
guard = f"CARBON_{guard_path}_"
ifndef = find_guard(lines, "#ifndef ([A-Z_]+_H_)", False)
define = find_guard(lines, "#define ([A-Z_]+_H_)", False)
endif = find_guard(lines, "#endif(?: // ([A-Z_]+_H_))?", True)