From 51b09f35adbc3b849d4c16596727f696cdfd2fbf Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 25 Dec 2022 13:00:47 +0100 Subject: [PATCH] MSVC does not have __attribute__((weak)) --- src/util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index b8c2bc0..7d1bbd3 100644 --- a/src/util.c +++ b/src/util.c @@ -6,9 +6,15 @@ #include #include +#ifndef _MSC_VER +#define WEAK __attribute__((weak)) +#else +#define WEAK +#endif + // Default implementation for minitar_handle_panic(). Since it's declared weak, any other definition will silently // override this one :) -__attribute__((weak)) noreturn void minitar_handle_panic(const char* message) +WEAK noreturn void minitar_handle_panic(const char* message) { fprintf(stderr, "minitar: %s\n", message); abort();