From b581b5918219a5f5169d59faca6f4dee20531482 Mon Sep 17 00:00:00 2001 From: A404M Date: Sat, 26 Apr 2025 02:10:25 +0330 Subject: some small changes --- src/utils/log.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/utils') 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 +#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, ...); -- cgit v1.2.3