diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-07 17:21:30 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-09 03:09:22 -0600 |
commit | 0041152b25953d19dd2642e379a81141183897eb (patch) | |
tree | bcbf7b49aa76a80ac05fabc1d30c566388f6cbab /build-aux | |
parent | b2e1d0b6e082d1c865f2c1f8178625861cf2f10a (diff) |
lint-bin, stack.c.gen: FIX: Don't "include" misc
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/stack.c.gen | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index b1369d1..1f87b54 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -204,7 +204,7 @@ class Application(typing.Protocol): def analyze( *, ci_fnames: typing.Collection[str], - app_func_filters: dict[str, typing.Callable[[QName], int]], + app_func_filters: dict[str, typing.Callable[[QName], tuple[int, bool]]], app: Application, cfg_max_call_depth: int, ) -> AnalyzeResult: @@ -324,10 +324,13 @@ def analyze( return None + track_inclusion: bool = True + def nstatic( orig_funcname: QName, chain: list[QName] = [], missing_ok: bool = False ) -> int: nonlocal dbg + nonlocal track_inclusion funcname = resolve_funcname(orig_funcname) if not funcname: if chain and app.skip_call(chain, QName(str(orig_funcname))): @@ -352,7 +355,8 @@ def analyze( print(f"//dbg: {'- '*len(chain)}{funcname}\t{node.nstatic}") if node.usage_kind == "dynamic" or node.ndynamic > 0: dynamic.add(funcname) - included_funcs.add(funcname) + if track_inclusion: + included_funcs.add(funcname) return node.nstatic + max( [ 0, @@ -367,7 +371,8 @@ def analyze( for grp_name, grp_filter in app_func_filters.items(): rows: dict[QName, AnalyzeResultVal] = {} for funcname in graph: - if cnt := grp_filter(funcname): + cnt, track_inclusion = grp_filter(funcname) + if cnt: rows[funcname] = AnalyzeResultVal(nstatic=nstatic(funcname), cnt=cnt) groups[grp_name] = AnalyzeResultGroup(rows=rows) @@ -1252,19 +1257,19 @@ def main( # Tie it all together ############################################ - def thread_filter(name: QName) -> int: - return sbc_is_thread(name) + def thread_filter(name: QName) -> tuple[int, bool]: + return sbc_is_thread(name), True - def intrhandler_filter(name: QName) -> int: + def intrhandler_filter(name: QName) -> tuple[int, bool]: for plugin in plugins: if plugin.is_intrhandler(name): - return 1 - return 0 + return 1, True + return 0, False - def misc_filter(name: QName) -> int: + def misc_filter(name: QName) -> tuple[int, bool]: if str(name.base()) in ["__lm_printf", "__assert_msg_fail"]: - return 1 - return 0 + return 1, False + return 0, False def location_xform(loc: str) -> str: if not loc.startswith("/"): |