From 384dfd3d2fc47505e462607a7676279bbf81ec34 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 10 Jun 2024 01:50:01 +0800 Subject: [PATCH] lobster/tools.h: avoid conflicting define for ssize_t --- lobster/src/lobster/tools.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git lobster/src/lobster/tools.h lobster/src/lobster/tools.h index 42d5434..2640793 100644 --- lobster/src/lobster/tools.h +++ lobster/src/lobster/tools.h @@ -25,9 +25,12 @@ typedef int64_t iint; // args and indexing, so using the 64-bit type above would introduce a lot // of casts. Best we can do is a signed version of that, until we can // stop targetting 32-bit entirely. -// This may also be defined in Posix (sys/types.h), but in C++ -// redefining typedefs is totally cool: +// This may also be defined in Posix (sys/types.h) or in string.h +// on Darwin, where it breaks the build. Undefine ssize_t if defined. +#ifdef ssize_t +#undef ssize_t typedef ptrdiff_t ssize_t; +#endif // Custom _L suffix, since neither L (different size on win/nix) or LL // (does not convert to int64_t on nix!) is portable.