From: Joel Rosdahl Date: Wed, 7 Jul 2021 07:23:51 +0000 (+0200) Subject: Improve ssize_t typedefs for Windows platforms X-Git-Tag: v4.4~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dfd7a958a8b203d66f83c3a59cd244ad310994d;p=thirdparty%2Fccache.git Improve ssize_t typedefs for Windows platforms --- diff --git a/cmake/config.h.in b/cmake/config.h.in index 957118f32..65c8e7b8c 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -181,22 +181,21 @@ # undef HAVE_STRUCT_STAT_ST_MTIM #endif +// Typedefs that make it possible to use common types in ccache header files +// without including core/wincompat.hpp. #ifdef _WIN32 -# define NOMINMAX 1 -# define STDIN_FILENO 0 -# define STDOUT_FILENO 1 -# define STDERR_FILENO 2 - # ifdef _MSC_VER -# define PATH_MAX MAX_PATH typedef unsigned __int32 mode_t; typedef int pid_t; - -# ifndef __MINGW32__ +# ifdef _WIN64 typedef __int64 ssize_t; +# else +typedef int ssize_t; # endif -# endif -#endif // _WIN32 +# elif !defined(__MINGW32__) +typedef __int64 ssize_t; +# endif // _MSC_VER +#endif // _WIN32 // GCC version of a couple of standard C++ attributes. #ifdef __GNUC__ diff --git a/src/core/wincompat.hpp b/src/core/wincompat.hpp index 4bc2d16aa..f983bec0a 100644 --- a/src/core/wincompat.hpp +++ b/src/core/wincompat.hpp @@ -19,12 +19,16 @@ #pragma once #ifdef _WIN32 - # include -# ifndef __MINGW32__ -typedef __int64 ssize_t; -# endif +# define NOMINMAX 1 +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 + +# ifdef _MSC_VER +# define PATH_MAX MAX_PATH +# endif // _MSC_VER // From: // http://mesos.apache.org/api/latest/c++/3rdparty_2stout_2include_2stout_2windows_8hpp_source.html