Fixed warnings on Release builds
This commit is contained in:
parent
b5156702b2
commit
87cfa36481
2 changed files with 16 additions and 9 deletions
|
@ -114,7 +114,7 @@ static struct full_context local_ctx;
|
|||
# error Unsupported compiler. Use GCC or Clang under *nixes.
|
||||
# endif
|
||||
|
||||
static void handle_sigchld(int sig) {
|
||||
static void handle_sigchld(UNUSED int sig) {
|
||||
assert(sig == SIGCHLD);
|
||||
|
||||
int fd = g_worker_pipe->fds[1];
|
||||
|
@ -130,7 +130,8 @@ static void handle_sigchld(int sig) {
|
|||
memcpy(buf, &kind, sizeof (kind));
|
||||
memcpy(buf + sizeof (kind), &ws, sizeof (ws));
|
||||
|
||||
write(fd, &buf, sizeof (buf));
|
||||
if (write(fd, &buf, sizeof (buf)) < (ssize_t) sizeof (buf))
|
||||
abort();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -142,7 +143,7 @@ struct wait_context {
|
|||
};
|
||||
|
||||
static void CALLBACK handle_child_terminated(PVOID lpParameter,
|
||||
BOOLEAN TimerOrWaitFired) {
|
||||
UNUSED BOOLEAN TimerOrWaitFired) {
|
||||
|
||||
assert(!TimerOrWaitFired);
|
||||
|
||||
|
|
|
@ -184,6 +184,17 @@ static void concat_arg(char (*msg)[4096], struct criterion_datapoints *dps, size
|
|||
strncat(*msg, arg, sizeof (*msg) - 1);
|
||||
}
|
||||
|
||||
int try_call_theory(struct criterion_theory_context *ctx, void (*fnptr)(void)) {
|
||||
jmp_buf backup;
|
||||
memcpy(backup, g_pre_test, sizeof (jmp_buf));
|
||||
int res = setjmp(g_pre_test);
|
||||
if (!res) {
|
||||
cr_theory_call(ctx, fnptr);
|
||||
}
|
||||
memcpy(g_pre_test, backup, sizeof (jmp_buf));
|
||||
return !res;
|
||||
}
|
||||
|
||||
void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*fnptr)(void)) {
|
||||
struct criterion_theory_context *ctx = cr_theory_init();
|
||||
|
||||
|
@ -205,11 +216,7 @@ void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*
|
|||
((char*) dps[i].arr) + dps[i].size * indices[i]);
|
||||
}
|
||||
|
||||
jmp_buf backup;
|
||||
memcpy(backup, g_pre_test, sizeof (jmp_buf));
|
||||
if (!setjmp(g_pre_test)) {
|
||||
cr_theory_call(ctx, fnptr);
|
||||
} else {
|
||||
if (!try_call_theory(ctx, fnptr)) {
|
||||
struct {
|
||||
size_t len;
|
||||
char msg[4096];
|
||||
|
@ -224,7 +231,6 @@ void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*
|
|||
|
||||
send_event(THEORY_FAIL, &result, result.len + sizeof (size_t));
|
||||
}
|
||||
memcpy(g_pre_test, backup, sizeof (jmp_buf));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < datapoints; ++i) {
|
||||
|
|
Loading…
Add table
Reference in a new issue