diff options
-rw-r--r-- | common.c | 2 | ||||
-rw-r--r-- | dbg.h | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -89,7 +89,7 @@ static struct wg_dynamic_attr *parse_value(enum wg_dynamic_key key, char *value) break; default: debug("Invalid key %d, aborting\n", key); - abort(); + BUG(); } attr = malloc(sizeof(struct wg_dynamic_attr) + len); @@ -45,6 +45,9 @@ extern int DBG_LVL; #endif #define debug(...) do { if (DEBUG) log_err(__VA_ARGS__); } while (0) +#define BUG() do { __BUG(_FILENAME, __LINE__); abort(); } while (0) +#define __BUG(f,l) fprintf(stderr, "BUG: " f ":" STRINGIFY(l) "\n") +#define BUG_ON(cond) do { if (cond) BUG(); } while (0) #define assert_str_equal(a,b) ({ \ if (strcmp(a, b)) { \ |