From dc90305a767feaacc3430aaee0928b745a8e5b0f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 23 Mar 2019 16:16:59 +0100 Subject: Use ast pointers to fix resolving, remove try/throwing macros --- include/std/misc.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'include/std') diff --git a/include/std/misc.h b/include/std/misc.h index e28ed48..2549c22 100644 --- a/include/std/misc.h +++ b/include/std/misc.h @@ -1,25 +1,33 @@ #ifndef AMALGAM_MISC_H #define AMALGAM_MISC_H -#include +#ifndef AMAL_PEDANTIC +#include "log.h" +#endif + +#ifdef AMAL_PEDANTIC + #define throw_debug_msg do {} while(0) +#else + #define throw_debug_msg do { amal_log_error("Throwing from %s:%d", __FUNCTION__, __LINE__); } while(0) +#endif #ifdef AMAL_PEDANTIC #define return_if_debug_msg do {} while(0) #define cleanup_if_debug_msg do {} while(0) #else - #define return_if_debug_msg do { fprintf(stderr, "Return from %s:%d\n", __FUNCTION__, __LINE__); } while(0) - #define cleanup_if_debug_msg do { fprintf(stderr, "cleanup from %s:%d\n", __FUNCTION__, __LINE__); } while(0) + #define return_if_debug_msg do { amal_log_error("Return from %s:%d", __FUNCTION__, __LINE__); } while(0) + #define cleanup_if_debug_msg do { amal_log_error("cleanup from %s:%d", __FUNCTION__, __LINE__); } while(0) #endif #define return_if_error(result) \ -do { \ - int return_if_result; \ - return_if_result = (result); \ - if((return_if_result) != 0) { \ - return_if_debug_msg; \ - return return_if_result; \ - } \ -} while(0) + do { \ + int return_if_result; \ + return_if_result = (result); \ + if((return_if_result) != 0) { \ + return_if_debug_msg; \ + return return_if_result; \ + } \ + } while(0) #define cleanup_if_error(result) do { if((result) != 0) { cleanup_if_debug_msg; goto cleanup; } } while(0) -- cgit v1.2.3