0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 00:02:34 +01:00

Replace various #if 0 with if constexpr for regression visibility.

This commit is contained in:
Jason Volk 2023-02-09 10:54:24 -08:00
parent 90f1dc77fb
commit fd6f06c1af
6 changed files with 89 additions and 92 deletions

View file

@ -332,18 +332,19 @@ void
ircd::exec::handler::on_exec_setup(executor &ex)
const noexcept
{
#if 0 // outputs from child; don't want
assert(e);
log::logf
if constexpr((false)) // outputs from child; don't want
{
log, log::level::DEBUG,
"id:%lu pid:%ld `%s' executing...",
e->id,
e->pid,
e->path,
};
#endif
assert(e);
log::logf
{
log, log::level::DEBUG,
"id:%lu pid:%ld `%s' executing...",
e->id,
e->pid,
e->path,
};
}
// Set the parent death signal in case of a crash so we won't go zombie.
#if defined(HAVE_SYS_PRCTL_H)
@ -462,20 +463,21 @@ ircd::exec::handler::on_exec_error(executor &ex,
const std::error_code &ec)
const noexcept
{
#if 0 // outputs from child; don't want
assert(e);
char ecbuf[64];
log::error
if constexpr((false)) // outputs from child; don't want
{
log, "id:%lu pid:%ld `%s' exec() #%ld :%s",
e->id,
e->pid,
e->path,
ec.value(),
string(ecbuf, ec),
};
#endif
assert(e);
char ecbuf[64];
log::error
{
log, "id:%lu pid:%ld `%s' exec() #%ld :%s",
e->id,
e->pid,
e->path,
ec.value(),
string(ecbuf, ec),
};
}
}
template<class executor>

View file

@ -2273,15 +2273,16 @@ ircd::server::link::submit(request &request)
request.tag? queue.emplace(end(queue), std::move(*request.tag)):
queue.emplace(end(queue), request)
};
/*
log::debug
{
log, "tag(%p) submitted to link(%p) queue: %zu",
&(*it),
this,
tag_count()
};
*/
if constexpr((false))
log::debug
{
log, "tag(%p) submitted to link(%p) queue: %zu",
&(*it),
this,
tag_count()
};
if(ready())
wait_writable();
}
@ -2347,14 +2348,13 @@ ircd::server::link::cleanup_canceled()
continue;
}
#if 0
log::dwarning
{
log, "%s removing abandoned tag:%lu",
loghead(*this),
tag.state.id,
};
#endif
if constexpr((false))
log::dwarning
{
log, "%s removing abandoned tag:%lu",
loghead(*this),
tag.state.id,
};
it = queue.erase(it);
}

View file

@ -47,14 +47,13 @@ catch(const ctx::interrupted &)
}
catch(const std::exception &e)
{
#if 0
log::derror
{
log, "sysfs query `%s' :%s",
relpath,
e.what(),
};
#endif
if constexpr((false))
log::derror
{
log, "sysfs query `%s' :%s",
relpath,
e.what(),
};
return {};
}

View file

@ -754,21 +754,20 @@ ircd::m::fetch::finish(request &request)
{
request.finished = ircd::now<system_point>();
#if 0
log::logf
{
log, request.eptr? log::DERROR: log::DEBUG,
"Finished %s in %s started:%ld finished:%d attempted:%zu abandon:%b %s%s",
string_view{request.opts.event_id},
string_view{request.opts.room_id},
duration_cast<seconds>(tse(request.started)).count(),
duration_cast<seconds>(tse(request.finished)).count(),
request.attempted.size(),
!request.promise,
request.eptr? " :" : "",
what(request.eptr),
};
#endif
if constexpr((false))
log::logf
{
log, request.eptr? log::DERROR: log::DEBUG,
"Finished %s in %s started:%ld finished:%d attempted:%zu abandon:%b %s%s",
string_view{request.opts.event_id},
string_view{request.opts.room_id},
duration_cast<seconds>(tse(request.started)).count(),
duration_cast<seconds>(tse(request.finished)).count(),
request.attempted.size(),
!request.promise,
request.eptr? " :" : "",
what(request.eptr),
};
if(!request.promise)
return;

View file

@ -1397,14 +1397,13 @@ ircd::m::vm::call_hook(hook::site<T> &hook,
T&& data)
try
{
#if 0
log::debug
{
log, "%s hook:%s enter",
loghead(eval),
hook.name(),
};
#endif
if constexpr((false))
log::debug
{
log, "%s hook:%s enter",
loghead(eval),
hook.name(),
};
// Providing a pointer to the eval.hook pointer allows the hook site to
// provide updates for observers in other contexts for which hook is
@ -1416,14 +1415,13 @@ try
hook(cur, event, std::forward<T>(data));
#if 0
log::debug
{
log, "%s hook:%s leave",
loghead(eval),
hook.name(),
};
#endif
if constexpr((false))
log::debug
{
log, "%s hook:%s leave",
loghead(eval),
hook.name(),
};
}
catch(const m::error &e)
{

View file

@ -148,18 +148,17 @@ try
event, rule, opts
};
#if 0
log::debug
{
log, "event %s rule { %s, %s, %s } for %s %s",
string_view{event.event_id},
scope,
kind,
ruleid,
string_view{user_id},
bool(match)? "MATCH"_sv : string_view{}
};
#endif
if constexpr((false))
log::debug
{
log, "event %s rule { %s, %s, %s } for %s %s",
string_view{event.event_id},
scope,
kind,
ruleid,
string_view{user_id},
bool(match)? "MATCH"_sv : string_view{}
};
return bool(match);
}