From: Zygo Blaxell Date: Tue, 28 Apr 2026 21:25:38 +0000 (-0400) Subject: chatter, fd: drop unused ChatterTraits specializations X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45b5e0552e07fec64fff73a47b064d92a8f4f367;p=bees chatter, fd: drop unused ChatterTraits specializations Remove three template specializations that turned out to be dead code on inspection: - ChatterTraits in chatter.h: the pointer pretty-print that emitted "(pointer to TypeName)(0xaddr)". A link-time audit (extern undefined symbol inserted in the template body, full build) confirmed no translation unit in either the library or its consumers instantiates this specialization. The format had not been used anywhere in practice. - ChatterTraits in chatter.h: existed only to override the pointer specialization for C-strings (which would otherwise pretty-print every literal as "(pointer to char) (0xaddr)"). Once the pointer specialization is gone, the primary ChatterTraits template's `c.get_os() << arg` falls through to `ostream::operator<<(const char *)`, producing the same correct output without a dedicated specialization. - ChatterTraits in fd.cc: transitively dead. Its body contained `c << &fd` where `&fd` has type `const Fd *`, which would have triggered the now-removed pointer specialization had any caller used it. The author's own comment (`// XXX: necessary? useful?`) reflected the same uncertainty; the audit confirmed the answer. Callers that need to print an Fd in a log message can use Fd::operator int() for the file-descriptor number or name_fd(const Fd&) for the resolved path — both already in the public API. Three template specializations removed; the primary ChatterTraits template that delegates to `ostream::operator<<` remains as the single dispatch path. No behavior change for any existing caller (audit guarantees these specializations were unreachable). Co-Authored-By: Claude Opus 4.7 --- diff --git a/include/crucible/chatter.h b/include/crucible/chatter.h index b491dbf0..c7268c4c 100644 --- a/include/crucible/chatter.h +++ b/include/crucible/chatter.h @@ -69,29 +69,6 @@ namespace crucible { return ChatterTraits()(*this, arg); } - template - struct ChatterTraits { - Chatter &operator()(Chatter &c, const Argument *arg) - { - if (arg) { - c.get_os() << "(pointer to " << typeid(*arg).name() << ")(" << reinterpret_cast(arg) << ")"; - } else { - c.get_os() << "(NULL pointer to " << typeid(arg).name() << ')'; - } - return c; - } - }; - - template <> - struct ChatterTraits { - Chatter & - operator()(Chatter &c, const char *arg) - { - c.get_os() << arg; - return c; - } - }; - class ChatterBox { string m_file; int m_line; diff --git a/lib/fd.cc b/lib/fd.cc index d147eeb5..598b5209 100644 --- a/lib/fd.cc +++ b/lib/fd.cc @@ -162,16 +162,6 @@ namespace crucible { return m_handle; } - // XXX: necessary? useful? - template <> - struct ChatterTraits { - Chatter &operator()(Chatter &c, const Fd &fd) const - { - c << "Fd {this=" << &fd << " fd=" << static_cast(fd) << "}"; - return c; - } - }; - int open_or_die(const string &file, int flags, mode_t mode) {