summaryrefslogtreecommitdiff
path: root/build-aux/stack.py
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 00:17:31 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 00:17:31 -0700
commit755db30028622de604ef98a5b28c2c4128b6f3d7 (patch)
treee56d5cad9816a61a18434bb88b8fee5a07dbc034 /build-aux/stack.py
parentdd83b1e231ea89e4ceb3302d3b68fca4761b11b8 (diff)
Oh dang, I broke `make lint` a while back :(
Diffstat (limited to 'build-aux/stack.py')
-rw-r--r--build-aux/stack.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/build-aux/stack.py b/build-aux/stack.py
index c1e36d3..752cefb 100644
--- a/build-aux/stack.py
+++ b/build-aux/stack.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python3
+# build-aux/stack.py - Analyze stack sizes for compiled objects
+#
+# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
import re
import sys
import typing
@@ -96,6 +101,7 @@ class Node:
# edges with .sourcename set to this node
calls: set[str]
+
def main() -> None:
re_label = re.compile(
r"(?P<funcname>[^\n]+)\n"
@@ -161,6 +167,7 @@ def main() -> None:
# x
missing: set[str] = set()
+
def nstatic(funcname: str) -> int:
if funcname not in graph:
missing.add(funcname)
@@ -169,16 +176,17 @@ def main() -> None:
return node.nstatic + max([0, *[nstatic(call) for call in node.calls]])
namelen = max(len(name) for name in graph if name.endswith("_cr"))
- print(("="*namelen)+" =======")
+ print(("=" * namelen) + " =======")
for funcname in graph:
if funcname.endswith("_cr"):
print(f"{funcname}\t{nstatic(funcname)}")
- print(("="*namelen)+" =======")
+ print(("=" * namelen) + " =======")
for funcname in sorted(missing):
print(f"{funcname}\tmissing")
+
if __name__ == "__main__":
main()