diff --git a/dist/tools/headerguards/headerguards.py b/dist/tools/headerguards/headerguards.py index e650b6c2d4a5..8f5a220e6d16 100755 --- a/dist/tools/headerguards/headerguards.py +++ b/dist/tools/headerguards/headerguards.py @@ -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