chore: drop a few more dead LinuxGame.h includes

This commit is contained in:
MatthewBeshay
2026-04-08 21:41:09 +10:00
parent 61a0d9690b
commit 33fe5fec3a
4 changed files with 9 additions and 4 deletions

View File

@@ -48,10 +48,18 @@ USAGE_PATTERNS = [
]
def strip_comments(text: str) -> str:
text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL)
text = re.sub(r'//[^\n]*', '', text)
return text
def file_needs_linuxgame(text: str) -> bool:
# Strip the LinuxGame.h include line itself before checking, to avoid
# the include path matching `LinuxGame`.
# the include path matching `LinuxGame`. Also strip comments so
# references in commented-out code don't keep the include alive.
scan = INCLUDE_RE.sub("", text)
scan = strip_comments(scan)
for pat in USAGE_PATTERNS:
if pat.search(scan):
return True