summaryrefslogtreecommitdiffstats
path: root/core/error/error_macros.h
diff options
context:
space:
mode:
authorlawnjelly <lawnjelly@gmail.com>2022-02-05 12:31:54 +0000
committerlawnjelly <lawnjelly@gmail.com>2022-02-05 12:31:54 +0000
commit9963c4f0d328600a39646479e7b8809694f3108a (patch)
tree9e47d9d16f95cd3f610613214ebea3faece08a13 /core/error/error_macros.h
parentdf1724470d1cff4f67aeb4c0d039114373aeb001 (diff)
downloadredot-engine-9963c4f0d328600a39646479e7b8809694f3108a.tar.gz
Add fflush to error macros
CRASH_NOW macros would previously crash before outputting any error messages. This PR ensures calling fflush for stdout before terminating.
Diffstat (limited to 'core/error/error_macros.h')
-rw-r--r--core/error/error_macros.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/error/error_macros.h b/core/error/error_macros.h
index 802d7f9ef4..7b032fb4cd 100644
--- a/core/error/error_macros.h
+++ b/core/error/error_macros.h
@@ -69,6 +69,7 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_editor_notify = false, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message = "", bool p_editor_notify = false, bool fatal = false);
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify = false, bool fatal = false);
+void _err_flush_stdout();
#ifdef __GNUC__
//#define FUNCTION_STR __PRETTY_FUNCTION__ - too annoying
@@ -789,6 +790,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
#define CRASH_NOW() \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed."); \
+ _err_flush_stdout(); \
GENERATE_TRAP(); \
} else \
((void)0)
@@ -801,6 +803,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
#define CRASH_NOW_MSG(m_msg) \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed.", m_msg); \
+ _err_flush_stdout(); \
GENERATE_TRAP(); \
} else \
((void)0)