diff --git a/src/fastfetch.h b/src/fastfetch.h index c9cbfbb62..ccf3a8f10 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -14,6 +14,10 @@ #include "3rdparty/yyjson/yyjson.h" #endif +#ifdef _MSC_VER + #define __attribute__(x) +#endif + #include "util/FFstrbuf.h" #include "util/FFlist.h" #include "util/platform/FFPlatform.h" diff --git a/src/util/FFcheckmacros.h b/src/util/FFcheckmacros.h index 1ed61cf82..9eb45f78c 100644 --- a/src/util/FFcheckmacros.h +++ b/src/util/FFcheckmacros.h @@ -3,8 +3,14 @@ #ifndef FASTFETCH_INCLUDED_FFCHECKMACROS #define FASTFETCH_INCLUDED_FFCHECKMACROS +#ifdef _MSC_VER + #include +#endif + #if defined(__GNUC__) || defined(__clang__) #define FF_C_NODISCARD __attribute__((warn_unused_result)) +#elif defined(_MSC_VER) + #define FF_C_NODISCARD _Check_return_ #else #define FF_C_NODISCARD #endif diff --git a/src/util/unused.h b/src/util/unused.h index fbc0e93e3..faef70d09 100644 --- a/src/util/unused.h +++ b/src/util/unused.h @@ -5,6 +5,10 @@ static inline void ffUnused(int dummy, ...) { (void) dummy; } #define FF_UNUSED(...) ffUnused(0, __VA_ARGS__); -#define FF_MAYBE_UNUSED __attribute__ ((__unused__)) +#if defined(__GNUC__) || defined(__clang__) + #define FF_MAYBE_UNUSED __attribute__ ((__unused__)) +#else + #define FF_MAYBE_UNUSED +#endif #endif