Skip to content
This repository has been archived by the owner on Sep 4, 2022. It is now read-only.

Commit

Permalink
small qol improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
arvid220u committed Apr 2, 2022
1 parent 256f3df commit f178ab6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
51 changes: 35 additions & 16 deletions asphr/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,44 @@
}
#define ASPHR_ASSERT(expr) ASPHR_ASSERT_MSG(expr, "<no detail>")

#define ASPHR_ASSERT_EQ_MSG(a, b, msg) \
{ \
auto a_val = a; \
auto b_val = b; \
if (ASPHR_PREDICT_TRUE((a_val == b_val))) { \
static_cast<void>(0); \
} else { \
PRINT_CERR(#a, a_val); \
PRINT_CERR(#b, b_val); \
std::cerr << "Assertion failed: Values '" << #a << "' and '" << #b \
<< "' are different in function '" << __func__ \
<< "' location '" << __FILE__ << ":" << __LINE__ << "': '" \
<< msg << "'.\n"; \
std::cerr << boost::stacktrace::stacktrace() << std::endl; \
std::abort(); \
} \
#define ASPHR_ASSERT_EQ_MSG(a, b, msg) \
{ \
auto a_val = a; \
auto b_val = b; \
if (ASPHR_PREDICT_TRUE((a_val == b_val))) { \
static_cast<void>(0); \
} else { \
PRINT_CERR(#a, a_val); \
PRINT_CERR(#b, b_val); \
std::cerr << "Assertion failed (" << #a << " == " << #b << "): Values '" \
<< #a << "' and '" << #b << "' are different in function '" \
<< __func__ << "' location '" << __FILE__ << ":" << __LINE__ \
<< "': '" << msg << "'.\n"; \
std::cerr << boost::stacktrace::stacktrace() << std::endl; \
std::abort(); \
} \
}
#define ASPHR_ASSERT_EQ(a, b) ASPHR_ASSERT_EQ_MSG(a, b, "<no detail>")

#define ASPHR_ASSERT_NEQ_MSG(a, b, msg) \
{ \
auto a_val = a; \
auto b_val = b; \
if (ASPHR_PREDICT_TRUE((a_val != b_val))) { \
static_cast<void>(0); \
} else { \
PRINT_CERR(#a, a_val); \
PRINT_CERR(#b, b_val); \
std::cerr << "Assertion failed (" << #a << " != " << #b << "): Values '" \
<< #a << "' and '" << #b << "' are equal in function '" \
<< __func__ << "' location '" << __FILE__ << ":" << __LINE__ \
<< "': '" << msg << "'.\n"; \
std::cerr << boost::stacktrace::stacktrace() << std::endl; \
std::abort(); \
} \
}
#define ASPHR_ASSERT_NEQ(a, b) ASPHR_ASSERT_NEQ_MSG(a, b, "<no detail>")

#else
#define ASPHR_ASSERT_MSG(expr, msg) static_cast<void>(0)
#define ASPHR_ASSERT(expr) static_cast<void>(0)
Expand Down
1 change: 1 addition & 0 deletions schema/daemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ message GetStatusRequest {}
message GetStatusResponse {
bool registered = 1;
string release_hash = 2;
int32 latency_seconds = 3;
}

message GetLatencyRequest {}
Expand Down

0 comments on commit f178ab6

Please sign in to comment.