Remove three template specializations that turned out to be dead
code on inspection:
- ChatterTraits<const Argument *> 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<const char *> 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<T> template's `c.get_os() << arg` falls
through to `ostream::operator<<(const char *)`, producing the
same correct output without a dedicated specialization.
- ChatterTraits<Fd> 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<T>
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 <noreply@anthropic.com>
return ChatterTraits<T>()(*this, arg);
}
- template <class Argument>
- struct ChatterTraits<const Argument *> {
- Chatter &operator()(Chatter &c, const Argument *arg)
- {
- if (arg) {
- c.get_os() << "(pointer to " << typeid(*arg).name() << ")(" << reinterpret_cast<const void *>(arg) << ")";
- } else {
- c.get_os() << "(NULL pointer to " << typeid(arg).name() << ')';
- }
- return c;
- }
- };
-
- template <>
- struct ChatterTraits<const char *> {
- Chatter &
- operator()(Chatter &c, const char *arg)
- {
- c.get_os() << arg;
- return c;
- }
- };
-
class ChatterBox {
string m_file;
int m_line;
return m_handle;
}
- // XXX: necessary? useful?
- template <>
- struct ChatterTraits<Fd> {
- Chatter &operator()(Chatter &c, const Fd &fd) const
- {
- c << "Fd {this=" << &fd << " fd=" << static_cast<int>(fd) << "}";
- return c;
- }
- };
-
int
open_or_die(const string &file, int flags, mode_t mode)
{