Fix SIZEOF_OFF_T check for MinGW

This commit is contained in:
Boris Kolpackov 2022-09-07 11:21:16 +02:00
parent 367c4529d2
commit 9ea8f09e9c
2 changed files with 11 additions and 0 deletions

View File

@ -20,4 +20,6 @@ main ()
#ifdef TEST_PTHREAD #ifdef TEST_PTHREAD
assert (SIZEOF_PTHREAD_T == sizeof (pthread_t)); assert (SIZEOF_PTHREAD_T == sizeof (pthread_t));
#endif #endif
return 0;
} }

View File

@ -8,10 +8,19 @@
* *
* Note that the _FILE_OFFSET_BITS macro is expected to be defined by the * Note that the _FILE_OFFSET_BITS macro is expected to be defined by the
* user, for example, on the command line. * user, for example, on the command line.
*
* MinGW uses 32-bit off_t both in the 32-bit and 64-bit modes unless forced
* with _FILE_OFFSET_BITS.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
# define SIZEOF_OFF_T 4 # define SIZEOF_OFF_T 4
#elif defined(__MINGW32__)
# if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
# define SIZEOF_OFF_T 8
# else
# define SIZEOF_OFF_T 4
# endif
#elif (defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8) || \ #elif (defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8) || \
(defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64) (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
# define SIZEOF_OFF_T 8 # define SIZEOF_OFF_T 8