Merge "Stop the kernel header scrubber from duplicating includes." into main
This commit is contained in:
commit
4195a49880
1 changed files with 3 additions and 3 deletions
|
@ -1202,7 +1202,7 @@ class BlockList(object):
|
|||
|
||||
def removeStructs(self, structs):
|
||||
"""Remove structs."""
|
||||
extra_includes = []
|
||||
extra_includes = set()
|
||||
block_num = 0
|
||||
num_blocks = len(self.blocks)
|
||||
while block_num < num_blocks:
|
||||
|
@ -1248,7 +1248,7 @@ class BlockList(object):
|
|||
# #include <bits/STRUCT_NAME.h>
|
||||
struct_token = b.tokens[i + 1]
|
||||
if not structs[struct_token.id]:
|
||||
extra_includes.append("<bits/%s.h>" % struct_token.id)
|
||||
extra_includes.add("<bits/%s.h>" % struct_token.id)
|
||||
|
||||
# Search forward for the end of the structure.
|
||||
# Very simple search, look for } and ; tokens.
|
||||
|
@ -1292,7 +1292,7 @@ class BlockList(object):
|
|||
continue
|
||||
i += 1
|
||||
|
||||
for extra_include in extra_includes:
|
||||
for extra_include in sorted(extra_includes):
|
||||
replacement = CppStringTokenizer(extra_include)
|
||||
self.blocks.insert(2, Block(replacement.tokens, directive='include'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue