0001-Drop-HAVE_BUGGY_STRTOF-for-MinGW.patch
text/x-patch
Filename: 0001-Drop-HAVE_BUGGY_STRTOF-for-MinGW.patch
Type: text/x-patch
Part: 0
Message:
Re: PRI?64 vs Visual Studio (2022)
From fb3f839947441cdcf06c7115f2c7f9ec90a3bee7 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 23 Nov 2025 12:22:46 +1300
Subject: [PATCH 1/2] Drop HAVE_BUGGY_STRTOF for MinGW.
Commit 72880ac182c8 pointed MinGW builds at our replacement strtof()
function. This isn't necessary with UCRT. Also remove a stray
reference to Visual Studio 2013 (another desupported way to use MSVCRT)
from meson.build.
---
configure | 9 ++++-----
configure.ac | 9 ++++-----
src/include/port/win32_port.h | 14 --------------
src/port/meson.build | 11 ++++-------
src/test/regress/resultmap | 1 -
5 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/configure b/configure
index 3a0ed11fa8e..b7bc44b017e 100755
--- a/configure
+++ b/configure
@@ -16192,11 +16192,10 @@ fi
-if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
- # Cygwin and (apparently, based on test results) Mingw both
- # have a broken strtof(), so substitute its implementation.
- # That's not a perfect fix, since it doesn't avoid double-rounding,
- # but we have no better options.
+if test "$PORTNAME" = "cygwin"; then
+ # Cygwin has a broken strtof(), so substitute its implementation. That's
+ # not a perfect fix, since it doesn't avoid double-rounding, but we have no
+ # better options.
case " $LIBOBJS " in
*" strtof.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strtof.$ac_objext"
diff --git a/configure.ac b/configure.ac
index c2413720a18..69a5c0d2e5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1850,11 +1850,10 @@ AC_REPLACE_FUNCS(m4_normalize([
AC_REPLACE_FUNCS(pthread_barrier_wait)
-if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
- # Cygwin and (apparently, based on test results) Mingw both
- # have a broken strtof(), so substitute its implementation.
- # That's not a perfect fix, since it doesn't avoid double-rounding,
- # but we have no better options.
+if test "$PORTNAME" = "cygwin"; then
+ # Cygwin has a broken strtof(), so substitute its implementation. That's
+ # not a perfect fix, since it doesn't avoid double-rounding, but we have no
+ # better options.
AC_LIBOBJ([strtof])
AC_MSG_NOTICE([On $host_os we will use our strtof wrapper.])
fi
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index f54ccef7db8..2ff54df5811 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -569,20 +569,6 @@ typedef unsigned short mode_t;
#endif /* _MSC_VER */
-#if defined(__MINGW32__) || defined(__MINGW64__)
-/*
- * Mingw claims to have a strtof, and my reading of its source code suggests
- * that it ought to work (and not need this hack), but the regression test
- * results disagree with me; whether this is a version issue or not is not
- * clear. However, using our wrapper (and the misrounded-input variant file,
- * already required for supporting ancient systems) can't make things any
- * worse, except for a tiny performance loss when reading zeros.
- *
- * See also cygwin.h for another instance of this.
- */
-#define HAVE_BUGGY_STRTOF 1
-#endif
-
/* in port/win32pread.c */
extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, pgoff_t offset);
diff --git a/src/port/meson.build b/src/port/meson.build
index fc7b059fee5..9eba75a75f7 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -135,13 +135,10 @@ foreach f : replace_funcs_pos
endforeach
-if (host_system == 'windows' or host_system == 'cygwin') and \
- (cc.get_id() != 'msvc' or cc.version().version_compare('<14.0'))
-
- # Cygwin and (apparently, based on test results) Mingw both
- # have a broken strtof(), so substitute its implementation.
- # That's not a perfect fix, since it doesn't avoid double-rounding,
- # but we have no better options.
+if host_system == 'cygwin'
+ # Cygwin has a broken strtof(), so substitute its implementation. That's not
+ # a perfect fix, since it doesn't avoid double-rounding, but we have no
+ # better options.
pgport_sources += files('strtof.c')
message('On @0@ with compiler @1@ @2@ we will use our strtof wrapper.'.format(
host_system, cc.get_id(), cc.version()))
diff --git a/src/test/regress/resultmap b/src/test/regress/resultmap
index 8a3ed50585e..9ccc08c7cf3 100644
--- a/src/test/regress/resultmap
+++ b/src/test/regress/resultmap
@@ -1,2 +1 @@
float4:out:.*-.*-cygwin.*=float4-misrounded-input.out
-float4:out:.*-.*-mingw.*=float4-misrounded-input.out
--
2.51.2