MXS-2013 Minor cleanup of maxscale/debug.h

Removal of unnecessary include files had ripple effects.
This commit is contained in:
Johan Wikman
2018-08-14 16:13:05 +03:00
parent f975035e53
commit 228dcbe0ce
4 changed files with 28 additions and 24 deletions

View File

@ -13,39 +13,40 @@
*/
#include <maxscale/cdefs.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <maxscale/log_manager.h>
MXS_BEGIN_DECLS
#if defined(SS_DEBUG)
#include <maxscale/log_manager.h>
# define ss_dassert(exp) do { if(!(exp)){\
const char *debug_expr = #exp; /** The MXS_ERROR marco doesn't seem to like stringification */ \
MXS_ERROR("debug assert at %s:%d failed: %s\n", (char*)__FILE__, __LINE__, debug_expr); \
fprintf(stderr, "debug assert at %s:%d failed: %s\n", (char*)__FILE__, __LINE__, debug_expr); \
raise(SIGABRT);} } while (false)
#define ss_dassert(exp) do { if(!(exp)){\
const char *debug_expr = #exp; /** The MXS_ERROR marco doesn't seem to like stringification */ \
MXS_ERROR("debug assert at %s:%d failed: %s\n", (char*)__FILE__, __LINE__, debug_expr); \
fprintf(stderr, "debug assert at %s:%d failed: %s\n", (char*)__FILE__, __LINE__, debug_expr); \
raise(SIGABRT);} } while (false)
#define ss_info_dassert(exp,info) do { if(!(exp)){\
const char *debug_expr = #exp; \
MXS_ERROR("debug assert at %s:%d failed: %s (%s)\n", (char*)__FILE__, __LINE__, info, debug_expr); \
fprintf(stderr, "debug assert at %s:%d failed: %s (%s)\n", (char*)__FILE__, __LINE__, info, debug_expr); \
raise(SIGABRT);} } while (false)
# define ss_debug(exp) exp
# define ss_dfprintf fprintf
# define ss_dfflush fflush
# define ss_dfwrite fwrite
const char *debug_expr = #exp; \
MXS_ERROR("debug assert at %s:%d failed: %s (%s)\n", (char*)__FILE__, __LINE__, info, debug_expr); \
fprintf(stderr, "debug assert at %s:%d failed: %s (%s)\n", (char*)__FILE__, __LINE__, info, debug_expr); \
raise(SIGABRT);} } while (false)
#define ss_debug(exp) exp
#define ss_dfprintf fprintf
#define ss_dfflush fflush
#define ss_dfwrite fwrite
#else /* SS_DEBUG */
# define ss_debug(exp)
# define ss_dfprintf(a, b, ...)
# define ss_dfflush(s)
# define ss_dfwrite(a, b, c, d)
# define ss_dassert(exp)
# define ss_info_dassert(exp, info)
#define ss_dassert(exp)
#define ss_info_dassert(exp, info)
#define ss_debug(exp)
#define ss_dfprintf(a, b, ...)
#define ss_dfflush(s)
#define ss_dfwrite(a, b, c, d)
#endif /* SS_DEBUG */