Skip to content

Commit c8b161a

Browse files
committed
win32: ensure that localtime_r() is declared even in i686 builds
The `__MINGW64__` constant is defined, surprise, surprise, only when building for a 64-bit CPU architecture. Therefore using it as a guard to define `_POSIX_C_SOURCE` (so that `localtime_r()` is declared, among other functions) is not enough, we also need to check `__MINGW32__`. Technically, the latter constant is defined even for 64-bit builds. But let's make things a bit easier to understand by testing for both constants. Making it so fixes this compile warning (turned error in GCC v14.1): archive-zip.c: In function 'dos_time': archive-zip.c:612:9: error: implicit declaration of function 'localtime_r'; did you mean 'localtime_s'? [-Wimplicit-function-declaration] 612 | localtime_r(&time, &tm); | ^~~~~~~~~~~ | localtime_s Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 8d96f09 commit c8b161a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

compat/posix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
# define UNUSED
5757
#endif
5858

59-
#ifdef __MINGW64__
59+
#if defined(__MINGW32__) || defined(__MINGW64__)
6060
#define _POSIX_C_SOURCE 1
6161
#elif defined(__sun__)
6262
/*

0 commit comments

Comments
 (0)