gh-141376: Remove exceptions from make smelly (GH-141392)
* Don't ignore initialized data and BSS * Remove exceptions for _init and _fini
This commit is contained in:
@@ -21,8 +21,6 @@ EXCEPTIONS = frozenset({
|
|||||||
})
|
})
|
||||||
|
|
||||||
IGNORED_EXTENSION = "_ctypes_test"
|
IGNORED_EXTENSION = "_ctypes_test"
|
||||||
# Ignore constructor and destructor functions
|
|
||||||
IGNORED_SYMBOLS = {'_init', '_fini'}
|
|
||||||
|
|
||||||
|
|
||||||
def is_local_symbol_type(symtype):
|
def is_local_symbol_type(symtype):
|
||||||
@@ -34,19 +32,12 @@ def is_local_symbol_type(symtype):
|
|||||||
if symtype.islower() and symtype not in "uvw":
|
if symtype.islower() and symtype not in "uvw":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Ignore the initialized data section (d and D) and the BSS data
|
|
||||||
# section. For example, ignore "__bss_start (type: B)"
|
|
||||||
# and "_edata (type: D)".
|
|
||||||
if symtype in "bBdD":
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_exported_symbols(library, dynamic=False):
|
def get_exported_symbols(library, dynamic=False):
|
||||||
print(f"Check that {library} only exports symbols starting with Py or _Py")
|
print(f"Check that {library} only exports symbols starting with Py or _Py")
|
||||||
|
|
||||||
# Only look at dynamic symbols
|
|
||||||
args = ['nm', '--no-sort']
|
args = ['nm', '--no-sort']
|
||||||
if dynamic:
|
if dynamic:
|
||||||
args.append('--dynamic')
|
args.append('--dynamic')
|
||||||
@@ -89,8 +80,6 @@ def get_smelly_symbols(stdout, dynamic=False):
|
|||||||
|
|
||||||
if is_local_symbol_type(symtype):
|
if is_local_symbol_type(symtype):
|
||||||
local_symbols.append(result)
|
local_symbols.append(result)
|
||||||
elif symbol in IGNORED_SYMBOLS:
|
|
||||||
local_symbols.append(result)
|
|
||||||
else:
|
else:
|
||||||
smelly_symbols.append(result)
|
smelly_symbols.append(result)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user