diff options
author | Tharre <tharre3@gmail.com> | 2016-07-26 12:33:47 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2016-08-03 18:31:39 +0200 |
commit | 220d44f961b0813b2786e45e069660dd37d15f67 (patch) | |
tree | 4a7398cff665e95934537c6c5f52c18f2b4b5d68 | |
parent | ca1b481d6e8606db85e82c236c8edf29b49126c8 (diff) | |
download | redo-220d44f961b0813b2786e45e069660dd37d15f67.tar.gz redo-220d44f961b0813b2786e45e069660dd37d15f67.tar.xz redo-220d44f961b0813b2786e45e069660dd37d15f67.zip |
Always show debug() statements to the compiler
-rw-r--r-- | src/dbg.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,6 +1,6 @@ /* dbg.h * - * Copyright (c) 2014 Tharre + * Copyright (c) 2014-2016 Tharre * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. @@ -19,6 +19,12 @@ #define _FILENAME __FILE__ #endif +#ifndef NDEBUG +#define DEBUG 1 +#else +#define DEBUG 0 +#endif + /* helper functions which help in replacing the GNU extension ##__VA_ARGS__ */ #define STRINGIFY(x) #x #define PREFIX(...) PREFIX_HELPER(_FILENAME, __LINE__, __VA_ARGS__) @@ -34,11 +40,7 @@ #define PREFIX_HELPER(f,l,...) "(" f ":" STRINGIFY(l) "): " __VA_ARGS__ #endif -#ifdef NDEBUG -#define debug(...) -#else -#define debug(...) log_err(__VA_ARGS__) -#endif +#define debug(...) do { if (DEBUG) log_err(__VA_ARGS__); } while (0) #define assert_str_equal(a,b) ({ \ if (strcmp(a, b)) { \ |