aboutsummaryrefslogtreecommitdiff
path: root/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'include/std')
-rw-r--r--include/std/misc.h30
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)