diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-09 03:43:22 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:53 -0600 |
commit | 4342605da113113e9f4c80f1237a6e7b4459e180 (patch) | |
tree | 46583227c1935dd166bdade9d5a98027279497b1 | |
parent | 4180233a07ab0f0b71278aa27c3e2cec7c00ac2f (diff) |
pico-fmt: Pull in enhancements
m--------- | 3rd-party/pico-fmt | 0 | ||||
-rw-r--r-- | build-aux/measurestack/app_plugins.py | 57 |
2 files changed, 19 insertions, 38 deletions
diff --git a/3rd-party/pico-fmt b/3rd-party/pico-fmt -Subproject 5b2ef3a020a3747310cdb7573a84463a05e567b +Subproject beaecdcba7fdf0d584d245a9d0ad6be6bdc94a1 diff --git a/build-aux/measurestack/app_plugins.py b/build-aux/measurestack/app_plugins.py index 555651c..1eee739 100644 --- a/build-aux/measurestack/app_plugins.py +++ b/build-aux/measurestack/app_plugins.py @@ -456,21 +456,15 @@ class LibMiscPlugin: class PicoFmtPlugin: - known_out: dict[BaseName, BaseName] known_fct: dict[BaseName, BaseName] def __init__(self) -> None: - self.known_out = { - BaseName(""): BaseName("_out_null"), # XXX - BaseName("vfctprintf"): BaseName("_out_fct"), - BaseName("fmt_sprintf"): BaseName("_out_buffer"), - BaseName("fmt_vsprintf"): BaseName("_out_buffer"), - BaseName("fmt_snprintf"): BaseName("_out_buffer"), - BaseName("fmt_vsnprintf"): BaseName("_out_buffer"), - } self.known_fct = { - BaseName("stdio_vprintf"): BaseName("stdio_buffered_printer"), + # pico_fmt + BaseName("fmt_vsnprintf"): BaseName("_out_buffer"), + # pico_stdio BaseName("__wrap_vprintf"): BaseName("stdio_buffered_printer"), + BaseName("stdio_vprintf"): BaseName("stdio_buffered_printer"), } def is_intrhandler(self, name: QName) -> bool: @@ -493,44 +487,31 @@ class PicoFmtPlugin: if "/printf.c:" in loc: m = util.re_call_other.fullmatch(line) call: str | None = m.group("func") if m else None - if call == "out": - return [x.as_qname() for x in self.known_out.values()], False if "->fct" in line: return [x.as_qname() for x in self.known_fct.values()], False + if "specifier_table" in line: + return [ + QName("conv_sint"), + QName("conv_uint"), + # QName("conv_double"), + QName("conv_char"), + QName("conv_str"), + QName("conv_ptr"), + QName("conv_pct"), + ], False return None def skipmodels(self) -> dict[BaseName, analyze.SkipModel]: ret: dict[BaseName, analyze.SkipModel] = { - BaseName("_out_rev"): analyze.SkipModel( - self.known_out.keys(), self._skipmodel_outcaller - ), - BaseName("_etoa"): analyze.SkipModel( - self.known_out.keys(), self._skipmodel_outcaller - ), - BaseName("_vsnprintf"): analyze.SkipModel( - self.known_out.keys(), self._skipmodel_outcaller - ), - BaseName("_out_fct"): analyze.SkipModel( - self.known_fct.keys(), self._skipmodel__out_fct + BaseName("fmt_state_putchar"): analyze.SkipModel( + self.known_fct.keys(), self._skipmodel_fmt_state_putchar ), } return ret - def _skipmodel_outcaller(self, chain: typing.Sequence[QName], call: QName) -> bool: - if call.base() in self.known_out.values(): - out: BaseName | None = None - for pcall in reversed(chain): - if pcall.base() in self.known_out: - out = self.known_out[pcall.base()] - if out == BaseName("_out_buffer") and call.base() == BaseName( - "_out_null" - ): # XXX: Gross hack - out = BaseName("_out_null") - return call.base() != out - return True - return False - - def _skipmodel__out_fct(self, chain: typing.Sequence[QName], call: QName) -> bool: + def _skipmodel_fmt_state_putchar( + self, chain: typing.Sequence[QName], call: QName + ) -> bool: if call.base() in self.known_fct.values(): fct: BaseName | None = None for pcall in reversed(chain): |