From cb6eaf13c3b3b58779a18255177589d8d5fbf85b Mon Sep 17 00:00:00 2001 From: A404M Date: Thu, 13 Feb 2025 18:39:08 +0330 Subject: add i8 u8 i16 u16 i32 u32 add overflow warning --- src/utils/log.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/utils/log.c') diff --git a/src/utils/log.c b/src/utils/log.c index 3f73729..9b8f94f 100644 --- a/src/utils/log.c +++ b/src/utils/log.c @@ -17,8 +17,8 @@ void _printLogBack(const char *format, const char *file, int line, ...) { free(errorStr); } -void _printErrorBack(const char *file, int line, char *begin, char *end, - const char *format, ...) { +void _printErrorWarningBack(const char *file, int line, char *begin, char *end, + bool isError, const char *format, ...) { va_list args; va_start(args, end); char *errorStr; @@ -35,9 +35,14 @@ void _printErrorBack(const char *file, int line, char *begin, char *end, } const char firstColor[] = "\e[0;36m"; - const char secondColor[] = "\e[0;31m"; - fprintf(stderr, "%sError: %s at compiler %s:%d\e[0m\n", firstColor, errorStr, - file, line); + const char *secondColor = isError ? "\e[0;31m" : "\e[0;33m"; + if (isError) { + fprintf(stderr, "%sError: %s at compiler %s:%d\e[0m\n", firstColor, + errorStr, file, line); + } else { + fprintf(stderr, "%sWarning: %s at compiler %s:%d\e[0m\n", firstColor, + errorStr, file, line); + } free(errorStr); if (file_index == SIZE_MAX) { -- cgit v1.2.3