mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
dist/tools/headerguards: ignore if #include_next is used
We can't use the same header guard if we include two files with the same name.
This commit is contained in:
parent
f044f3aaf6
commit
3cd06eb6d2
10
dist/tools/headerguards/headerguards.py
vendored
10
dist/tools/headerguards/headerguards.py
vendored
@ -43,6 +43,7 @@ def fix_headerguard(filename):
|
||||
tmp.seek(0)
|
||||
|
||||
guard_found = 0
|
||||
include_next_found = 0
|
||||
guard_name = ""
|
||||
ifstack = 0
|
||||
for line in inlines:
|
||||
@ -66,14 +67,17 @@ def fix_headerguard(filename):
|
||||
else:
|
||||
guard_found += 1
|
||||
line = "#endif /* %s */\n" % supposed
|
||||
elif line.startswith("#include_next"):
|
||||
include_next_found = 1
|
||||
|
||||
tmp.write(line)
|
||||
|
||||
tmp.seek(0)
|
||||
if guard_found == 3:
|
||||
for line in difflib.unified_diff(inlines, tmp.readlines(),
|
||||
"%s" % filename, "%s" % filename):
|
||||
sys.stdout.write(line)
|
||||
if include_next_found == 0:
|
||||
for line in difflib.unified_diff(inlines, tmp.readlines(),
|
||||
"%s" % filename, "%s" % filename):
|
||||
sys.stdout.write(line)
|
||||
else:
|
||||
print("%s: no / broken header guard" % filename, file=sys.stderr)
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user