From c01ce063077a7d6a2013e75485d2188e647438cb Mon Sep 17 00:00:00 2001 From: Quinn Date: Fri, 18 Apr 2025 21:22:16 +0200 Subject: [PATCH] add macros for writing inline platform-specific expressions --- src/util/compat.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/compat.h b/src/util/compat.h index b4f0651..2ba9b79 100644 --- a/src/util/compat.h +++ b/src/util/compat.h @@ -12,10 +12,14 @@ # define PATH_SEP '\\' // contains the path separator as a character. Yes it is extremely annoying that this has to exist. # define PATH_SEP_STR "\\" // contains the path separator as a string, useful for concatenation. Yes it is extremely annoying that this has to exist. +# define unixonly(_exec) // (no-op) executes inline code when __unix__ is defined, otherwise is no-op +# define winonly(_exec) _exec // executes inline code when _WIN32 is defined, otherwise is no-op #else # define PATH_SEP '/' // contains the path separator as a character. Yes it is extremely annoying that this has to exist. # define PATH_SEP_STR "/" // contains the path separator as a string, useful for concatenation. Yes it is extremely annoying that this has to exist. +# define unixonly(_exec) _exec // executes inline code when __unix__ is defined, otherwise is no-op +# define winonly(_exec) // (no-op) executes inline code when _WIN32 is defined, otherwise is no-op #endif // define the constants if they haven't been