diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-26 02:10:25 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-26 02:10:25 +0330 |
commit | b581b5918219a5f5169d59faca6f4dee20531482 (patch) | |
tree | ac25330ee8de7ac0d28813edbc4c2be892e2c9b4 /src/utils | |
parent | 85bfc724dd2bdaa2259512c1b8ab21f7dfeca8f1 (diff) |
some small changes
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/log.h | 11 |
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, ...); |