mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 10:08:56 +02:00
Replace various #ifdef RB_DEBUG with if constexpr for regression visibility.
This commit is contained in:
parent
44acfb5deb
commit
762703698c
|
@ -92,9 +92,8 @@ __attribute__((always_inline, gnu_inline, artificial))
|
||||||
ircd::json::debug_valid_output(const string_view &in,
|
ircd::json::debug_valid_output(const string_view &in,
|
||||||
const size_t &expected)
|
const size_t &expected)
|
||||||
{
|
{
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
valid_output(in, expected);
|
valid_output(in, expected);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr ircd::json::name_hash_t
|
constexpr ircd::json::name_hash_t
|
||||||
|
|
|
@ -484,14 +484,17 @@ try
|
||||||
dock.notify_all();
|
dock.notify_all();
|
||||||
}};
|
}};
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
util::timer timer
|
||||||
util::timer timer;
|
{
|
||||||
|
RB_DEBUG_LEVEL
|
||||||
|
};
|
||||||
|
|
||||||
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
log, "%s enter",
|
log, "%s enter",
|
||||||
loghead(*client),
|
loghead(*client),
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!client->main())
|
if(!client->main())
|
||||||
{
|
{
|
||||||
|
@ -499,7 +502,8 @@ try
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
|
@ -507,7 +511,7 @@ try
|
||||||
loghead(*client),
|
loghead(*client),
|
||||||
pretty(buf, timer.at<microseconds>(), true)
|
pretty(buf, timer.at<microseconds>(), true)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
|
|
||||||
client->async();
|
client->async();
|
||||||
}
|
}
|
||||||
|
|
15
ircd/db.cc
15
ircd/db.cc
|
@ -4405,13 +4405,12 @@ ircd::db::throw_on_error::throw_on_error(const rocksdb::Status &status)
|
||||||
case Status::kNotFound:
|
case Status::kNotFound:
|
||||||
throw not_found{};
|
throw not_found{};
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
|
||||||
//case Status::kCorruption:
|
//case Status::kCorruption:
|
||||||
case Status::kNotSupported:
|
case Status::kNotSupported:
|
||||||
case Status::kInvalidArgument:
|
case Status::kInvalidArgument:
|
||||||
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
debugtrap();
|
debugtrap();
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
#endif
|
|
||||||
|
|
||||||
[[unlikely]]
|
[[unlikely]]
|
||||||
default:
|
default:
|
||||||
|
@ -4556,9 +4555,10 @@ ircd::db::commit(database &d,
|
||||||
rocksdb::WriteBatch &batch,
|
rocksdb::WriteBatch &batch,
|
||||||
const rocksdb::WriteOptions &opts)
|
const rocksdb::WriteOptions &opts)
|
||||||
{
|
{
|
||||||
#ifdef RB_DEBUG
|
ircd::timer timer
|
||||||
ircd::timer timer;
|
{
|
||||||
#endif
|
RB_DEBUG_LEVEL
|
||||||
|
};
|
||||||
|
|
||||||
const std::lock_guard lock{d.write_mutex};
|
const std::lock_guard lock{d.write_mutex};
|
||||||
const ctx::uninterruptible ui;
|
const ctx::uninterruptible ui;
|
||||||
|
@ -4568,7 +4568,8 @@ ircd::db::commit(database &d,
|
||||||
d.d->Write(opts, &batch)
|
d.d->Write(opts, &batch)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
char dbuf[192];
|
char dbuf[192];
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
|
@ -4578,7 +4579,7 @@ ircd::db::commit(database &d,
|
||||||
debug(dbuf, batch),
|
debug(dbuf, batch),
|
||||||
timer.at<microseconds>().count()
|
timer.at<microseconds>().count()
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::string_view
|
||||||
|
|
|
@ -1042,9 +1042,8 @@ try
|
||||||
opts->stats_dump_period_sec = 0; // Disable noise
|
opts->stats_dump_period_sec = 0; // Disable noise
|
||||||
opts->statistics = this->stats;
|
opts->statistics = this->stats;
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
opts->dump_malloc_stats = true;
|
opts->dump_malloc_stats = true;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disables the timer to delete unused files; this operation occurs
|
// Disables the timer to delete unused files; this operation occurs
|
||||||
// instead with our compaction operations so we don't need to complicate.
|
// instead with our compaction operations so we don't need to complicate.
|
||||||
|
|
|
@ -273,7 +273,8 @@ ircd::fs::support::dump_info()
|
||||||
support
|
support
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
const unique_mutable_buffer buf
|
const unique_mutable_buffer buf
|
||||||
{
|
{
|
||||||
PATH_MAX_LEN + 1
|
PATH_MAX_LEN + 1
|
||||||
|
@ -281,9 +282,10 @@ ircd::fs::support::dump_info()
|
||||||
|
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
log, "Current working directory: `%s'", cwd(buf)
|
log, "Current working directory: `%s'",
|
||||||
|
cwd(buf)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -933,7 +933,6 @@ ircd::info::dump_sys_info()
|
||||||
fs::support::dump_info();
|
fs::support::dump_info();
|
||||||
|
|
||||||
// Additional detected system parameters
|
// Additional detected system parameters
|
||||||
//#ifdef RB_DEBUG
|
|
||||||
char buf[2][48];
|
char buf[2][48];
|
||||||
log::logf
|
log::logf
|
||||||
{
|
{
|
||||||
|
@ -948,7 +947,6 @@ ircd::info::dump_sys_info()
|
||||||
between(thp_enable, '[', ']'),
|
between(thp_enable, '[', ']'),
|
||||||
thp_size,
|
thp_size,
|
||||||
};
|
};
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYS_UTSNAME_H
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
|
|
|
@ -416,6 +416,7 @@ ircd_dl_signal_exception(int errcode,
|
||||||
//
|
//
|
||||||
#ifdef HAVE_DLFCN_H
|
#ifdef HAVE_DLFCN_H
|
||||||
#ifdef IRCD_MODS_HOOK_DLSYM
|
#ifdef IRCD_MODS_HOOK_DLSYM
|
||||||
|
#define RB_DEBUG_MODS_HOOK_DLSYM 0
|
||||||
|
|
||||||
extern "C" void *
|
extern "C" void *
|
||||||
__libc_dlsym(void *, const char *);
|
__libc_dlsym(void *, const char *);
|
||||||
|
@ -424,14 +425,13 @@ extern "C" void *
|
||||||
dlsym(void *const handle,
|
dlsym(void *const handle,
|
||||||
const char *const symbol)
|
const char *const symbol)
|
||||||
{
|
{
|
||||||
#ifdef RB_DEBUG_MODS_HOOK_DLSYM
|
if constexpr(RB_DEBUG_MODS_HOOK_DLSYM)
|
||||||
ircd::log::debug
|
ircd::log::debug
|
||||||
{
|
{
|
||||||
ircd::mods::log, "handle:%p symbol lookup '%s'",
|
ircd::mods::log, "handle:%p symbol lookup '%s'",
|
||||||
handle,
|
handle,
|
||||||
symbol
|
symbol
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return __libc_dlsym(handle, symbol);
|
return __libc_dlsym(handle, symbol);
|
||||||
}
|
}
|
||||||
|
|
10
ircd/net.cc
10
ircd/net.cc
|
@ -2420,7 +2420,8 @@ noexcept try
|
||||||
if(timedout && ec == errc::operation_canceled)
|
if(timedout && ec == errc::operation_canceled)
|
||||||
ec = make_error_code(errc::timed_out);
|
ec = make_error_code(errc::timed_out);
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
const auto *const current_cipher
|
const auto *const current_cipher
|
||||||
{
|
{
|
||||||
!ec?
|
!ec?
|
||||||
|
@ -2438,7 +2439,7 @@ noexcept try
|
||||||
"<NO CIPHER>"_sv,
|
"<NO CIPHER>"_sv,
|
||||||
string(ecbuf, ec)
|
string(ecbuf, ec)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// Toggles the behavior of non-async functions; see func comment
|
// Toggles the behavior of non-async functions; see func comment
|
||||||
if(!ec)
|
if(!ec)
|
||||||
|
@ -2608,7 +2609,8 @@ noexcept try
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
thread_local char buf[16_KiB];
|
thread_local char buf[16_KiB];
|
||||||
const critical_assertion ca;
|
const critical_assertion ca;
|
||||||
log::debug
|
log::debug
|
||||||
|
@ -2617,7 +2619,7 @@ noexcept try
|
||||||
common_name(opts),
|
common_name(opts),
|
||||||
openssl::print_subject(buf, cert)
|
openssl::print_subject(buf, cert)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,7 +726,8 @@ noexcept try
|
||||||
assert(it != end(handshaking));
|
assert(it != end(handshaking));
|
||||||
assert(openssl::get_app_data(*sock) == sock.get());
|
assert(openssl::get_app_data(*sock) == sock.get());
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
const auto *const current_cipher
|
const auto *const current_cipher
|
||||||
{
|
{
|
||||||
!ec?
|
!ec?
|
||||||
|
@ -747,7 +748,7 @@ noexcept try
|
||||||
"<NO CIPHER>"_sv,
|
"<NO CIPHER>"_sv,
|
||||||
string(ecbuf, ec)
|
string(ecbuf, ec)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
|
|
||||||
handshaking.erase(it);
|
handshaking.erase(it);
|
||||||
openssl::set_app_data(*sock, nullptr);
|
openssl::set_app_data(*sock, nullptr);
|
||||||
|
|
|
@ -1361,7 +1361,8 @@ ircd::resource::response::response(client &client,
|
||||||
eptr = std::current_exception();
|
eptr = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RB_DEBUG
|
if constexpr(RB_DEBUG_LEVEL)
|
||||||
|
{
|
||||||
const log::level level
|
const log::level level
|
||||||
{
|
{
|
||||||
http::severity(http::category(code))
|
http::severity(http::category(code))
|
||||||
|
@ -1386,7 +1387,7 @@ ircd::resource::response::response(client &client,
|
||||||
string_view{},
|
string_view{},
|
||||||
what(eptr)
|
what(eptr)
|
||||||
};
|
};
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if(unlikely(eptr))
|
if(unlikely(eptr))
|
||||||
std::rethrow_exception(eptr);
|
std::rethrow_exception(eptr);
|
||||||
|
|
Loading…
Reference in a new issue