[Change] Use SIGTRAP instead of assert for blowing up on errors.

This commit is contained in:
Allanis 2013-11-26 19:27:34 +00:00
parent 2a69789a24
commit 58ee934426

View File

@ -1,21 +1,17 @@
#pragma once #pragma once
#include <stdio.h> #include <stdio.h>
#include <signal.h>
/* We'll use asserts in DEBUG if defined. */
#ifndef DEBUG
# define NODEBUG
#endif /* DEBUG */
#include <assert.h>
#define LOG(str, args...)(fprintf(stdout, str"\n", ## args)) #define LOG(str, args...)(fprintf(stdout, str"\n", ## args))
#ifdef DEBUG_PARANOID /* Will cause WARN's to blow up. */ #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 #else
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args)) #define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args))
#endif #endif
#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \ #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 #ifdef DEBUG
# undef DEBUG # undef DEBUG