summaryrefslogtreecommitdiff
path: root/src/utils/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/log.h')
-rw-r--r--src/utils/log.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/log.h b/src/utils/log.h
index 913fd34..d080c6a 100644
--- a/src/utils/log.h
+++ b/src/utils/log.h
@@ -1,17 +1,24 @@
#pragma once
#include <stdlib.h>
+#include "utils/type.h"
#ifndef __FILE_NAME__
#define __FILE_NAME__ __FILE__
#endif
+#ifdef __GNUC__
+#define UNREACHABLE_BACK (__builtin_unreachable())
+#else
+#define UNREACHABLE_BACK (exit(1))
+#endif
+
#define printLog(format,...) _printLogBack(format, __FILE_NAME__, __LINE__, ## __VA_ARGS__)
#define printError(begin,end,format,...) _printErrorWarningBack(__FILE_NAME__, __LINE__, begin, end, true, format, ## __VA_ARGS__)
#define printWarning(begin,end,format,...) _printErrorWarningBack(__FILE_NAME__, __LINE__, begin, end, false, format, ## __VA_ARGS__)
-#define UNREACHABLE printLog("Unreachable");exit(1)
-#define NOT_IMPLEMENTED printLog("Not implemented");exit(1)
+#define UNREACHABLE printLog("Unreachable"); UNREACHABLE_BACK
+#define NOT_IMPLEMENTED printLog("Not implemented"); exit(1)
extern void _printLogBack(const char *format, const char *file, int line, ...);