diff options
author | Jacob Nevins <jacobn@chiark.greenend.org.uk> | 2022-08-29 15:00:56 +0300 |
---|---|---|
committer | Jacob Nevins <jacobn@chiark.greenend.org.uk> | 2022-08-29 19:22:28 +0300 |
commit | baea34a5b2d9cd5734c1f4ebf8f4dc121d227820 (patch) | |
tree | 16c3fdbad4bee77cd1c364aac9b573a0189c54da /cmake | |
parent | 55d19f62951f6fd91350728fd3573bad87e663c6 (diff) |
Reinstate __USE_MINGW_ANSI_STDIO for MinGW builds.
This was lost in the mkfiles.pl->cmake transition (c19e7215dd).
Without this, MinGW builds were providing format strings like %zu to a
version of vsnprintf that didn't support them at runtime, so you'd get
messages like "Pageant has zu SSH-2 keys". (-Wformat would have
complained about the unknown %z format specifier, but even STRICT MinGW
builds don't get those warnings, hm.)
Now the runtime version understands %zu.
I've reviewed the other compile-time definitions that were unique to the
old Makefile.mgw, and decided not to reinstate any of them:
WIN32S_COMPAT: leave it out.
This came in in bd4b8c1285. Rationale from Joris van Rantwijk in email
2000-01-24: "Use -DWIN32S_COMPAT to avoid a linking error about
SystemPowerStatus".
But that problem was solved another way within 8 months, and
WIN32S_COMPAT removed from the code, in 76746a7d61, so this wart had
been redundant since then.
_NO_OLDNAMES: decided not to add anything back for this.
This actually does nothing with the mingw-w64 fork (which seems to spell
it NO_OLDNAMES), although current versions of original-mingw do also
still spell it _NO_OLDNAMES.
They both seem to be about suppressing a behaviour where a load of
"non-ANSI" names like strdup get redirected to invoke _strdup in MS'
libraries.
Again, original rationale is from Joris van Rantwijk: "Compile and link
with -mno-cygwin (and -D_NO_OLDNAMES) to get executables that don't need
the Cygwin DLL file."
Since I don't know of any behavioural differences that this causes
(unlike vsnprintf/_vsnprintf), and it's not obviously causing trouble
for me, continue to leave things in the default state.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/toolchain-mingw.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/toolchain-mingw.cmake b/cmake/toolchain-mingw.cmake index 013dbeb5..2e0bc669 100644 --- a/cmake/toolchain-mingw.cmake +++ b/cmake/toolchain-mingw.cmake @@ -8,3 +8,5 @@ set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) set(CMAKE_AR x86_64-w64-mingw32-ar) set(CMAKE_RANLIB x86_64-w64-mingw32-ranlib) + +add_compile_definitions(__USE_MINGW_ANSI_STDIO) |