[Add] Make assert(0) on WARN optional with DEBUG_PARANOID.

This commit is contained in:
Allanis 2013-08-22 18:31:28 +01:00
parent 5ddb5fff94
commit ae1cc7c494
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# OPTIONS.
DEBUG = 1
#DEBUG_PARANOID = 0
OS := LINUX
#OS := WIN32
@ -32,6 +33,9 @@ ifdef DEBUG
CFLAGS += -W -Wall -Wextra -Wunused -Wshadow -Wpointer-arith -Wmissing-prototypes \
-Winline -Wcast-align -Wmissing-declarations -fstack-protector \
-fstack-protector-all -g3 -DDEBUG -DLUA_USE_APICHECK -std=c99
ifdef DEBUG_PARANOID
CFLAGS += -DDEBUG_PARANOID
endif
else
CFLAGS += -O2 -funroll-loops -pipe -std=c99
endif

View File

@ -8,7 +8,12 @@
#include <assert.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: "str"\n", ## args), assert(0))
#else
#define WARN(str, args...)(fprintf(stderr, "Warning: "str"\n", ## args))
#endif
#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \
__FILE__, __LINE__, __func__, ## args), assert(0))