0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 14:38:57 +02:00

Replace additional #ifdef debug related w/ if constexpr for regression visibility.

This commit is contained in:
Jason Volk 2023-02-17 19:10:06 -08:00
parent f1676fdb80
commit 716134186e
5 changed files with 42 additions and 38 deletions

View file

@ -27,6 +27,8 @@ namespace ircd::m::media::file
{
using closure = std::function<void (const const_buffer &)>;
constexpr bool debug_read {false};
room::id room_id(room::id::buf &out, const mxc &);
room::id::buf room_id(const mxc &);

View file

@ -37,6 +37,8 @@ ircd::net::acceptor
IRCD_EXCEPTION(listener::error, error)
IRCD_EXCEPTION(error, sni_warning)
static constexpr bool debug_alpn {false};
static log::log log;
static ios::descriptor accept_desc;
static ios::descriptor handshake_desc;

View file

@ -16,6 +16,8 @@ namespace ircd::magick
struct display;
struct transform;
constexpr bool debug_progress {false};
[[noreturn]] static void handle_exception(const ExceptionType, const char *, const char *);
static void handle_fatal(const ExceptionType, const char *, const char *) __attribute__((noreturn));
static void handle_error(const ExceptionType, const char *, const char *) noexcept;
@ -664,7 +666,7 @@ noexcept try
// This debug message is very noisy, even for debug mode. Developer can
// enable it at their discretion.
#ifdef IRCD_MAGICK_DEBUG_PROGRESS
if constexpr(debug_progress)
log::debug
{
log, "job:%lu progress %2.2lf%% (%ld/%ld) cycles:%lu :%s",
@ -675,7 +677,6 @@ noexcept try
job::cur.cycles,
job::cur.text,
};
#endif
check_cycles(job::cur);
check_yield(job::cur);

View file

@ -852,7 +852,7 @@ ircd::net::acceptor::handle_alpn(socket &socket,
size(in),
};
#ifdef IRCD_NET_ACCEPTOR_DEBUG_ALPN
if constexpr(debug_alpn)
for(size_t i(0); i < size(in); ++i)
{
log::debug
@ -864,7 +864,6 @@ ircd::net::acceptor::handle_alpn(socket &socket,
in[i],
};
}
#endif IRCD_NET_ACCEPTOR_DEBUG_ALPN
//NOTE: proto == "h2" condition goes here
for(const auto &proto : in)

View file

@ -396,7 +396,7 @@ ircd::m::media::file::read(const m::room &room,
b64::decode(blk_decode_buf, blk_encoded)
};
#ifdef IRCD_M_MEDIA_FILE_DEBUG
if constexpr(debug_read)
log::debug
{
log, "File %s read event_idx:%lu events[fetched:%zu prefetched:%zu] encoded:%zu decoded:%zu total_encoded:%zu total_decoded:%zu",
@ -409,7 +409,7 @@ ircd::m::media::file::read(const m::room &room,
encoding_bytes,
decoded_bytes,
};
#endif
assert(size(blk) == b64::decode_size(blk_encoded));
closure(blk);