diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-23 16:16:59 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | dc90305a767feaacc3430aaee0928b745a8e5b0f (patch) | |
tree | 6d85df4245a84820dfdf6425f0aa095a563cabbe /include/std | |
parent | 4f308829ad0e81a59971e172284c018cf2bdca3d (diff) |
Use ast pointers to fix resolving, remove try/throwing macros
Diffstat (limited to 'include/std')
-rw-r--r-- | include/std/misc.h | 30 |
1 files changed, 19 insertions, 11 deletions
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 <stdio.h> +#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) |