[Change] Use SIGTRAP instead of assert for blowing up on errors.
This commit is contained in:
parent
2a69789a24
commit
58ee934426
12
src/log.h
12
src/log.h
@ -1,21 +1,17 @@
|
||||
#pragma once
|
||||
#include <stdio.h>
|
||||
|
||||
/* We'll use asserts in DEBUG if defined. */
|
||||
#ifndef DEBUG
|
||||
# define NODEBUG
|
||||
#endif /* DEBUG */
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define LOG(str, args...)(fprintf(stdout, str"\n", ## args))
|
||||
#ifdef DEBUG_PARANOID /* Will cause WARN's to blow up. */
|
||||
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args), assert(0))
|
||||
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args), \
|
||||
raise(SIGRAP))
|
||||
#else
|
||||
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args))
|
||||
#endif
|
||||
|
||||
#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \
|
||||
__FILE__, __LINE__, __func__, ## args), assert(0))
|
||||
__FILE__, __LINE__, __func__, ## args), raise(SIGTRAP))
|
||||
|
||||
#ifdef DEBUG
|
||||
# undef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user