19static bool config(
char const* name,
bool whenUnset)
22 char const* e = getenv(name);
26 else if(strcmp(e,
"0") == 0)
42 case Env::EnableDebugPrint: {
43 static bool const e = Config::SupportDebugPrint
44 &&
config(
"ZTH_CONFIG_ENABLE_DEBUG_PRINT", whenUnset);
47 case Env::DoPerfEvent: {
48 static bool const e =
config(
"ZTH_CONFIG_DO_PERF_EVENT", whenUnset);
51 case Env::PerfSyscall: {
52 static bool const e =
config(
"ZTH_CONFIG_PERF_SYSCALL", whenUnset);
55 case Env::CheckTimesliceOverrun: {
56 static bool const e =
config(
"ZTH_CONFIG_CHECK_TIMESLICE_OVERRUN", whenUnset);
73 char const* name =
nullptr;
76 case Check::Config_##x: \
77 ok = (size_t)Config::x == value; \
78 if(Config::EnableFullAssert) \
107 if(Config::EnableFullAssert && name)
108 abort(
"Config check %s failed", name);
110 abort(
"Config check %d failed", check);
void abort(char const *fmt,...) noexcept
Aborts the process after printing the given printf() formatted message.
void checkConfig(int check, size_t value)
Check if a given Config field is the same as the given value.
bool config(int env, bool whenUnset)
Checks if a given environment option is set.