summaryrefslogtreecommitdiff
path: root/src/utils/log.c
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-02-13 18:39:08 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-02-13 18:40:23 +0330
commitcb6eaf13c3b3b58779a18255177589d8d5fbf85b (patch)
tree40e648d02dc450bdda7bd4e31503b76ab4bf0a69 /src/utils/log.c
parent0ff9508bb0ea7193b0101c3cd9b4ae594e44fd02 (diff)
add i8 u8 i16 u16 i32 u32
add overflow warning
Diffstat (limited to 'src/utils/log.c')
-rw-r--r--src/utils/log.c15
1 files changed, 10 insertions, 5 deletions
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) {