1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

Merge pull request #21430 from crasbe/pr/whitespace_pragma

dist/tools: add a leading whitespace check for `#pragma once` in the `headerguards` static test
This commit is contained in:
Marian Buschsieweke 2025-04-24 07:28:31 +00:00 committed by GitHub
commit ec94a3cd72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,10 @@ def fix_headerguard(filename):
for line in inlines:
if line.startswith("#pragma once"):
pragma_once_found += 1
elif line.lstrip().startswith("#pragma once"):
# check for lines that have leading whitespaces and add a correction
pragma_once_found += 1
line = "#pragma once\n"
if guard_found == 0 and pragma_once_found == 0:
if line.startswith("#ifndef"):
guard_found += 1