From e678948dda9ad07902f3719c7616e99dd1a6ba83 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 23 Jun 2013 02:28:43 +0000 Subject: [PATCH] Use system assert instead of homegrown Assert --- include/dxxerror.h | 7 ++----- misc/error.c | 6 ------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/include/dxxerror.h b/include/dxxerror.h index 98eef83f6..d63cace02 100644 --- a/include/dxxerror.h +++ b/include/dxxerror.h @@ -21,6 +21,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define _ERROR_H #include +#include #ifdef __GNUC__ #define __noreturn __attribute__ ((noreturn)) @@ -35,10 +36,8 @@ int error_init(void (*func)(const char *)); //init error system, returns 0=ok void Warning(char *fmt,...); //print out warning message to user void set_warn_func(void (*f)(char *s));//specifies the function to call with warning messages void clear_warn_func(void (*f)(char *s));//say this function no longer valid -void _Assert(int expr,char *expr_text,char *filename,int linenum); //assert func void Error(const char *fmt,...) __noreturn __attribute_gcc_format((printf, 1, 2)); //exit with error code=1, print message -void Assert(int expr); -void Int3(); +#define Assert assert #ifndef NDEBUG //macros for debugging # if defined(__APPLE__) || defined(macintosh) @@ -47,12 +46,10 @@ extern void Debugger(void); // Avoids some name clashes # else # define Int3() ((void)0) # endif // Macintosh -#define Assert(expr) ((expr)?(void)0:(void)_Assert(0,#expr,__FILE__,__LINE__)) #else //macros for real game //Changed Assert and Int3 because I couldn't get the macros to compile -KRB -#define Assert(__ignore) ((void)0) #define Int3() ((void)0) #endif diff --git a/misc/error.c b/misc/error.c index 75f8ef560..35065f2eb 100644 --- a/misc/error.c +++ b/misc/error.c @@ -52,12 +52,6 @@ void clear_warn_func(void (*f)(char *s)) warn_func = warn_printf; } -void _Assert(int expr,char *expr_text,char *filename,int linenum) -{ - Int3(); - if (!(expr)) Error("Assertion failed: %s, file %s, line %d",expr_text,filename,linenum); -} - void print_exit_message(const char *exit_message) { if (ErrorPrintFunc)