mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-106560: Fix redundant declarations in Python/frozen.c (#112612)
Avoid duplicated declarations of "extern" functions in Python/frozen.c. Compiler warnings seen by building Python with gcc -Wredundant-decls.
This commit is contained in:
parent
1f2a676785
commit
d9e444dbb8
2 changed files with 12 additions and 7 deletions
|
@ -468,6 +468,17 @@ def replace_block(lines, start_marker, end_marker, replacements, file):
|
|||
return lines[:start_pos + 1] + replacements + lines[end_pos:]
|
||||
|
||||
|
||||
class UniqueList(list):
|
||||
def __init__(self):
|
||||
self._seen = set()
|
||||
|
||||
def append(self, item):
|
||||
if item in self._seen:
|
||||
return
|
||||
super().append(item)
|
||||
self._seen.add(item)
|
||||
|
||||
|
||||
def regen_frozen(modules):
|
||||
headerlines = []
|
||||
parentdir = os.path.dirname(FROZEN_FILE)
|
||||
|
@ -477,7 +488,7 @@ def regen_frozen(modules):
|
|||
header = relpath_for_posix_display(src.frozenfile, parentdir)
|
||||
headerlines.append(f'#include "{header}"')
|
||||
|
||||
externlines = []
|
||||
externlines = UniqueList()
|
||||
bootstraplines = []
|
||||
stdliblines = []
|
||||
testlines = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue