From b3d99a010e5d26e90f105b7d11bdc20214685897 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Tue, 30 Mar 2010 14:22:50 +0000 Subject: [PATCH] Cleanup SUPERCLIENT - use other logic to decide where should assert message go --- src/jrd/gdsassert.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/jrd/gdsassert.h b/src/jrd/gdsassert.h index 9431479fc7..623d35f574 100644 --- a/src/jrd/gdsassert.h +++ b/src/jrd/gdsassert.h @@ -28,24 +28,22 @@ #include // abort() #include +#ifdef WIN_NT +#include // isatty() +#endif +#ifdef HAVE_UNISTD_H +#include // isatty() +#endif + #define FB_ASSERT_FAILURE_STRING "Assertion (%s) failure: %s %"LINEFORMAT"\n" -#ifdef SUPERCLIENT - #if !defined(fb_assert) -#define fb_assert(ex) {if (!(ex)) {fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); abort();}} -#define fb_assert_continue(ex) {if (!(ex)) {fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);}} +#define fb_assert_continue(ex) {if (!(ex)) {if (isatty(2)) fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);\ + else gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);}} +#define fb_assert(ex) {if (!(ex)) {if (isatty(2)) fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);\ + else gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); abort();}} #endif -#else // !SUPERCLIENT - -#if !defined(fb_assert) -#define fb_assert(ex) {if (!(ex)) {gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); abort();}} -#define fb_assert_continue(ex) {if (!(ex)) {gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);}} -#endif - -#endif // SUPERCLIENT - #else // DEV_BUILD #define fb_assert(ex) // nothing