Compare commits
2 Commits
f9aec10459
...
9162db31e3
Author | SHA1 | Date | |
---|---|---|---|
9162db31e3 | |||
24baf3524a |
7
Makefile
7
Makefile
@@ -51,12 +51,15 @@ CPPFLAGS := -I $(INCDIR)
|
|||||||
CPPFLAGS += -DDEBUG_DEBUG # activate logs funcs
|
CPPFLAGS += -DDEBUG_DEBUG # activate logs funcs
|
||||||
CPPFLAGS += -DDEBUG_POOL # mem pools
|
CPPFLAGS += -DDEBUG_POOL # mem pools
|
||||||
|
|
||||||
|
CPPFLAGS += -DBUG_ON # bug_on in bug.h
|
||||||
|
CPPFLAGS += -DWARN_ON # warn_on in bug.h
|
||||||
|
|
||||||
# remove extraneous spaces (due to spaces before comments)
|
# remove extraneous spaces (due to spaces before comments)
|
||||||
CPPFLAGS := $(strip $(CPPFLAGS))
|
CPPFLAGS := $(strip $(CPPFLAGS))
|
||||||
|
|
||||||
##################################### compiler flags
|
##################################### compiler flags
|
||||||
CFLAGS := -std=gnu11
|
CFLAGS := -std=gnu11
|
||||||
CFLAGS += -O2
|
CFLAGS += -O3
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CFLAGS += -Wextra
|
CFLAGS += -Wextra
|
||||||
@@ -248,7 +251,7 @@ cleanccls:
|
|||||||
# maybe run cleanobj cleanlibobj in commands ?
|
# maybe run cleanobj cleanlibobj in commands ?
|
||||||
$(CCLSCMDS): cleanobj $(SRC) | $(CCLSROOT)
|
$(CCLSCMDS): cleanobj $(SRC) | $(CCLSROOT)
|
||||||
@echo "Generating ccls compile commands file ($@)."
|
@echo "Generating ccls compile commands file ($@)."
|
||||||
@$(BEAR) -- make test
|
@$(BEAR) -- $(MAKE) test
|
||||||
|
|
||||||
##################################### valgrind (mem check)
|
##################################### valgrind (mem check)
|
||||||
.PHONY: memcheck
|
.PHONY: memcheck
|
||||||
|
@@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "likely.h"
|
#include "likely.h"
|
||||||
|
|
||||||
|
#ifdef BUG_ON
|
||||||
#define bug_on(expr) do { \
|
#define bug_on(expr) do { \
|
||||||
if (unlikely(expr)) { \
|
if (unlikely(expr)) { \
|
||||||
fprintf(stderr, \
|
fprintf(stderr, \
|
||||||
@@ -28,7 +30,11 @@
|
|||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define bug_on(expr) ({ 0; })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WARN_ON
|
||||||
#define warn_on(expr) ({ \
|
#define warn_on(expr) ({ \
|
||||||
int _ret = !!(expr); \
|
int _ret = !!(expr); \
|
||||||
if (unlikely(_ret)) \
|
if (unlikely(_ret)) \
|
||||||
@@ -37,7 +43,9 @@
|
|||||||
__func__, __FILE__,__LINE__); \
|
__func__, __FILE__,__LINE__); \
|
||||||
unlikely(_ret); \
|
unlikely(_ret); \
|
||||||
})
|
})
|
||||||
|
#else
|
||||||
|
#define warn_on(expr) ({ 0; })
|
||||||
|
#endif
|
||||||
#define warn(expr, args...) ({ \
|
#define warn(expr, args...) ({ \
|
||||||
int _ret = !!(expr); \
|
int _ret = !!(expr); \
|
||||||
if (unlikely(_ret)) \
|
if (unlikely(_ret)) \
|
||||||
|
Reference in New Issue
Block a user