]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improve ssize_t typedefs for Windows platforms
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 7 Jul 2021 07:23:51 +0000 (09:23 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 7 Jul 2021 07:49:56 +0000 (09:49 +0200)
cmake/config.h.in
src/core/wincompat.hpp

index 957118f328ad5ab8aa4ce70293568954f142a3a8..65c8e7b8c28bfe0a2303e986351e485f2be093a7 100644 (file)
 #  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__
index 4bc2d16aa6ea3ea4336207def1e07e75e11c0d75..f983bec0a324ccc62e06409b8a581be6a85009d2 100644 (file)
 #pragma once
 
 #ifdef _WIN32
-
 #  include <sys/stat.h>
 
-#  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