From b4a081932338f65aa87aeba5008463feb0a78519 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 12 May 2025 14:17:05 -0600 Subject: More GCC 15 fixes --- build-aux/measurestack/analyze.py | 56 +++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) (limited to 'build-aux/measurestack/analyze.py') diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py index 67c44ce..97f1769 100644 --- a/build-aux/measurestack/analyze.py +++ b/build-aux/measurestack/analyze.py @@ -276,7 +276,7 @@ class Application(typing.Protocol): # code ######################################################################### -re_node_label = re.compile( +re_node_normal_label = re.compile( r"(?P[^\n]+)\n" + r"(?P[^\n]+:[0-9]+:[0-9]+)\n" + r"(?P[0-9]+) bytes \((?Pstatic|dynamic|dynamic,bounded)\)\n" @@ -284,6 +284,10 @@ re_node_label = re.compile( + r"(?:\n.*)*", flags=re.MULTILINE, ) +re_node_alias_label = re.compile( + r"(?P[^\n]+)\n" + r"(?P[^\n]+:[0-9]+:[0-9]+)", + flags=re.MULTILINE, +) class _Graph: @@ -376,20 +380,44 @@ def _make_graph( case "title": node.funcname = QName(v) case "label": - if elem.attrs.get("shape", "") != "ellipse": - m = re_node_label.fullmatch(v) - if not m: - raise ValueError(f"unexpected label value {v!r}") - node.location = m.group("location") - node.usage_kind = typing.cast( - UsageKind, m.group("usage_kind") - ) - node.nstatic = int(m.group("nstatic")) - node.ndynamic = int(m.group("ndynamic")) + shape: str | None = elem.attrs.get("shape", None) + match shape: + case "ellipse": # external + pass + case "triangle": # alias (since GCC 15) + m = re_node_alias_label.fullmatch(v) + if not m: + raise ValueError( + f"unexpected label value {v!r}" + ) + node.location = m.group("location") + node.usage_kind = "static" + node.nstatic = 0 + node.ndynamic = 0 + case None: # normal + m = re_node_normal_label.fullmatch(v) + if not m: + raise ValueError( + f"unexpected label value {v!r}" + ) + node.location = m.group("location") + node.usage_kind = typing.cast( + UsageKind, m.group("usage_kind") + ) + node.nstatic = int(m.group("nstatic")) + node.ndynamic = int(m.group("ndynamic")) + case _: + raise ValueError( + f"unexpected shape value {shape!r}" + ) case "shape": - if v != "ellipse": - raise ValueError(f"unexpected shape value {v!r}") - skip = True + match v: + case "ellipse": # external + skip = True + case "triangle": # alias (since GCC 15) + pass + case _: + raise ValueError(f"unexpected shape value {v!r}") case _: raise ValueError(f"unknown edge key {k!r}") if not skip: -- cgit v1.2.3-2-g168b